]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: toolbar.h | |
3 | // Purpose: wxToolBar class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TOOLBAR_H_ | |
13 | #define _WX_TOOLBAR_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "toolbar.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/tbarbase.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; | |
22 | ||
23 | class WXDLLEXPORT wxToolBar: public wxToolBarBase | |
24 | { | |
25 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
26 | public: | |
27 | /* | |
28 | * Public interface | |
29 | */ | |
30 | ||
31 | wxToolBar(); | |
32 | ||
33 | inline wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
34 | long style = wxNO_BORDER|wxTB_HORIZONTAL, | |
0d57be45 JS |
35 | const wxString& name = wxToolBarNameStr): |
36 | m_widgets(wxKEY_INTEGER) | |
37 | ||
9b6dbb09 JS |
38 | { |
39 | Create(parent, id, pos, size, style, name); | |
40 | } | |
41 | ~wxToolBar(); | |
42 | ||
43 | bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
44 | long style = wxNO_BORDER|wxTB_HORIZONTAL, | |
45 | const wxString& name = wxToolBarNameStr); | |
46 | ||
47 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
48 | // created and used as the pushed/toggled image. | |
49 | // If toggle is TRUE, the button toggles between the two states. | |
50 | wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, | |
51 | bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL, | |
52 | const wxString& helpString1 = "", const wxString& helpString2 = ""); | |
53 | ||
54 | // Set default bitmap size | |
55 | void SetToolBitmapSize(const wxSize& size); | |
56 | void EnableTool(int toolIndex, bool enable); // additional drawing on enabling | |
57 | void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on | |
58 | void ClearTools(); | |
59 | ||
60 | // The button size is bigger than the bitmap size | |
61 | wxSize GetToolSize() const; | |
62 | ||
63 | wxSize GetMaxSize() const; | |
64 | ||
65 | // Add all the buttons | |
66 | virtual bool CreateTools(); | |
67 | virtual void Layout() {} | |
68 | ||
69 | // The post-tool-addition call. TODO: do here whatever's | |
70 | // necessary for completing the toolbar construction. | |
71 | bool Realize() { return CreateTools(); }; | |
72 | ||
1a3ac83f JS |
73 | // Implementation |
74 | void DestroyPixmaps(); | |
75 | int FindIndexForWidget(WXWidget w); | |
76 | WXWidget FindWidgetForIndex(int index); | |
77 | ||
7fe7d506 JS |
78 | WXWidget GetTopWidget() const; |
79 | WXWidget GetClientWidget() const; | |
80 | WXWidget GetMainWidget() const; | |
81 | ||
9b6dbb09 | 82 | protected: |
0d57be45 JS |
83 | // List of widgets in the toolbar, indexed by tool index |
84 | wxList m_widgets; | |
9b6dbb09 | 85 | |
1a3ac83f JS |
86 | // List of pixmaps to destroy when tools are recreated or |
87 | // or toolbar is destroyed. | |
88 | wxList m_pixmaps; | |
89 | ||
9b6dbb09 JS |
90 | DECLARE_EVENT_TABLE() |
91 | }; | |
92 | ||
93 | #endif | |
94 | // _WX_TOOLBAR_H_ |