1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/toolbar.h
3 // Purpose: wxToolBar class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TOOLBAR_H_
13 #define _WX_TOOLBAR_H_
17 #include "wx/tbarbase.h"
19 #define ID_TOOLTIMER 100
20 #define ID_TOOLEXPTIMER 101
22 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
30 : m_vToolTimer(this, ID_TOOLTIMER
)
31 , m_vToolExpTimer(this, ID_TOOLEXPTIMER
)
34 inline wxToolBar( wxWindow
* pParent
36 ,const wxPoint
& rPos
= wxDefaultPosition
37 ,const wxSize
& rSize
= wxDefaultSize
38 ,long lStyle
= wxTB_HORIZONTAL
39 ,const wxString
& rName
= wxToolBarNameStr
40 ) : m_vToolTimer(this, ID_TOOLTIMER
)
41 , m_vToolExpTimer(this, ID_TOOLEXPTIMER
)
54 bool Create( wxWindow
* pParent
56 ,const wxPoint
& rPos
= wxDefaultPosition
57 ,const wxSize
& rSize
= wxDefaultSize
58 ,long lStyle
= wxTB_HORIZONTAL
59 ,const wxString
& rName
= wxToolBarNameStr
64 // Override/implement base class virtuals
66 virtual wxToolBarToolBase
* FindToolForPosition( wxCoord vX
69 virtual bool Realize(void);
70 virtual void SetRows(int nRows
);
73 // Special overrides for OS/2
75 virtual wxToolBarToolBase
* InsertControl( size_t nPos
78 virtual wxToolBarToolBase
* InsertSeparator(size_t nPos
);
79 virtual wxToolBarToolBase
* InsertTool( size_t nPos
81 ,const wxString
& rsLabel
82 ,const wxBitmap
& rBitmap
83 ,const wxBitmap
& rBmpDisabled
= wxNullBitmap
84 ,wxItemKind eKind
= wxITEM_NORMAL
85 ,const wxString
& rsShortHelp
= wxEmptyString
86 ,const wxString
& rsLongHelp
= wxEmptyString
87 ,wxObject
* pClientData
= NULL
89 wxToolBarToolBase
* InsertTool( size_t nPos
91 ,const wxBitmap
& rBitmap
92 ,const wxBitmap
& rBmpDisabled
= wxNullBitmap
94 ,wxObject
* pClientData
= NULL
95 ,const wxString
& rsShortHelp
= wxEmptyString
96 ,const wxString
& rsLongHelp
= wxEmptyString
99 return InsertTool( nPos
104 ,bToggle
? wxITEM_CHECK
: wxITEM_NORMAL
110 virtual bool DeleteTool(int nId
);
111 virtual bool DeleteToolByPos(size_t nPos
);
116 void OnPaint(wxPaintEvent
& event
);
117 void OnSize(wxSizeEvent
& event
);
118 void OnMouseEvent(wxMouseEvent
& event
);
119 void OnKillFocus(wxFocusEvent
& event
);
123 // Common part of all ctors
128 // Implement base class pure virtuals
130 virtual wxToolBarToolBase
* DoAddTool( int id
131 ,const wxString
& label
132 ,const wxBitmap
& bitmap
133 ,const wxBitmap
& bmpDisabled
135 ,const wxString
& shortHelp
= wxEmptyString
136 ,const wxString
& longHelp
= wxEmptyString
137 ,wxObject
*clientData
= NULL
142 virtual bool DoInsertTool( size_t nPos
143 ,wxToolBarToolBase
* pTool
145 virtual bool DoDeleteTool( size_t nPos
146 , wxToolBarToolBase
* pTool
149 virtual void DoEnableTool( wxToolBarToolBase
* pTool
152 virtual void DoToggleTool( wxToolBarToolBase
* pTool
155 virtual void DoSetToggle( wxToolBarToolBase
* pTool
159 virtual wxToolBarToolBase
* CreateTool( int vId
160 ,const wxString
& rsLabel
161 ,const wxBitmap
& rBmpNormal
162 ,const wxBitmap
& rBmpDisabled
164 ,wxObject
* pClientData
165 ,const wxString
& rsShortHelp
166 ,const wxString
& rsLongHelp
168 virtual wxToolBarToolBase
* CreateTool(wxControl
* pControl
,
169 const wxString
& label
);
174 void DrawTool(wxToolBarToolBase
*tool
);
175 virtual void DrawTool( wxDC
& rDC
176 ,wxToolBarToolBase
* pTool
178 virtual void SpringUpButton(int nIndex
);
180 int m_nCurrentRowsOrColumns
;
186 wxCoord m_vMaxHeight
;
193 void LowerTool( wxToolBarToolBase
* pTool
196 void RaiseTool( wxToolBarToolBase
* pTool
199 void OnTimer(wxTimerEvent
& rEvent
);
201 static bool m_bInitialized
;
203 wxTimer m_vToolTimer
;
204 wxTimer m_vToolExpTimer
;
205 wxToolTip
* m_pToolTip
;
210 // Virtual function hiding supression
211 virtual wxToolBarToolBase
*InsertTool (size_t nPos
, wxToolBarToolBase
* pTool
)
213 return( wxToolBarBase::InsertTool( nPos
218 DECLARE_EVENT_TABLE()
219 DECLARE_DYNAMIC_CLASS(wxToolBar
)
222 #endif // wxUSE_TOOLBAR