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