]>
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 | |
88 | ,const wxBitmap& rBitmap1 | |
89 | ,const wxBitmap& rBitmap2 | |
90 | ,bool bToggle | |
91 | ,wxObject* pClientData | |
92 | ,const wxString& rShortHelpString | |
93 | ,const wxString& rLongHelpString | |
94 | ); | |
95 | virtual wxToolBarToolBase* CreateTool(wxControl* pControl); | |
96 | ||
97 | // should be called whenever the toolbar size changes | |
98 | void UpdateSize(void); | |
99 | ||
100 | // override WndProc to process WM_SIZE | |
a885d89a | 101 | virtual MRESULT OS2WindowProc( WXUINT ulMsg |
97fdfcc9 DW |
102 | ,WXWPARAM wParam |
103 | ,WXLPARAM lParam | |
104 | ); | |
105 | ||
106 | // the big bitmap containing all bitmaps of the toolbar buttons | |
107 | WXHBITMAP m_hBitmap; | |
108 | ||
109 | // the total number of toolbar elements | |
110 | size_t m_nButtons; | |
111 | ||
112 | private: | |
113 | DECLARE_EVENT_TABLE() | |
114 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
0e320a79 DW |
115 | }; |
116 | ||
d90895ac DW |
117 | #endif // wxUSE_TOOLBAR |
118 | ||
0e320a79 DW |
119 | #endif |
120 | // _WX_TOOLBAR_H_ |