]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
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_
16 #include "wx/tbarbase.h"
18 #define ID_TOOLTIMER 100
19 #define ID_TOOLEXPTIMER 101
21 class WXDLLEXPORT 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
= wxNO_BORDER
| 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
= wxNO_BORDER
| 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
);
172 void DrawTool(wxToolBarToolBase
*tool
);
173 virtual void DrawTool( wxDC
& rDC
174 ,wxToolBarToolBase
* pTool
176 virtual void SpringUpButton(int nIndex
);
178 int m_nCurrentRowsOrColumns
;
184 wxCoord m_vMaxHeight
;
191 void LowerTool( wxToolBarToolBase
* pTool
194 void RaiseTool( wxToolBarToolBase
* pTool
197 void OnTimer(wxTimerEvent
& rEvent
);
199 static bool m_bInitialized
;
201 wxTimer m_vToolTimer
;
202 wxTimer m_vToolExpTimer
;
203 wxToolTip
* m_pToolTip
;
207 DECLARE_EVENT_TABLE()
208 DECLARE_DYNAMIC_CLASS(wxToolBar
)
211 #endif // wxUSE_TOOLBAR