]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/toolbar.h
signned/unsigned fix
[wxWidgets.git] / include / wx / os2 / toolbar.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: toolbar.h
3// Purpose: wxToolBar class
d90895ac 4// Author: David Webster
0e320a79 5// Modified by:
d90895ac 6// Created: 10/17/98
0e320a79 7// RCS-ID: $Id$
d90895ac
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TOOLBAR_H_
13#define _WX_TOOLBAR_H_
14
d90895ac 15#if wxUSE_TOOLBAR
0e320a79
DW
16#include "wx/tbarbase.h"
17
6c0fdfbb
DW
18#define ID_TOOLTIMER 100
19#define ID_TOOLEXPTIMER 101
20
0e320a79
DW
21class WXDLLEXPORT wxToolBar: public wxToolBarBase
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
d697657f 37 ,long lStyle = wxNO_BORDER | 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
d697657f 57 ,long lStyle = wxNO_BORDER | 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
DW
166 );
167 virtual wxToolBarToolBase* CreateTool(wxControl* pControl);
168
d697657f
DW
169 //
170 // Helpers
171 //
172 void DrawTool(wxToolBarToolBase *tool);
173 virtual void DrawTool( wxDC& rDC
174 ,wxToolBarToolBase* pTool
175 );
176 virtual void SpringUpButton(int nIndex);
177
178 int m_nCurrentRowsOrColumns;
179 int m_nPressedTool;
180 int m_nCurrentTool;
181 wxCoord m_vLastX;
182 wxCoord m_vLastY;
183 wxCoord m_vMaxWidth;
184 wxCoord m_vMaxHeight;
185 wxCoord m_vXPos;
186 wxCoord m_vYPos;
187 wxCoord m_vTextX;
188 wxCoord m_vTextY;
97fdfcc9 189
d697657f
DW
190private:
191 void LowerTool( wxToolBarToolBase* pTool
192 ,bool bLower = TRUE
193 );
194 void RaiseTool( wxToolBarToolBase* pTool
195 ,bool bRaise = TRUE
196 );
6c0fdfbb 197 void OnTimer(wxTimerEvent& rEvent);
97fdfcc9 198
d697657f 199 static bool m_bInitialized;
97fdfcc9 200
6c0fdfbb
DW
201 wxTimer m_vToolTimer;
202 wxTimer m_vToolExpTimer;
05facebb
DW
203 wxToolTip* m_pToolTip;
204 wxCoord m_vXMouse;
205 wxCoord m_vYMouse;
6c0fdfbb 206
97fdfcc9
DW
207 DECLARE_EVENT_TABLE()
208 DECLARE_DYNAMIC_CLASS(wxToolBar)
0e320a79
DW
209};
210
d90895ac
DW
211#endif // wxUSE_TOOLBAR
212
0e320a79
DW
213#endif
214 // _WX_TOOLBAR_H_