]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/toolbar.h
wxSizeEvent now carries the total size, not just the client size
[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 class WXDLLEXPORT wxToolBar: public wxToolBarBase
19 {
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);
76
77 protected:
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 wxString& rsLabel
89 ,const wxBitmap& rBitmapNormal
90 ,const wxBitmap& rBitmapDisabled
91 ,wxItemKind vKind
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
102 virtual MRESULT OS2WindowProc( WXUINT ulMsg
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)
116 };
117
118 #endif // wxUSE_TOOLBAR
119
120 #endif
121 // _WX_TOOLBAR_H_