]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/generic/buttonbar.h | |
3 | // Purpose: wxButtonToolBar declaration | |
4 | // Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech | |
5 | // Modified by: | |
6 | // Created: 2006-04-13 | |
7 | // Id: $Id$ | |
8 | // Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, | |
9 | // SciTech Software, Inc. | |
10 | // Licence: wxWindows licence | |
11 | /////////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_BUTTONBAR_H_ | |
14 | #define _WX_BUTTONBAR_H_ | |
15 | ||
16 | #include "wx/bmpbuttn.h" | |
17 | #include "wx/toolbar.h" | |
18 | ||
19 | class WXDLLIMPEXP_FWD_CORE wxButtonToolBarTool; | |
20 | ||
21 | // ---------------------------------------------------------------------------- | |
22 | // wxButtonToolBar | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLIMPEXP_CORE wxButtonToolBar : public wxToolBarBase | |
26 | { | |
27 | public: | |
28 | // construction/destruction | |
29 | wxButtonToolBar() { Init(); } | |
30 | wxButtonToolBar(wxWindow *parent, | |
31 | wxWindowID id, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | long style = 0, | |
35 | const wxString& name = wxToolBarNameStr) | |
36 | { | |
37 | Init(); | |
38 | ||
39 | Create(parent, id, pos, size, style, name); | |
40 | } | |
41 | ||
42 | bool Create( wxWindow *parent, | |
43 | wxWindowID id, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = 0, | |
47 | const wxString& name = wxToolBarNameStr ); | |
48 | ||
49 | virtual ~wxButtonToolBar(); | |
50 | ||
51 | virtual bool Realize(); | |
52 | ||
53 | virtual void SetToolShortHelp(int id, const wxString& helpString); | |
54 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
55 | ||
56 | protected: | |
57 | // common part of all ctors | |
58 | void Init(); | |
59 | ||
60 | // implement base class pure virtuals | |
61 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
62 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
63 | ||
64 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
65 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
66 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
67 | ||
68 | virtual wxToolBarToolBase *CreateTool(int id, | |
69 | const wxString& label, | |
70 | const wxBitmap& bmpNormal, | |
71 | const wxBitmap& bmpDisabled, | |
72 | wxItemKind kind, | |
73 | wxObject *clientData, | |
74 | const wxString& shortHelp, | |
75 | const wxString& longHelp); | |
76 | virtual wxToolBarToolBase *CreateTool(wxControl *control, | |
77 | const wxString& label); | |
78 | ||
79 | virtual wxSize DoGetBestClientSize() const; | |
80 | ||
81 | // calculate layout | |
82 | void DoLayout(); | |
83 | ||
84 | // get the bounding rect for the given tool | |
85 | wxRect GetToolRect(wxToolBarToolBase *tool) const; | |
86 | ||
87 | // get the rect limits depending on the orientation: top/bottom for a | |
88 | // vertical toolbar, left/right for a horizontal one | |
89 | void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; | |
90 | ||
91 | // receives button commands | |
92 | void OnCommand(wxCommandEvent& event); | |
93 | ||
94 | // paints a border | |
95 | void OnPaint(wxPaintEvent& event); | |
96 | ||
97 | // detects mouse clicks outside buttons | |
98 | void OnLeftUp(wxMouseEvent& event); | |
99 | ||
100 | private: | |
101 | // have we calculated the positions of our tools? | |
102 | bool m_needsLayout; | |
103 | ||
104 | // the width of a separator | |
105 | wxCoord m_widthSeparator; | |
106 | ||
107 | // the total size of all toolbar elements | |
108 | wxCoord m_maxWidth, | |
109 | m_maxHeight; | |
110 | ||
111 | // the height of a label | |
112 | int m_labelHeight; | |
113 | ||
114 | // the space above the label | |
115 | int m_labelMargin; | |
116 | ||
117 | private: | |
118 | DECLARE_DYNAMIC_CLASS(wxButtonToolBar) | |
119 | DECLARE_EVENT_TABLE() | |
120 | }; | |
121 | ||
122 | #endif | |
123 | // _WX_BUTTONBAR_H_ | |
124 |