]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/toolbar.cpp
implement date events here if wxDatePickerCtrl is not used (as we need them too)
[wxWidgets.git] / src / palmos / toolbar.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: palmos/toolbar.cpp
3// Purpose: wxToolBar
4// Author: William Osborne
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
73IMPLEMENT_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
94BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
95 EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
96 EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged)
97END_EVENT_TABLE()
98
99// ----------------------------------------------------------------------------
100// private classes
101// ----------------------------------------------------------------------------
102
103class wxToolBarTool : public wxToolBarToolBase
104{
105public:
106 wxToolBarTool(wxToolBar *tbar,
107 int id,
108 const wxString& label,
109 const wxBitmap& bmpNormal,
110 const wxBitmap& bmpDisabled,
111 wxItemKind kind,
112 wxObject *clientData,
113 const wxString& shortHelp,
114 const wxString& longHelp)
115 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
116 clientData, shortHelp, longHelp)
117 {
118 }
119
120 wxToolBarTool(wxToolBar *tbar, wxControl *control)
121 : wxToolBarToolBase(tbar, control)
122 {
123 }
124
125 virtual void SetLabel(const wxString& label)
126 {
127 }
128
129 // set/get the number of separators which we use to cover the space used by
130 // a control in the toolbar
131 void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
132 size_t GetSeparatorsCount() const { return m_nSepCount; }
133
134private:
135 size_t m_nSepCount;
136
137 DECLARE_NO_COPY_CLASS(wxToolBarTool)
138};
139
140
141// ============================================================================
142// implementation
143// ============================================================================
144
145// ----------------------------------------------------------------------------
146// wxToolBarTool
147// ----------------------------------------------------------------------------
148
149wxToolBarToolBase *wxToolBar::CreateTool(int id,
150 const wxString& label,
151 const wxBitmap& bmpNormal,
152 const wxBitmap& bmpDisabled,
153 wxItemKind kind,
154 wxObject *clientData,
155 const wxString& shortHelp,
156 const wxString& longHelp)
157{
158 return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
159 clientData, shortHelp, longHelp);
160}
161
162wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
163{
164 return new wxToolBarTool(this, control);
165}
166
167// ----------------------------------------------------------------------------
168// wxToolBar construction
169// ----------------------------------------------------------------------------
170
171void wxToolBar::Init()
172{
173}
174
175bool wxToolBar::Create(wxWindow *parent,
176 wxWindowID id,
177 const wxPoint& pos,
178 const wxSize& size,
179 long style,
180 const wxString& name)
181{
182 return false;
183}
184
185void wxToolBar::Recreate()
186{
187}
188
189wxToolBar::~wxToolBar()
190{
191}
192
193wxSize wxToolBar::DoGetBestSize() const
194{
195 return wxSize(0,0);
196}
197
198// ----------------------------------------------------------------------------
199// adding/removing tools
200// ----------------------------------------------------------------------------
201
202bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
203{
204 return false;
205}
206
207bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
208{
209 return false;
210}
211
212bool wxToolBar::Realize()
213{
214 return false;
215}
216
217// ----------------------------------------------------------------------------
218// toolbar geometry
219// ----------------------------------------------------------------------------
220
221void wxToolBar::SetToolBitmapSize(const wxSize& size)
222{
223}
224
225void wxToolBar::SetRows(int nRows)
226{
227}
228
229// The button size is bigger than the bitmap size
230wxSize wxToolBar::GetToolSize() const
231{
232 return wxSize(0,0);
233}
234
235static
236wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
237 size_t index )
238{
239 return 0;
240}
241
242wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
243{
244 return NULL;
245}
246
247void wxToolBar::UpdateSize()
248{
249}
250
251// ----------------------------------------------------------------------------
252// toolbar styles
253// ---------------------------------------------------------------------------
254
255void wxToolBar::SetWindowStyleFlag(long style)
256{
257}
258
259// ----------------------------------------------------------------------------
260// tool state
261// ----------------------------------------------------------------------------
262
263void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
264{
265}
266
267void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle)
268{
269}
270
271void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
272{
273}
274
275// ----------------------------------------------------------------------------
276// event handlers
277// ----------------------------------------------------------------------------
278
279// Responds to colour changes, and passes event on to children.
280void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event)
281{
282}
283
284void wxToolBar::OnMouseEvent(wxMouseEvent& event)
285{
286}
287
288#endif // wxUSE_TOOLBAR
289