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