]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/toolbar.h
Make wxComboCtrlBase::Set*groundColour() methods public.
[wxWidgets.git] / include / wx / univ / toolbar.h
CommitLineData
c08a4f00
RR
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/toolbar.h
3// Purpose: wxToolBar declaration
4// Author: Robert Roebling
5// Modified by:
6// Created: 10.09.00
c08a4f00 7// Copyright: (c) Robert Roebling
65571936 8// Licence: wxWindows licence
c08a4f00
RR
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_UNIV_TOOLBAR_H_
12#define _WX_UNIV_TOOLBAR_H_
13
3216dbf5
VZ
14#include "wx/button.h" // for wxStdButtonInputHandler
15
b5dbe15d 16class WXDLLIMPEXP_FWD_CORE wxToolBarTool;
c08a4f00
RR
17
18// ----------------------------------------------------------------------------
3216dbf5 19// the actions supported by this control
c08a4f00
RR
20// ----------------------------------------------------------------------------
21
3216dbf5
VZ
22#define wxACTION_TOOLBAR_TOGGLE wxACTION_BUTTON_TOGGLE
23#define wxACTION_TOOLBAR_PRESS wxACTION_BUTTON_PRESS
24#define wxACTION_TOOLBAR_RELEASE wxACTION_BUTTON_RELEASE
25#define wxACTION_TOOLBAR_CLICK wxACTION_BUTTON_CLICK
9a83f860
VZ
26#define wxACTION_TOOLBAR_ENTER wxT("enter") // highlight the tool
27#define wxACTION_TOOLBAR_LEAVE wxT("leave") // unhighlight the tool
c08a4f00 28
3216dbf5
VZ
29// ----------------------------------------------------------------------------
30// wxToolBar
31// ----------------------------------------------------------------------------
c08a4f00 32
53a2db12 33class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
9467bdb7 34{
c08a4f00
RR
35public:
36 // construction/destruction
6463b9f5 37 wxToolBar() { Init(); }
3216dbf5
VZ
38 wxToolBar(wxWindow *parent,
39 wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
6463b9f5
JS
43 const wxString& name = wxToolBarNameStr)
44 {
45 Init();
46
47 Create(parent, id, pos, size, style, name);
48 }
c08a4f00
RR
49
50 bool Create( wxWindow *parent,
51 wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = 0,
55 const wxString& name = wxToolBarNameStr );
9467bdb7 56
3216dbf5 57 virtual ~wxToolBar();
c08a4f00
RR
58
59 virtual bool Realize();
60
370efbe7
WS
61 virtual void SetWindowStyleFlag( long style );
62
c08a4f00
RR
63 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
64
65 virtual void SetToolShortHelp(int id, const wxString& helpString);
66
34d26f42
RR
67 virtual void SetMargins(int x, int y);
68 void SetMargins(const wxSize& size)
69 { SetMargins((int) size.x, (int) size.y); }
6f02a879
VZ
70
71 virtual bool PerformAction(const wxControlAction& action,
72 long numArg = -1,
73 const wxString& strArg = wxEmptyString);
9467bdb7
VZ
74 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
75 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
76 {
77 return GetStdInputHandler(handlerDef);
78 }
79
c08a4f00
RR
80protected:
81 // common part of all ctors
82 void Init();
83
84 // implement base class pure virtuals
85 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
86 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
87
88 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
89 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
90 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
91
92 virtual wxToolBarToolBase *CreateTool(int id,
d448aec3
VZ
93 const wxString& label,
94 const wxBitmap& bmpNormal,
95 const wxBitmap& bmpDisabled,
96 wxItemKind kind,
c08a4f00 97 wxObject *clientData,
d448aec3
VZ
98 const wxString& shortHelp,
99 const wxString& longHelp);
cdb11cb9
VZ
100 virtual wxToolBarToolBase *CreateTool(wxControl *control,
101 const wxString& label);
16c9a425 102
3216dbf5 103 virtual wxSize DoGetBestClientSize() const;
dda4f6c0
JS
104 virtual void DoSetSize(int x, int y,
105 int width, int height,
106 int sizeFlags = wxSIZE_AUTO);
3216dbf5
VZ
107 virtual void DoDraw(wxControlRenderer *renderer);
108
109 // get the bounding rect for the given tool
110 wxRect GetToolRect(wxToolBarToolBase *tool) const;
111
112 // redraw the given tool
113 void RefreshTool(wxToolBarToolBase *tool);
114
115 // (re)calculate the tool positions, should only be called if it is
a290fa5a 116 // necessary to do it, i.e. m_needsLayout == true
3216dbf5 117 void DoLayout();
9467bdb7 118
3216dbf5
VZ
119 // get the rect limits depending on the orientation: top/bottom for a
120 // vertical toolbar, left/right for a horizontal one
121 void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const;
122
c08a4f00 123private:
3216dbf5
VZ
124 // have we calculated the positions of our tools?
125 bool m_needsLayout;
126
127 // the width of a separator
128 wxCoord m_widthSeparator;
129
130 // the total size of all toolbar elements
131 wxCoord m_maxWidth,
132 m_maxHeight;
3216dbf5 133
34d26f42 134private:
3216dbf5
VZ
135 DECLARE_DYNAMIC_CLASS(wxToolBar)
136};
137
c08a4f00 138#endif // _WX_UNIV_TOOLBAR_H_