]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: toolbar.h | |
3 | // Purpose: wxToolBar class | |
d90895ac | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
d90895ac | 6 | // Created: 10/17/98 |
0e320a79 | 7 | // RCS-ID: $Id$ |
d90895ac DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_TOOLBAR_H_ | |
13 | #define _WX_TOOLBAR_H_ | |
14 | ||
d90895ac | 15 | #if wxUSE_TOOLBAR |
0e320a79 DW |
16 | #include "wx/tbarbase.h" |
17 | ||
d90895ac | 18 | WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; |
0e320a79 DW |
19 | |
20 | class WXDLLEXPORT wxToolBar: public wxToolBarBase | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
23 | public: | |
24 | /* | |
25 | * Public interface | |
26 | */ | |
27 | ||
28 | wxToolBar(); | |
29 | ||
30 | inline wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
31 | long style = wxNO_BORDER|wxTB_HORIZONTAL, | |
32 | const wxString& name = wxToolBarNameStr) | |
33 | { | |
34 | Create(parent, id, pos, size, style, name); | |
35 | } | |
36 | ~wxToolBar(); | |
37 | ||
38 | bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
39 | long style = wxNO_BORDER|wxTB_HORIZONTAL, | |
40 | const wxString& name = wxToolBarNameStr); | |
41 | ||
d90895ac DW |
42 | // Call default behaviour |
43 | void OnMouseEvent(wxMouseEvent& event); | |
44 | ||
0e320a79 DW |
45 | // If pushedBitmap is NULL, a reversed version of bitmap is |
46 | // created and used as the pushed/toggled image. | |
47 | // If toggle is TRUE, the button toggles between the two states. | |
48 | wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, | |
49 | bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL, | |
50 | const wxString& helpString1 = "", const wxString& helpString2 = ""); | |
776d87d5 DW |
51 | //Virtual function hiding suppression |
52 | inline wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, | |
53 | bool toggle = FALSE, wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = NULL, | |
54 | const wxString& helpString1 = "", const wxString& helpString2 = "") | |
55 | { return(AddTool(toolIndex, bitmap, pushedBitmap, toggle, (long)xPos, (long)yPos, clientData, helpString1, helpString2)); } | |
0e320a79 DW |
56 | |
57 | // Set default bitmap size | |
58 | void SetToolBitmapSize(const wxSize& size); | |
59 | void EnableTool(int toolIndex, bool enable); // additional drawing on enabling | |
60 | void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on | |
61 | void ClearTools(); | |
62 | ||
63 | // The button size is bigger than the bitmap size | |
64 | wxSize GetToolSize() const; | |
65 | ||
66 | wxSize GetMaxSize() const; | |
67 | ||
d90895ac DW |
68 | virtual bool GetToolState(int toolIndex) const; |
69 | ||
0e320a79 DW |
70 | // Add all the buttons |
71 | virtual bool CreateTools(); | |
d90895ac DW |
72 | virtual void SetRows(int nRows); |
73 | virtual void LayoutButtons() {} | |
0e320a79 | 74 | |
d90895ac | 75 | // The post-tool-addition call |
0e320a79 DW |
76 | bool Realize() { return CreateTools(); }; |
77 | ||
d90895ac DW |
78 | // IMPLEMENTATION |
79 | virtual bool OS2Command(WXUINT param, WXWORD id); | |
80 | virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); | |
81 | ||
82 | // Responds to colour changes | |
83 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
84 | ||
0e320a79 | 85 | protected: |
d90895ac | 86 | WXHBITMAP m_hBitmap; |
0e320a79 DW |
87 | |
88 | DECLARE_EVENT_TABLE() | |
89 | }; | |
90 | ||
d90895ac DW |
91 | #endif // wxUSE_TOOLBAR |
92 | ||
0e320a79 DW |
93 | #endif |
94 | // _WX_TOOLBAR_H_ |