]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/toolbar.h
This form of the event cloning patch survived my
[wxWidgets.git] / include / wx / os2 / toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: toolbar.h
3 // Purpose: wxToolBar class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/17/98
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TOOLBAR_H_
13 #define _WX_TOOLBAR_H_
14
15 #if wxUSE_TOOLBAR
16 #include "wx/tbarbase.h"
17
18 WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
19
20 class WXDLLEXPORT wxToolBar: public wxToolBarBase
21 {
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);
78
79 protected:
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
103 virtual MRESULT OS2WindowProc( WXUINT ulMsg
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)
117 };
118
119 #endif // wxUSE_TOOLBAR
120
121 #endif
122 // _WX_TOOLBAR_H_