1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/toolbar.h
3 // Purpose: wxToolBar class
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TOOLBAR_H_
12 #define _WX_TOOLBAR_H_
16 #include "wx/tbarbase.h"
18 #define ID_TOOLTIMER 100
19 #define ID_TOOLEXPTIMER 101
21 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
29 : m_vToolTimer(this, ID_TOOLTIMER
)
30 , m_vToolExpTimer(this, ID_TOOLEXPTIMER
)
33 inline wxToolBar( wxWindow
* pParent
35 ,const wxPoint
& rPos
= wxDefaultPosition
36 ,const wxSize
& rSize
= wxDefaultSize
37 ,long lStyle
= wxTB_HORIZONTAL
38 ,const wxString
& rName
= wxToolBarNameStr
39 ) : m_vToolTimer(this, ID_TOOLTIMER
)
40 , m_vToolExpTimer(this, ID_TOOLEXPTIMER
)
53 bool Create( wxWindow
* pParent
55 ,const wxPoint
& rPos
= wxDefaultPosition
56 ,const wxSize
& rSize
= wxDefaultSize
57 ,long lStyle
= wxTB_HORIZONTAL
58 ,const wxString
& rName
= wxToolBarNameStr
63 // Override/implement base class virtuals
65 virtual wxToolBarToolBase
* FindToolForPosition( wxCoord vX
68 virtual bool Realize(void);
69 virtual void SetRows(int nRows
);
72 // Special overrides for OS/2
74 virtual wxToolBarToolBase
* InsertControl( size_t nPos
77 virtual wxToolBarToolBase
* InsertSeparator(size_t nPos
);
78 virtual wxToolBarToolBase
* InsertTool( size_t nPos
80 ,const wxString
& rsLabel
81 ,const wxBitmap
& rBitmap
82 ,const wxBitmap
& rBmpDisabled
= wxNullBitmap
83 ,wxItemKind eKind
= wxITEM_NORMAL
84 ,const wxString
& rsShortHelp
= wxEmptyString
85 ,const wxString
& rsLongHelp
= wxEmptyString
86 ,wxObject
* pClientData
= NULL
88 wxToolBarToolBase
* InsertTool( size_t nPos
90 ,const wxBitmap
& rBitmap
91 ,const wxBitmap
& rBmpDisabled
= wxNullBitmap
93 ,wxObject
* pClientData
= NULL
94 ,const wxString
& rsShortHelp
= wxEmptyString
95 ,const wxString
& rsLongHelp
= wxEmptyString
98 return InsertTool( nPos
103 ,bToggle
? wxITEM_CHECK
: wxITEM_NORMAL
109 virtual bool DeleteTool(int nId
);
110 virtual bool DeleteToolByPos(size_t nPos
);
115 void OnPaint(wxPaintEvent
& event
);
116 void OnSize(wxSizeEvent
& event
);
117 void OnMouseEvent(wxMouseEvent
& event
);
118 void OnKillFocus(wxFocusEvent
& event
);
122 // Common part of all ctors
127 // Implement base class pure virtuals
129 virtual wxToolBarToolBase
* DoAddTool( int id
130 ,const wxString
& label
131 ,const wxBitmap
& bitmap
132 ,const wxBitmap
& bmpDisabled
134 ,const wxString
& shortHelp
= wxEmptyString
135 ,const wxString
& longHelp
= wxEmptyString
136 ,wxObject
*clientData
= NULL
141 virtual bool DoInsertTool( size_t nPos
142 ,wxToolBarToolBase
* pTool
144 virtual bool DoDeleteTool( size_t nPos
145 , wxToolBarToolBase
* pTool
148 virtual void DoEnableTool( wxToolBarToolBase
* pTool
151 virtual void DoToggleTool( wxToolBarToolBase
* pTool
154 virtual void DoSetToggle( wxToolBarToolBase
* pTool
158 virtual wxToolBarToolBase
* CreateTool( int vId
159 ,const wxString
& rsLabel
160 ,const wxBitmap
& rBmpNormal
161 ,const wxBitmap
& rBmpDisabled
163 ,wxObject
* pClientData
164 ,const wxString
& rsShortHelp
165 ,const wxString
& rsLongHelp
167 virtual wxToolBarToolBase
* CreateTool(wxControl
* pControl
,
168 const wxString
& label
);
173 void DrawTool(wxToolBarToolBase
*tool
);
174 virtual void DrawTool( wxDC
& rDC
175 ,wxToolBarToolBase
* pTool
177 virtual void SpringUpButton(int nIndex
);
179 int m_nCurrentRowsOrColumns
;
185 wxCoord m_vMaxHeight
;
192 void LowerTool( wxToolBarToolBase
* pTool
195 void RaiseTool( wxToolBarToolBase
* pTool
198 void OnTimer(wxTimerEvent
& rEvent
);
200 static bool m_bInitialized
;
202 wxTimer m_vToolTimer
;
203 wxTimer m_vToolExpTimer
;
204 wxToolTip
* m_pToolTip
;
209 // Virtual function hiding supression
210 virtual wxToolBarToolBase
*InsertTool (size_t nPos
, wxToolBarToolBase
* pTool
)
212 return( wxToolBarBase::InsertTool( nPos
217 DECLARE_EVENT_TABLE()
218 DECLARE_DYNAMIC_CLASS(wxToolBar
)
221 #endif // wxUSE_TOOLBAR