]>
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 | ||
0e320a79 DW |
18 | class WXDLLEXPORT wxToolBar: public wxToolBarBase |
19 | { | |
97fdfcc9 DW |
20 | public: |
21 | /* | |
22 | * Public interface | |
23 | */ | |
24 | ||
25 | wxToolBar() { Init(); } | |
26 | ||
27 | inline wxToolBar( wxWindow* pParent | |
28 | ,wxWindowID vId | |
29 | ,const wxPoint& rPos = wxDefaultPosition | |
30 | ,const wxSize& rSize = wxDefaultSize | |
31 | ,long lStyle = wxNO_BORDER|wxTB_HORIZONTAL | |
32 | ,const wxString& rName = wxToolBarNameStr | |
33 | ) | |
34 | { | |
35 | Create( pParent | |
36 | ,vId | |
37 | ,rPos | |
38 | ,rSize | |
39 | ,lStyle | |
40 | ,rName | |
41 | ); | |
42 | } | |
43 | bool Create( wxWindow* pParent | |
44 | ,wxWindowID vId | |
45 | ,const wxPoint& rPos = wxDefaultPosition | |
46 | ,const wxSize& rSize = wxDefaultSize | |
47 | ,long lStyle = wxNO_BORDER|wxTB_HORIZONTAL | |
48 | ,const wxString& rName = wxToolBarNameStr | |
49 | ); | |
50 | ||
51 | virtual ~wxToolBar(); | |
52 | ||
53 | // override/implement base class virtuals | |
54 | virtual wxToolBarToolBase* FindToolForPosition( wxCoord x | |
55 | ,wxCoord y | |
56 | ) const; | |
57 | ||
58 | // The post-tool-addition call | |
59 | virtual bool Realize(void); | |
60 | ||
61 | virtual void SetToolBitmapSize(const wxSize& rSize); | |
62 | virtual wxSize GetToolSize(void) const; | |
63 | ||
64 | virtual void SetRows(int nRows); | |
65 | ||
66 | // IMPLEMENTATION | |
67 | virtual bool OS2Command( WXUINT uParam | |
68 | ,WXWORD wId | |
69 | ); | |
70 | virtual bool OS2OnNotify( int nCtrl | |
71 | ,WXLPARAM lParam | |
72 | ,WXLPARAM* pResult | |
73 | ); | |
74 | void OnMouseEvent(wxMouseEvent& rEvent); | |
75 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); | |
d90895ac | 76 | |
0e320a79 | 77 | protected: |
97fdfcc9 DW |
78 | void Init(void); |
79 | // implement base class pure virtuals | |
80 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
81 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
82 | ||
83 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
84 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
85 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
86 | ||
87 | virtual wxToolBarToolBase* CreateTool( int vId | |
3437f881 DW |
88 | ,const wxString& rsLabel |
89 | ,const wxBitmap& rBitmapNormal | |
90 | ,const wxBitmap& rBitmapDisabled | |
91 | ,wxItemKind vKind | |
97fdfcc9 DW |
92 | ,wxObject* pClientData |
93 | ,const wxString& rShortHelpString | |
94 | ,const wxString& rLongHelpString | |
95 | ); | |
96 | virtual wxToolBarToolBase* CreateTool(wxControl* pControl); | |
97 | ||
98 | // should be called whenever the toolbar size changes | |
99 | void UpdateSize(void); | |
100 | ||
101 | // override WndProc to process WM_SIZE | |
a885d89a | 102 | virtual MRESULT OS2WindowProc( WXUINT ulMsg |
97fdfcc9 DW |
103 | ,WXWPARAM wParam |
104 | ,WXLPARAM lParam | |
105 | ); | |
106 | ||
107 | // the big bitmap containing all bitmaps of the toolbar buttons | |
108 | WXHBITMAP m_hBitmap; | |
109 | ||
110 | // the total number of toolbar elements | |
111 | size_t m_nButtons; | |
112 | ||
113 | private: | |
114 | DECLARE_EVENT_TABLE() | |
115 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
0e320a79 DW |
116 | }; |
117 | ||
d90895ac DW |
118 | #endif // wxUSE_TOOLBAR |
119 | ||
0e320a79 DW |
120 | #endif |
121 | // _WX_TOOLBAR_H_ |