2011-03-20 18:05:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/aui/toolbar.h
|
|
|
|
// Purpose: wxaui: wx advanced user interface - docking window manager
|
|
|
|
// Author: Benjamin I. Williams
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2008-08-04
|
2012-03-18 01:12:27 +00:00
|
|
|
// RCS-ID: $Id: auibar.h 69594 2011-10-30 16:51:10Z VZ $
|
2011-03-20 18:05:19 +00:00
|
|
|
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
|
|
|
|
// Licence: wxWindows Library Licence, Version 3.1
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_AUIBAR_H_
|
|
|
|
#define _WX_AUIBAR_H_
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_AUI
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/sizer.h"
|
|
|
|
#include "wx/pen.h"
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxClientDC;
|
|
|
|
class WXDLLIMPEXP_FWD_AUI wxAuiPaneInfo;
|
|
|
|
|
|
|
|
enum wxAuiToolBarStyle
|
|
|
|
{
|
|
|
|
wxAUI_TB_TEXT = 1 << 0,
|
|
|
|
wxAUI_TB_NO_TOOLTIPS = 1 << 1,
|
|
|
|
wxAUI_TB_NO_AUTORESIZE = 1 << 2,
|
|
|
|
wxAUI_TB_GRIPPER = 1 << 3,
|
|
|
|
wxAUI_TB_OVERFLOW = 1 << 4,
|
|
|
|
// using this style forces the toolbar to be vertical and
|
|
|
|
// be only dockable to the left or right sides of the window
|
|
|
|
// whereas by default it can be horizontal or vertical and
|
|
|
|
// be docked anywhere
|
|
|
|
wxAUI_TB_VERTICAL = 1 << 5,
|
|
|
|
wxAUI_TB_HORZ_LAYOUT = 1 << 6,
|
|
|
|
// analogous to wxAUI_TB_VERTICAL, but forces the toolbar
|
|
|
|
// to be horizontal
|
|
|
|
wxAUI_TB_HORIZONTAL = 1 << 7,
|
|
|
|
wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
|
|
|
|
wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
|
|
|
|
wxAUI_TB_DEFAULT_STYLE = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wxAuiToolBarArtSetting
|
|
|
|
{
|
|
|
|
wxAUI_TBART_SEPARATOR_SIZE = 0,
|
|
|
|
wxAUI_TBART_GRIPPER_SIZE = 1,
|
|
|
|
wxAUI_TBART_OVERFLOW_SIZE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wxAuiToolBarToolTextOrientation
|
|
|
|
{
|
|
|
|
wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented
|
|
|
|
wxAUI_TBTOOL_TEXT_RIGHT = 1,
|
|
|
|
wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented
|
|
|
|
wxAUI_TBTOOL_TEXT_BOTTOM = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// aui toolbar event class
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL,
|
|
|
|
int winId = 0)
|
|
|
|
: wxNotifyEvent(commandType, winId)
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
m_isDropdownClicked = false;
|
|
|
|
m_clickPt = wxPoint(-1, -1);
|
|
|
|
m_rect = wxRect(-1,-1, 0, 0);
|
|
|
|
m_toolId = -1;
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
#ifndef SWIG
|
|
|
|
wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c)
|
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
m_isDropdownClicked = c.m_isDropdownClicked;
|
|
|
|
m_clickPt = c.m_clickPt;
|
|
|
|
m_rect = c.m_rect;
|
|
|
|
m_toolId = c.m_toolId;
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); }
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
bool IsDropDownClicked() const { return m_isDropdownClicked; }
|
|
|
|
void SetDropDownClicked(bool c) { m_isDropdownClicked = c; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxPoint GetClickPoint() const { return m_clickPt; }
|
|
|
|
void SetClickPoint(const wxPoint& p) { m_clickPt = p; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxRect GetItemRect() const { return m_rect; }
|
|
|
|
void SetItemRect(const wxRect& r) { m_rect = r; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
int GetToolId() const { return m_toolId; }
|
|
|
|
void SetToolId(int toolId) { m_toolId = toolId; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
bool m_isDropdownClicked;
|
|
|
|
wxPoint m_clickPt;
|
|
|
|
wxRect m_rect;
|
|
|
|
int m_toolId;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarItem
|
|
|
|
{
|
|
|
|
friend class wxAuiToolBar;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBarItem()
|
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
m_window = NULL;
|
|
|
|
m_sizerItem = NULL;
|
|
|
|
m_spacerPixels = 0;
|
|
|
|
m_toolId = 0;
|
|
|
|
m_kind = wxITEM_NORMAL;
|
|
|
|
m_state = 0; // normal, enabled
|
|
|
|
m_proportion = 0;
|
|
|
|
m_active = true;
|
|
|
|
m_dropDown = true;
|
|
|
|
m_sticky = true;
|
|
|
|
m_userData = 0;
|
|
|
|
m_alignment = wxALIGN_CENTER;
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxAuiToolBarItem(const wxAuiToolBarItem& c)
|
|
|
|
{
|
|
|
|
Assign(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c)
|
|
|
|
{
|
|
|
|
Assign(c);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Assign(const wxAuiToolBarItem& c)
|
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
m_window = c.m_window;
|
|
|
|
m_label = c.m_label;
|
|
|
|
m_bitmap = c.m_bitmap;
|
|
|
|
m_disabledBitmap = c.m_disabledBitmap;
|
|
|
|
m_hoverBitmap = c.m_hoverBitmap;
|
|
|
|
m_shortHelp = c.m_shortHelp;
|
|
|
|
m_longHelp = c.m_longHelp;
|
|
|
|
m_sizerItem = c.m_sizerItem;
|
|
|
|
m_minSize = c.m_minSize;
|
|
|
|
m_spacerPixels = c.m_spacerPixels;
|
|
|
|
m_toolId = c.m_toolId;
|
|
|
|
m_kind = c.m_kind;
|
|
|
|
m_state = c.m_state;
|
|
|
|
m_proportion = c.m_proportion;
|
|
|
|
m_active = c.m_active;
|
|
|
|
m_dropDown = c.m_dropDown;
|
|
|
|
m_sticky = c.m_sticky;
|
|
|
|
m_userData = c.m_userData;
|
|
|
|
m_alignment = c.m_alignment;
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetWindow(wxWindow* w) { m_window = w; }
|
|
|
|
wxWindow* GetWindow() { return m_window; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetId(int newId) { m_toolId = newId; }
|
|
|
|
int GetId() const { return m_toolId; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetKind(int newKind) { m_kind = newKind; }
|
|
|
|
int GetKind() const { return m_kind; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetState(int newState) { m_state = newState; }
|
|
|
|
int GetState() const { return m_state; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; }
|
|
|
|
wxSizerItem* GetSizerItem() const { return m_sizerItem; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetLabel(const wxString& s) { m_label = s; }
|
|
|
|
const wxString& GetLabel() const { return m_label; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetBitmap(const wxBitmap& bmp) { m_bitmap = bmp; }
|
|
|
|
const wxBitmap& GetBitmap() const { return m_bitmap; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetDisabledBitmap(const wxBitmap& bmp) { m_disabledBitmap = bmp; }
|
|
|
|
const wxBitmap& GetDisabledBitmap() const { return m_disabledBitmap; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetHoverBitmap(const wxBitmap& bmp) { m_hoverBitmap = bmp; }
|
|
|
|
const wxBitmap& GetHoverBitmap() const { return m_hoverBitmap; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetShortHelp(const wxString& s) { m_shortHelp = s; }
|
|
|
|
const wxString& GetShortHelp() const { return m_shortHelp; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetLongHelp(const wxString& s) { m_longHelp = s; }
|
|
|
|
const wxString& GetLongHelp() const { return m_longHelp; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetMinSize(const wxSize& s) { m_minSize = s; }
|
|
|
|
const wxSize& GetMinSize() const { return m_minSize; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetSpacerPixels(int s) { m_spacerPixels = s; }
|
|
|
|
int GetSpacerPixels() const { return m_spacerPixels; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetProportion(int p) { m_proportion = p; }
|
|
|
|
int GetProportion() const { return m_proportion; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetActive(bool b) { m_active = b; }
|
|
|
|
bool IsActive() const { return m_active; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetHasDropDown(bool b) { m_dropDown = b; }
|
|
|
|
bool HasDropDown() const { return m_dropDown; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetSticky(bool b) { m_sticky = b; }
|
|
|
|
bool IsSticky() const { return m_sticky; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetUserData(long l) { m_userData = l; }
|
|
|
|
long GetUserData() const { return m_userData; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetAlignment(int l) { m_alignment = l; }
|
|
|
|
int GetAlignment() const { return m_alignment; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxWindow* m_window; // item's associated window
|
|
|
|
wxString m_label; // label displayed on the item
|
|
|
|
wxBitmap m_bitmap; // item's bitmap
|
|
|
|
wxBitmap m_disabledBitmap; // item's disabled bitmap
|
|
|
|
wxBitmap m_hoverBitmap; // item's hover bitmap
|
|
|
|
wxString m_shortHelp; // short help (for tooltip)
|
|
|
|
wxString m_longHelp; // long help (for status bar)
|
|
|
|
wxSizerItem* m_sizerItem; // sizer item
|
|
|
|
wxSize m_minSize; // item's minimum size
|
|
|
|
int m_spacerPixels; // size of a spacer
|
|
|
|
int m_toolId; // item's id
|
|
|
|
int m_kind; // item's kind
|
|
|
|
int m_state; // state
|
|
|
|
int m_proportion; // proportion
|
|
|
|
bool m_active; // true if the item is currently active
|
|
|
|
bool m_dropDown; // true if the item has a dropdown button
|
|
|
|
bool m_sticky; // overrides button states if true (always active)
|
|
|
|
long m_userData; // user-specified data
|
|
|
|
int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tab art class
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarArt
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBarArt() { }
|
|
|
|
virtual ~wxAuiToolBarArt() { }
|
|
|
|
|
|
|
|
virtual wxAuiToolBarArt* Clone() = 0;
|
|
|
|
virtual void SetFlags(unsigned int flags) = 0;
|
|
|
|
virtual unsigned int GetFlags() = 0;
|
|
|
|
virtual void SetFont(const wxFont& font) = 0;
|
|
|
|
virtual wxFont GetFont() = 0;
|
|
|
|
virtual void SetTextOrientation(int orientation) = 0;
|
|
|
|
virtual int GetTextOrientation() = 0;
|
|
|
|
|
|
|
|
virtual void DrawBackground(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawDropDownButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawControlLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawSeparator(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawGripper(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawOverflowButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect,
|
|
|
|
int state) = 0;
|
|
|
|
|
|
|
|
virtual wxSize GetLabelSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item) = 0;
|
|
|
|
|
|
|
|
virtual wxSize GetToolSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item) = 0;
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual int GetElementSize(int elementId) = 0;
|
|
|
|
virtual void SetElementSize(int elementId, int size) = 0;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
virtual int ShowDropDown(
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItemArray& items) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiDefaultToolBarArt();
|
|
|
|
virtual ~wxAuiDefaultToolBarArt();
|
|
|
|
|
|
|
|
virtual wxAuiToolBarArt* Clone();
|
|
|
|
virtual void SetFlags(unsigned int flags);
|
|
|
|
virtual unsigned int GetFlags();
|
|
|
|
virtual void SetFont(const wxFont& font);
|
|
|
|
virtual wxFont GetFont();
|
|
|
|
virtual void SetTextOrientation(int orientation);
|
|
|
|
virtual int GetTextOrientation();
|
|
|
|
|
|
|
|
virtual void DrawBackground(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawDropDownButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawControlLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawSeparator(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawGripper(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect);
|
|
|
|
|
|
|
|
virtual void DrawOverflowButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect,
|
|
|
|
int state);
|
|
|
|
|
|
|
|
virtual wxSize GetLabelSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item);
|
|
|
|
|
|
|
|
virtual wxSize GetToolSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item);
|
|
|
|
|
|
|
|
virtual int GetElementSize(int element);
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual void SetElementSize(int elementId, int size);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
virtual int ShowDropDown(wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItemArray& items);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxBitmap m_buttonDropDownBmp;
|
|
|
|
wxBitmap m_disabledButtonDropDownBmp;
|
|
|
|
wxBitmap m_overflowBmp;
|
|
|
|
wxBitmap m_disabledOverflowBmp;
|
|
|
|
wxColour m_baseColour;
|
|
|
|
wxColour m_highlightColour;
|
2011-03-20 18:05:19 +00:00
|
|
|
wxFont m_font;
|
|
|
|
unsigned int m_flags;
|
2012-03-18 01:12:27 +00:00
|
|
|
int m_textOrientation;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxPen m_gripperPen1;
|
|
|
|
wxPen m_gripperPen2;
|
|
|
|
wxPen m_gripperPen3;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
int m_separatorSize;
|
|
|
|
int m_gripperSize;
|
|
|
|
int m_overflowSize;
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBar(wxWindow* parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint& position = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxAUI_TB_DEFAULT_STYLE);
|
|
|
|
virtual ~wxAuiToolBar();
|
|
|
|
|
|
|
|
void SetWindowStyleFlag(long style);
|
|
|
|
long GetWindowStyleFlag() const;
|
|
|
|
|
|
|
|
void SetArtProvider(wxAuiToolBarArt* art);
|
|
|
|
wxAuiToolBarArt* GetArtProvider() const;
|
|
|
|
|
|
|
|
bool SetFont(const wxFont& font);
|
|
|
|
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* AddTool(int toolId,
|
2011-03-20 18:05:19 +00:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
2012-03-18 01:12:27 +00:00
|
|
|
const wxString& shortHelpString = wxEmptyString,
|
2011-03-20 18:05:19 +00:00
|
|
|
wxItemKind kind = wxITEM_NORMAL);
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* AddTool(int toolId,
|
2011-03-20 18:05:19 +00:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
2012-03-18 01:12:27 +00:00
|
|
|
const wxBitmap& disabledBitmap,
|
2011-03-20 18:05:19 +00:00
|
|
|
wxItemKind kind,
|
2012-03-18 01:12:27 +00:00
|
|
|
const wxString& shortHelpString,
|
|
|
|
const wxString& longHelpString,
|
|
|
|
wxObject* clientData);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* AddTool(int toolId,
|
2011-03-20 18:05:19 +00:00
|
|
|
const wxBitmap& bitmap,
|
2012-03-18 01:12:27 +00:00
|
|
|
const wxBitmap& disabledBitmap,
|
2011-03-20 18:05:19 +00:00
|
|
|
bool toggle = false,
|
2012-03-18 01:12:27 +00:00
|
|
|
wxObject* clientData = NULL,
|
|
|
|
const wxString& shortHelpString = wxEmptyString,
|
|
|
|
const wxString& longHelpString = wxEmptyString)
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
return AddTool(toolId,
|
2011-03-20 18:05:19 +00:00
|
|
|
wxEmptyString,
|
|
|
|
bitmap,
|
2012-03-18 01:12:27 +00:00
|
|
|
disabledBitmap,
|
2011-03-20 18:05:19 +00:00
|
|
|
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
|
2012-03-18 01:12:27 +00:00
|
|
|
shortHelpString,
|
|
|
|
longHelpString,
|
|
|
|
clientData);
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* AddLabel(int toolId,
|
2011-03-20 18:05:19 +00:00
|
|
|
const wxString& label = wxEmptyString,
|
|
|
|
const int width = -1);
|
|
|
|
wxAuiToolBarItem* AddControl(wxControl* control,
|
|
|
|
const wxString& label = wxEmptyString);
|
|
|
|
wxAuiToolBarItem* AddSeparator();
|
|
|
|
wxAuiToolBarItem* AddSpacer(int pixels);
|
|
|
|
wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
|
|
|
|
|
|
|
|
bool Realize();
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxControl* FindControl(int windowId);
|
2011-03-20 18:05:19 +00:00
|
|
|
wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
|
|
|
|
wxAuiToolBarItem* FindToolByIndex(int idx) const;
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* FindTool(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
void ClearTools() { Clear() ; }
|
|
|
|
void Clear();
|
2012-03-18 01:12:27 +00:00
|
|
|
bool DeleteTool(int toolId);
|
|
|
|
bool DeleteByIndex(int toolId);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
size_t GetToolCount() const;
|
2012-03-18 01:12:27 +00:00
|
|
|
int GetToolPos(int toolId) const { return GetToolIndex(toolId); }
|
|
|
|
int GetToolIndex(int toolId) const;
|
|
|
|
bool GetToolFits(int toolId) const;
|
|
|
|
wxRect GetToolRect(int toolId) const;
|
|
|
|
bool GetToolFitsByIndex(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
bool GetToolBarFits() const;
|
|
|
|
|
|
|
|
void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); }
|
|
|
|
void SetMargins(int x, int y) { SetMargins(x, x, y, y); }
|
|
|
|
void SetMargins(int left, int right, int top, int bottom);
|
|
|
|
|
|
|
|
void SetToolBitmapSize(const wxSize& size);
|
|
|
|
wxSize GetToolBitmapSize() const;
|
|
|
|
|
|
|
|
bool GetOverflowVisible() const;
|
|
|
|
void SetOverflowVisible(bool visible);
|
|
|
|
|
|
|
|
bool GetGripperVisible() const;
|
|
|
|
void SetGripperVisible(bool visible);
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void ToggleTool(int toolId, bool state);
|
|
|
|
bool GetToolToggled(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void EnableTool(int toolId, bool state);
|
|
|
|
bool GetToolEnabled(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetToolDropDown(int toolId, bool dropdown);
|
|
|
|
bool GetToolDropDown(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
void SetToolBorderPadding(int padding);
|
|
|
|
int GetToolBorderPadding() const;
|
|
|
|
|
|
|
|
void SetToolTextOrientation(int orientation);
|
|
|
|
int GetToolTextOrientation() const;
|
|
|
|
|
|
|
|
void SetToolPacking(int packing);
|
|
|
|
int GetToolPacking() const;
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetToolProportion(int toolId, int proportion);
|
|
|
|
int GetToolProportion(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
void SetToolSeparation(int separation);
|
|
|
|
int GetToolSeparation() const;
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
void SetToolSticky(int toolId, bool sticky);
|
|
|
|
bool GetToolSticky(int toolId) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxString GetToolLabel(int toolId) const;
|
|
|
|
void SetToolLabel(int toolId, const wxString& label);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxBitmap GetToolBitmap(int toolId) const;
|
|
|
|
void SetToolBitmap(int toolId, const wxBitmap& bitmap);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxString GetToolShortHelp(int toolId) const;
|
|
|
|
void SetToolShortHelp(int toolId, const wxString& helpString);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
wxString GetToolLongHelp(int toolId) const;
|
|
|
|
void SetToolLongHelp(int toolId, const wxString& helpString);
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
|
|
|
|
const wxAuiToolBarItemArray& append);
|
|
|
|
|
|
|
|
// get size of hint rectangle for a particular dock location
|
2012-03-18 01:12:27 +00:00
|
|
|
wxSize GetHintSize(int dockDirection) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
bool IsPaneValid(const wxAuiPaneInfo& pane) const;
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
// Override to call DoIdleUpdate().
|
|
|
|
virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
|
|
|
|
|
2011-03-20 18:05:19 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void OnCustomRender(wxDC& WXUNUSED(dc),
|
|
|
|
const wxAuiToolBarItem& WXUNUSED(item),
|
|
|
|
const wxRect& WXUNUSED(rect)) { }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void DoIdleUpdate();
|
|
|
|
void SetOrientation(int orientation);
|
|
|
|
void SetHoverItem(wxAuiToolBarItem* item);
|
|
|
|
void SetPressedItem(wxAuiToolBarItem* item);
|
|
|
|
void RefreshOverflowState();
|
|
|
|
|
|
|
|
int GetOverflowState() const;
|
|
|
|
wxRect GetOverflowRect() const;
|
|
|
|
wxSize GetLabelSize(const wxString& label);
|
|
|
|
wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const;
|
|
|
|
|
|
|
|
void DoSetSize(int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
|
|
|
|
|
|
|
protected: // handlers
|
|
|
|
|
|
|
|
void OnSize(wxSizeEvent& evt);
|
|
|
|
void OnIdle(wxIdleEvent& evt);
|
|
|
|
void OnPaint(wxPaintEvent& evt);
|
|
|
|
void OnEraseBackground(wxEraseEvent& evt);
|
|
|
|
void OnLeftDown(wxMouseEvent& evt);
|
|
|
|
void OnLeftUp(wxMouseEvent& evt);
|
|
|
|
void OnRightDown(wxMouseEvent& evt);
|
|
|
|
void OnRightUp(wxMouseEvent& evt);
|
|
|
|
void OnMiddleDown(wxMouseEvent& evt);
|
|
|
|
void OnMiddleUp(wxMouseEvent& evt);
|
|
|
|
void OnMotion(wxMouseEvent& evt);
|
|
|
|
void OnLeaveWindow(wxMouseEvent& evt);
|
|
|
|
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
|
|
|
|
void OnSetCursor(wxSetCursorEvent& evt);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
wxAuiToolBarItemArray m_items; // array of toolbar items
|
|
|
|
wxAuiToolBarArt* m_art; // art provider
|
|
|
|
wxBoxSizer* m_sizer; // main sizer for toolbar
|
2012-03-18 01:12:27 +00:00
|
|
|
wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed)
|
|
|
|
wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown
|
2011-03-20 18:05:19 +00:00
|
|
|
wxBitmap m_bitmap; // double-buffer bitmap
|
2012-03-18 01:12:27 +00:00
|
|
|
wxSizerItem* m_gripperSizerItem;
|
|
|
|
wxSizerItem* m_overflowSizerItem;
|
|
|
|
wxSize m_absoluteMinSize;
|
|
|
|
wxPoint m_actionPos; // position of left-mouse down
|
|
|
|
wxAuiToolBarItemArray m_customOverflowPrepend;
|
|
|
|
wxAuiToolBarItemArray m_customOverflowAppend;
|
|
|
|
|
|
|
|
int m_buttonWidth;
|
|
|
|
int m_buttonHeight;
|
|
|
|
int m_sizerElementCount;
|
|
|
|
int m_leftPadding;
|
|
|
|
int m_rightPadding;
|
|
|
|
int m_topPadding;
|
|
|
|
int m_bottomPadding;
|
|
|
|
int m_toolPacking;
|
|
|
|
int m_toolBorderPadding;
|
|
|
|
int m_toolTextOrientation;
|
|
|
|
int m_overflowState;
|
2011-03-20 18:05:19 +00:00
|
|
|
bool m_dragging;
|
2012-03-18 01:12:27 +00:00
|
|
|
bool m_gripperVisible;
|
|
|
|
bool m_overflowVisible;
|
2011-03-20 18:05:19 +00:00
|
|
|
long m_style;
|
|
|
|
|
|
|
|
bool RealizeHelper(wxClientDC& dc, bool horizontal);
|
|
|
|
static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);
|
|
|
|
bool IsPaneValid(long style) const;
|
|
|
|
void SetArtFlags() const;
|
|
|
|
wxOrientation m_orientation;
|
|
|
|
wxSize m_horzHintSize;
|
|
|
|
wxSize m_vertHintSize;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Common part of OnLeaveWindow() and OnCaptureLost().
|
|
|
|
void DoResetMouseState();
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_CLASS(wxAuiToolBar)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wx event machinery
|
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent );
|
|
|
|
|
|
|
|
typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
|
|
|
|
|
|
|
|
#define wxAuiToolBarEventHandler(func) \
|
|
|
|
wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func)
|
|
|
|
|
|
|
|
#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// wxpython/swig event work
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG;
|
|
|
|
|
|
|
|
%pythoncode {
|
|
|
|
EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, 1 )
|
|
|
|
EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, 1 )
|
|
|
|
}
|
|
|
|
#endif // SWIG
|
|
|
|
|
|
|
|
#endif // wxUSE_AUI
|
|
|
|
#endif // _WX_AUIBAR_H_
|
|
|
|
|