]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/toolbar.cpp
Consistent wxWindow::Enable with wxRadioBox::Enable for control and its items. wxRadi...
[wxWidgets.git] / src / palmos / toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/toolbar.cpp
3 // Purpose: wxToolBar
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "toolbar.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/frame.h"
33 #include "wx/log.h"
34 #include "wx/intl.h"
35 #include "wx/dynarray.h"
36 #include "wx/settings.h"
37 #include "wx/bitmap.h"
38 #include "wx/dcmemory.h"
39 #include "wx/control.h"
40 #endif
41
42 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
43
44 #include "wx/toolbar.h"
45 #include "wx/sysopt.h"
46
47 #include "wx/palmos/private.h"
48
49 #include "wx/palmos/wrapcctl.h"
50
51 #include "wx/app.h" // for GetComCtl32Version
52
53 // ----------------------------------------------------------------------------
54 // conditional compilation
55 // ----------------------------------------------------------------------------
56
57 // wxWidgets previously always considered that toolbar buttons have light grey
58 // (0xc0c0c0) background and so ignored any bitmap masks - however, this
59 // doesn't work with XPMs which then appear to have black background. To make
60 // this work, we must respect the bitmap masks - which we do now. This should
61 // be ok in any case, but to restore 100% compatible with the old version
62 // behaviour, you can set this to 0.
63 #define USE_BITMAP_MASKS 1
64
65 // ----------------------------------------------------------------------------
66 // constants
67 // ----------------------------------------------------------------------------
68
69 // ----------------------------------------------------------------------------
70 // wxWin macros
71 // ----------------------------------------------------------------------------
72
73 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
74
75 /*
76 TOOLBAR PROPERTIES
77 tool
78 bitmap
79 bitmap2
80 tooltip
81 longhelp
82 radio (bool)
83 toggle (bool)
84 separator
85 style ( wxNO_BORDER | wxTB_HORIZONTAL)
86 bitmapsize
87 margins
88 packing
89 separation
90
91 dontattachtoframe
92 */
93
94 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
95 EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
96 END_EVENT_TABLE()
97
98 // ----------------------------------------------------------------------------
99 // private classes
100 // ----------------------------------------------------------------------------
101
102 class wxToolBarTool : public wxToolBarToolBase
103 {
104 public:
105 wxToolBarTool(wxToolBar *tbar,
106 int id,
107 const wxString& label,
108 const wxBitmap& bmpNormal,
109 const wxBitmap& bmpDisabled,
110 wxItemKind kind,
111 wxObject *clientData,
112 const wxString& shortHelp,
113 const wxString& longHelp)
114 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
115 clientData, shortHelp, longHelp)
116 {
117 }
118
119 wxToolBarTool(wxToolBar *tbar, wxControl *control)
120 : wxToolBarToolBase(tbar, control)
121 {
122 }
123
124 virtual void SetLabel(const wxString& label)
125 {
126 }
127
128 // set/get the number of separators which we use to cover the space used by
129 // a control in the toolbar
130 void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
131 size_t GetSeparatorsCount() const { return m_nSepCount; }
132
133 private:
134 size_t m_nSepCount;
135
136 DECLARE_NO_COPY_CLASS(wxToolBarTool)
137 };
138
139
140 // ============================================================================
141 // implementation
142 // ============================================================================
143
144 // ----------------------------------------------------------------------------
145 // wxToolBarTool
146 // ----------------------------------------------------------------------------
147
148 wxToolBarToolBase *wxToolBar::CreateTool(int id,
149 const wxString& label,
150 const wxBitmap& bmpNormal,
151 const wxBitmap& bmpDisabled,
152 wxItemKind kind,
153 wxObject *clientData,
154 const wxString& shortHelp,
155 const wxString& longHelp)
156 {
157 return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
158 clientData, shortHelp, longHelp);
159 }
160
161 wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
162 {
163 return new wxToolBarTool(this, control);
164 }
165
166 // ----------------------------------------------------------------------------
167 // wxToolBar construction
168 // ----------------------------------------------------------------------------
169
170 void wxToolBar::Init()
171 {
172 }
173
174 bool wxToolBar::Create(wxWindow *parent,
175 wxWindowID id,
176 const wxPoint& pos,
177 const wxSize& size,
178 long style,
179 const wxString& name)
180 {
181 return false;
182 }
183
184 void wxToolBar::Recreate()
185 {
186 }
187
188 wxToolBar::~wxToolBar()
189 {
190 }
191
192 wxSize wxToolBar::DoGetBestSize() const
193 {
194 return wxSize(0,0);
195 }
196
197 // ----------------------------------------------------------------------------
198 // adding/removing tools
199 // ----------------------------------------------------------------------------
200
201 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
202 {
203 return false;
204 }
205
206 bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
207 {
208 return false;
209 }
210
211 bool wxToolBar::Realize()
212 {
213 return false;
214 }
215
216 // ----------------------------------------------------------------------------
217 // toolbar geometry
218 // ----------------------------------------------------------------------------
219
220 void wxToolBar::SetToolBitmapSize(const wxSize& size)
221 {
222 }
223
224 void wxToolBar::SetRows(int nRows)
225 {
226 }
227
228 // The button size is bigger than the bitmap size
229 wxSize wxToolBar::GetToolSize() const
230 {
231 return wxSize(0,0);
232 }
233
234 static
235 wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
236 size_t index )
237 {
238 return 0;
239 }
240
241 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
242 {
243 return NULL;
244 }
245
246 void wxToolBar::UpdateSize()
247 {
248 }
249
250 // ----------------------------------------------------------------------------
251 // tool state
252 // ----------------------------------------------------------------------------
253
254 void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
255 {
256 }
257
258 void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle)
259 {
260 }
261
262 void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
263 {
264 }
265
266 // ----------------------------------------------------------------------------
267 // event handlers
268 // ----------------------------------------------------------------------------
269
270 void wxToolBar::OnMouseEvent(wxMouseEvent& event)
271 {
272 }
273
274 #endif // wxUSE_TOOLBAR
275