]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/toolbar.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / os2 / toolbar.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/os2/toolbar.h
0e320a79 3// Purpose: wxToolBar class
d90895ac 4// Author: David Webster
0e320a79 5// Modified by:
d90895ac 6// Created: 10/17/98
d90895ac 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
0e320a79
DW
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_TOOLBAR_H_
12#define _WX_TOOLBAR_H_
13
d90895ac 14#if wxUSE_TOOLBAR
063807f6 15#include "wx/timer.h"
0e320a79
DW
16#include "wx/tbarbase.h"
17
6c0fdfbb
DW
18#define ID_TOOLTIMER 100
19#define ID_TOOLEXPTIMER 101
20
53a2db12 21class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase
0e320a79 22{
97fdfcc9
DW
23public:
24 /*
25 * Public interface
26 */
27
6c0fdfbb
DW
28 wxToolBar()
29 : m_vToolTimer(this, ID_TOOLTIMER)
30 , m_vToolExpTimer(this, ID_TOOLEXPTIMER)
31 { Init(); }
97fdfcc9
DW
32
33 inline wxToolBar( wxWindow* pParent
34 ,wxWindowID vId
35 ,const wxPoint& rPos = wxDefaultPosition
36 ,const wxSize& rSize = wxDefaultSize
f75b1bd3 37 ,long lStyle = wxTB_HORIZONTAL
97fdfcc9 38 ,const wxString& rName = wxToolBarNameStr
6c0fdfbb
DW
39 ) : m_vToolTimer(this, ID_TOOLTIMER)
40 , m_vToolExpTimer(this, ID_TOOLEXPTIMER)
97fdfcc9 41 {
d697657f 42 Init();
97fdfcc9
DW
43 Create( pParent
44 ,vId
45 ,rPos
46 ,rSize
47 ,lStyle
48 ,rName
49 );
50 }
d697657f
DW
51 virtual ~wxToolBar();
52
97fdfcc9
DW
53 bool Create( wxWindow* pParent
54 ,wxWindowID vId
55 ,const wxPoint& rPos = wxDefaultPosition
56 ,const wxSize& rSize = wxDefaultSize
f75b1bd3 57 ,long lStyle = wxTB_HORIZONTAL
97fdfcc9
DW
58 ,const wxString& rName = wxToolBarNameStr
59 );
60
97fdfcc9 61
d697657f
DW
62 //
63 // Override/implement base class virtuals
64 //
65 virtual wxToolBarToolBase* FindToolForPosition( wxCoord vX
66 ,wxCoord vY
97fdfcc9 67 ) const;
d697657f
DW
68 virtual bool Realize(void);
69 virtual void SetRows(int nRows);
97fdfcc9 70
b6f4144e
DW
71 //
72 // Special overrides for OS/2
73 //
74 virtual wxToolBarToolBase* InsertControl( size_t nPos
75 ,wxControl* pControl
76 );
77 virtual wxToolBarToolBase* InsertSeparator(size_t nPos);
78 virtual wxToolBarToolBase* InsertTool( size_t nPos
79 ,int nId
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
87 );
88 wxToolBarToolBase* InsertTool( size_t nPos
89 ,int nId
90 ,const wxBitmap& rBitmap
91 ,const wxBitmap& rBmpDisabled = wxNullBitmap
92 ,bool bToggle = FALSE
93 ,wxObject* pClientData = NULL
94 ,const wxString& rsShortHelp = wxEmptyString
95 ,const wxString& rsLongHelp = wxEmptyString
96 )
97 {
98 return InsertTool( nPos
99 ,nId
100 ,wxEmptyString
101 ,rBitmap
102 ,rBmpDisabled
103 ,bToggle ? wxITEM_CHECK : wxITEM_NORMAL
104 ,rsShortHelp
105 ,rsLongHelp
106 ,pClientData
107 );
108 }
109 virtual bool DeleteTool(int nId);
110 virtual bool DeleteToolByPos(size_t nPos);
111
d697657f
DW
112 //
113 // Event handlers
114 //
115 void OnPaint(wxPaintEvent& event);
116 void OnSize(wxSizeEvent& event);
117 void OnMouseEvent(wxMouseEvent& event);
118 void OnKillFocus(wxFocusEvent& event);
d90895ac 119
0e320a79 120protected:
d697657f
DW
121 //
122 // Common part of all ctors
123 //
124 void Init();
125
126 //
127 // Implement base class pure virtuals
128 //
129 virtual wxToolBarToolBase* DoAddTool( int id
130 ,const wxString& label
131 ,const wxBitmap& bitmap
132 ,const wxBitmap& bmpDisabled
133 ,wxItemKind kind
134 ,const wxString& shortHelp = wxEmptyString
135 ,const wxString& longHelp = wxEmptyString
136 ,wxObject *clientData = NULL
137 ,wxCoord xPos = -1
138 ,wxCoord yPos = -1
139 );
140
141 virtual bool DoInsertTool( size_t nPos
142 ,wxToolBarToolBase* pTool
143 );
144 virtual bool DoDeleteTool( size_t nPos
145 , wxToolBarToolBase* pTool
146 );
147
148 virtual void DoEnableTool( wxToolBarToolBase* pTool
149 ,bool bEnable
150 );
151 virtual void DoToggleTool( wxToolBarToolBase* pTool
152 ,bool bToggle
153 );
154 virtual void DoSetToggle( wxToolBarToolBase* pTool
155 ,bool bToggle
156 );
97fdfcc9
DW
157
158 virtual wxToolBarToolBase* CreateTool( int vId
3437f881 159 ,const wxString& rsLabel
d697657f
DW
160 ,const wxBitmap& rBmpNormal
161 ,const wxBitmap& rBmpDisabled
162 ,wxItemKind eKind
97fdfcc9 163 ,wxObject* pClientData
d697657f
DW
164 ,const wxString& rsShortHelp
165 ,const wxString& rsLongHelp
97fdfcc9 166 );
07d02e9e
VZ
167 virtual wxToolBarToolBase* CreateTool(wxControl* pControl,
168 const wxString& label);
97fdfcc9 169
d697657f
DW
170 //
171 // Helpers
172 //
173 void DrawTool(wxToolBarToolBase *tool);
174 virtual void DrawTool( wxDC& rDC
175 ,wxToolBarToolBase* pTool
176 );
177 virtual void SpringUpButton(int nIndex);
178
179 int m_nCurrentRowsOrColumns;
180 int m_nPressedTool;
181 int m_nCurrentTool;
182 wxCoord m_vLastX;
183 wxCoord m_vLastY;
184 wxCoord m_vMaxWidth;
185 wxCoord m_vMaxHeight;
186 wxCoord m_vXPos;
187 wxCoord m_vYPos;
188 wxCoord m_vTextX;
189 wxCoord m_vTextY;
97fdfcc9 190
d697657f
DW
191private:
192 void LowerTool( wxToolBarToolBase* pTool
193 ,bool bLower = TRUE
194 );
195 void RaiseTool( wxToolBarToolBase* pTool
196 ,bool bRaise = TRUE
197 );
6c0fdfbb 198 void OnTimer(wxTimerEvent& rEvent);
97fdfcc9 199
d697657f 200 static bool m_bInitialized;
97fdfcc9 201
6c0fdfbb
DW
202 wxTimer m_vToolTimer;
203 wxTimer m_vToolExpTimer;
05facebb
DW
204 wxToolTip* m_pToolTip;
205 wxCoord m_vXMouse;
206 wxCoord m_vYMouse;
6c0fdfbb 207
4f5c180e
DW
208 //
209 // Virtual function hiding supression
210 virtual wxToolBarToolBase *InsertTool (size_t nPos, wxToolBarToolBase* pTool)
211 {
212 return( wxToolBarBase::InsertTool( nPos
213 ,pTool
214 ));
215 }
216
97fdfcc9
DW
217 DECLARE_EVENT_TABLE()
218 DECLARE_DYNAMIC_CLASS(wxToolBar)
0e320a79
DW
219};
220
d90895ac
DW
221#endif // wxUSE_TOOLBAR
222
0e320a79
DW
223#endif
224 // _WX_TOOLBAR_H_