]>
Commit | Line | Data |
---|---|---|
39d2f9a7 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/wince/tbarwce.cpp | |
3 | // Purpose: wxToolBar for Windows CE | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2003-07-12 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
65571936 | 9 | // Licence: wxWindows licence |
39d2f9a7 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
39d2f9a7 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 | ||
a96b4743 JS |
38 | // Use the WinCE-specific toolbar only if we're either compiling |
39 | // with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI | |
a9928e9d | 40 | #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) |
39d2f9a7 JS |
41 | |
42 | #include "wx/toolbar.h" | |
43 | ||
44 | #if !defined(__GNUWIN32__) && !defined(__SALFORDC__) | |
45 | #include "malloc.h" | |
46 | #endif | |
47 | ||
48 | #include "wx/msw/private.h" | |
49 | #include <windows.h> | |
50 | #include <windowsx.h> | |
51 | #include <tchar.h> | |
52 | #include <ole2.h> | |
eae4425d | 53 | #include <shellapi.h> |
39d2f9a7 | 54 | #include <commctrl.h> |
3d487566 | 55 | #if defined(WINCE_WITHOUT_COMMANDBAR) |
2d36b3d8 JS |
56 | #include <aygshell.h> |
57 | #endif | |
58 | #include "wx/msw/wince/missing.h" | |
39d2f9a7 JS |
59 | |
60 | #include "wx/msw/winundef.h" | |
61 | ||
a9102b36 | 62 | #if !defined(__SMARTPHONE__) |
39d2f9a7 | 63 | |
a9102b36 JS |
64 | ///////////// This implementation is for PocketPC. |
65 | ///////////// See later for the Smartphone dummy toolbar class. | |
39d2f9a7 JS |
66 | |
67 | // ---------------------------------------------------------------------------- | |
a9102b36 | 68 | // Event table |
39d2f9a7 JS |
69 | // ---------------------------------------------------------------------------- |
70 | ||
a9102b36 | 71 | IMPLEMENT_DYNAMIC_CLASS(wxToolMenuBar, wxToolBar) |
39d2f9a7 | 72 | |
a9102b36 | 73 | BEGIN_EVENT_TABLE(wxToolMenuBar, wxToolBar) |
39d2f9a7 JS |
74 | END_EVENT_TABLE() |
75 | ||
76 | // ---------------------------------------------------------------------------- | |
77 | // private classes | |
78 | // ---------------------------------------------------------------------------- | |
79 | ||
a9102b36 | 80 | class wxToolMenuBarTool : public wxToolBarToolBase |
39d2f9a7 JS |
81 | { |
82 | public: | |
a9102b36 | 83 | wxToolMenuBarTool(wxToolBar *tbar, |
39d2f9a7 JS |
84 | int id, |
85 | const wxString& label, | |
86 | const wxBitmap& bmpNormal, | |
87 | const wxBitmap& bmpDisabled, | |
88 | wxItemKind kind, | |
89 | wxObject *clientData, | |
90 | const wxString& shortHelp, | |
91 | const wxString& longHelp) | |
92 | : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, | |
93 | clientData, shortHelp, longHelp) | |
94 | { | |
95 | m_nSepCount = 0; | |
ac1f013c | 96 | m_bitmapIndex = -1; |
39d2f9a7 JS |
97 | } |
98 | ||
a9102b36 | 99 | wxToolMenuBarTool(wxToolBar *tbar, wxControl *control) |
39d2f9a7 JS |
100 | : wxToolBarToolBase(tbar, control) |
101 | { | |
102 | m_nSepCount = 1; | |
ac1f013c | 103 | m_bitmapIndex = -1; |
39d2f9a7 JS |
104 | } |
105 | ||
106 | virtual void SetLabel(const wxString& label) | |
107 | { | |
108 | if ( label == m_label ) | |
109 | return; | |
110 | ||
111 | wxToolBarToolBase::SetLabel(label); | |
112 | ||
113 | // we need to update the label shown in the toolbar because it has a | |
114 | // pointer to the internal buffer of the old label | |
115 | // | |
116 | // TODO: use TB_SETBUTTONINFO | |
117 | } | |
118 | ||
119 | // set/get the number of separators which we use to cover the space used by | |
120 | // a control in the toolbar | |
121 | void SetSeparatorsCount(size_t count) { m_nSepCount = count; } | |
122 | size_t GetSeparatorsCount() const { return m_nSepCount; } | |
ac1f013c JS |
123 | |
124 | void SetBitmapIndex(int idx) { m_bitmapIndex = idx; } | |
125 | int GetBitmapIndex() const { return m_bitmapIndex; } | |
39d2f9a7 JS |
126 | |
127 | private: | |
128 | size_t m_nSepCount; | |
ac1f013c | 129 | int m_bitmapIndex; |
39d2f9a7 JS |
130 | }; |
131 | ||
132 | ||
133 | // ============================================================================ | |
134 | // implementation | |
135 | // ============================================================================ | |
136 | ||
137 | // ---------------------------------------------------------------------------- | |
138 | // wxToolBarTool | |
139 | // ---------------------------------------------------------------------------- | |
140 | ||
a9102b36 | 141 | wxToolBarToolBase *wxToolMenuBar::CreateTool(int id, |
39d2f9a7 JS |
142 | const wxString& label, |
143 | const wxBitmap& bmpNormal, | |
144 | const wxBitmap& bmpDisabled, | |
145 | wxItemKind kind, | |
146 | wxObject *clientData, | |
147 | const wxString& shortHelp, | |
148 | const wxString& longHelp) | |
149 | { | |
a9102b36 | 150 | return new wxToolMenuBarTool(this, id, label, bmpNormal, bmpDisabled, kind, |
39d2f9a7 JS |
151 | clientData, shortHelp, longHelp); |
152 | } | |
153 | ||
a9102b36 | 154 | wxToolBarToolBase *wxToolMenuBar::CreateTool(wxControl *control) |
39d2f9a7 | 155 | { |
a9102b36 | 156 | return new wxToolMenuBarTool(this, control); |
39d2f9a7 JS |
157 | } |
158 | ||
159 | // ---------------------------------------------------------------------------- | |
160 | // wxToolBar construction | |
161 | // ---------------------------------------------------------------------------- | |
162 | ||
a9102b36 | 163 | void wxToolMenuBar::Init() |
39d2f9a7 | 164 | { |
a9102b36 JS |
165 | wxToolBar::Init(); |
166 | ||
167 | m_nButtons = 0; | |
39d2f9a7 JS |
168 | m_menuBar = NULL; |
169 | } | |
170 | ||
a9102b36 | 171 | bool wxToolMenuBar::Create(wxWindow *parent, |
39d2f9a7 JS |
172 | wxWindowID id, |
173 | const wxPoint& pos, | |
174 | const wxSize& size, | |
175 | long style, | |
176 | const wxString& name, | |
177 | wxMenuBar* menuBar) | |
178 | { | |
179 | // common initialisation | |
180 | if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) | |
16640ba2 | 181 | return false; |
39d2f9a7 JS |
182 | |
183 | // MSW-specific initialisation | |
184 | if ( !MSWCreateToolbar(pos, size, menuBar) ) | |
16640ba2 | 185 | return false; |
39d2f9a7 JS |
186 | |
187 | // set up the colors and fonts | |
188 | SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); | |
189 | SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); | |
190 | ||
39fc096d | 191 | return true; |
39d2f9a7 JS |
192 | } |
193 | ||
a9102b36 | 194 | bool wxToolMenuBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), wxMenuBar* menuBar) |
39d2f9a7 JS |
195 | { |
196 | SetMenuBar(menuBar); | |
197 | if (m_menuBar) | |
198 | m_menuBar->SetToolBar(this); | |
199 | ||
3d487566 | 200 | #if defined(WINCE_WITHOUT_COMMANDBAR) |
39d2f9a7 JS |
201 | // Create the menubar. |
202 | SHMENUBARINFO mbi; | |
39fc096d | 203 | |
39d2f9a7 JS |
204 | memset (&mbi, 0, sizeof (SHMENUBARINFO)); |
205 | mbi.cbSize = sizeof (SHMENUBARINFO); | |
206 | mbi.hwndParent = (HWND) GetParent()->GetHWND(); | |
d7da7f13 | 207 | #ifdef __SMARTPHONE__ |
74d0b78c JS |
208 | mbi.nToolBarId = 5002; |
209 | #else | |
39d2f9a7 | 210 | mbi.nToolBarId = 5000; |
74d0b78c | 211 | #endif |
39d2f9a7 JS |
212 | mbi.nBmpId = 0; |
213 | mbi.cBmpImages = 0; | |
214 | mbi.dwFlags = 0 ; // SHCMBF_EMPTYBAR; | |
215 | mbi.hInstRes = wxGetInstance(); | |
39fc096d | 216 | |
39d2f9a7 JS |
217 | if (!SHCreateMenuBar(&mbi)) |
218 | { | |
219 | wxFAIL_MSG( _T("SHCreateMenuBar failed") ); | |
16640ba2 | 220 | return false; |
39d2f9a7 | 221 | } |
39fc096d | 222 | |
39d2f9a7 | 223 | SetHWND((WXHWND) mbi.hwndMB); |
960b193e JS |
224 | #else |
225 | HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId()); | |
226 | SetHWND((WXHWND) hWnd); | |
2d36b3d8 JS |
227 | #endif |
228 | ||
77ffb593 | 229 | // install wxWidgets window proc for this window |
39d2f9a7 JS |
230 | SubclassWin(m_hWnd); |
231 | ||
232 | if (menuBar) | |
233 | menuBar->Create(); | |
39fc096d WS |
234 | |
235 | return true; | |
39d2f9a7 JS |
236 | } |
237 | ||
a9102b36 | 238 | void wxToolMenuBar::Recreate() |
39d2f9a7 | 239 | { |
a9102b36 | 240 | // TODO |
39d2f9a7 JS |
241 | } |
242 | ||
a9102b36 | 243 | wxToolMenuBar::~wxToolMenuBar() |
39d2f9a7 | 244 | { |
bf95a04f JS |
245 | if (GetMenuBar()) |
246 | GetMenuBar()->SetToolBar(NULL); | |
39d2f9a7 JS |
247 | } |
248 | ||
249 | // Return HMENU for the menu associated with the commandbar | |
a9102b36 | 250 | WXHMENU wxToolMenuBar::GetHMenu() |
39d2f9a7 | 251 | { |
781a24e8 | 252 | #if defined(__HANDHELDPC__) |
781a24e8 RR |
253 | return 0; |
254 | #else | |
39d2f9a7 JS |
255 | if (GetHWND()) |
256 | { | |
257 | return (WXHMENU) (HMENU)::SendMessage((HWND) GetHWND(), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0); | |
258 | } | |
259 | else | |
260 | return 0; | |
781a24e8 | 261 | #endif |
39d2f9a7 JS |
262 | } |
263 | ||
39d2f9a7 JS |
264 | // ---------------------------------------------------------------------------- |
265 | // adding/removing tools | |
266 | // ---------------------------------------------------------------------------- | |
267 | ||
a9102b36 | 268 | bool wxToolMenuBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) |
39d2f9a7 JS |
269 | { |
270 | // nothing special to do here - we really create the toolbar buttons in | |
271 | // Realize() later | |
272 | tool->Attach(this); | |
273 | ||
39fc096d | 274 | return true; |
39d2f9a7 JS |
275 | } |
276 | ||
a9102b36 | 277 | bool wxToolMenuBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) |
39d2f9a7 JS |
278 | { |
279 | // the main difficulty we have here is with the controls in the toolbars: | |
280 | // as we (sometimes) use several separators to cover up the space used by | |
281 | // them, the indices are not the same for us and the toolbar | |
282 | ||
283 | // first determine the position of the first button to delete: it may be | |
284 | // different from pos if we use several separators to cover the space used | |
285 | // by a control | |
286 | wxToolBarToolsList::compatibility_iterator node; | |
287 | for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) | |
288 | { | |
289 | wxToolBarToolBase *tool2 = node->GetData(); | |
290 | if ( tool2 == tool ) | |
291 | { | |
292 | // let node point to the next node in the list | |
293 | node = node->GetNext(); | |
294 | ||
295 | break; | |
296 | } | |
297 | ||
298 | if ( tool2->IsControl() ) | |
299 | { | |
a9102b36 | 300 | pos += ((wxToolMenuBarTool *)tool2)->GetSeparatorsCount() - 1; |
39d2f9a7 JS |
301 | } |
302 | } | |
303 | ||
304 | // now determine the number of buttons to delete and the area taken by them | |
305 | size_t nButtonsToDelete = 1; | |
306 | ||
307 | // get the size of the button we're going to delete | |
308 | RECT r; | |
309 | if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, pos, (LPARAM)&r) ) | |
310 | { | |
311 | wxLogLastError(_T("TB_GETITEMRECT")); | |
312 | } | |
313 | ||
314 | int width = r.right - r.left; | |
315 | ||
316 | if ( tool->IsControl() ) | |
317 | { | |
a9102b36 | 318 | nButtonsToDelete = ((wxToolMenuBarTool *)tool)->GetSeparatorsCount(); |
39d2f9a7 JS |
319 | |
320 | width *= nButtonsToDelete; | |
321 | } | |
322 | ||
323 | // do delete all buttons | |
324 | m_nButtons -= nButtonsToDelete; | |
325 | while ( nButtonsToDelete-- > 0 ) | |
326 | { | |
327 | if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) | |
328 | { | |
329 | wxLogLastError(wxT("TB_DELETEBUTTON")); | |
330 | ||
16640ba2 | 331 | return false; |
39d2f9a7 JS |
332 | } |
333 | } | |
334 | ||
335 | tool->Detach(); | |
336 | ||
337 | // and finally reposition all the controls after this button (the toolbar | |
338 | // takes care of all normal items) | |
339 | for ( /* node -> first after deleted */ ; node; node = node->GetNext() ) | |
340 | { | |
341 | wxToolBarToolBase *tool2 = node->GetData(); | |
342 | if ( tool2->IsControl() ) | |
343 | { | |
344 | int x; | |
345 | wxControl *control = tool2->GetControl(); | |
346 | control->GetPosition(&x, NULL); | |
39fc096d | 347 | control->Move(x - width, wxDefaultCoord); |
39d2f9a7 JS |
348 | } |
349 | } | |
350 | ||
39fc096d | 351 | return true; |
39d2f9a7 JS |
352 | } |
353 | ||
4012b958 | 354 | bool wxToolMenuBar::Realize() |
39d2f9a7 JS |
355 | { |
356 | const size_t nTools = GetToolsCount(); | |
357 | if ( nTools == 0 ) | |
358 | { | |
359 | // nothing to do | |
39fc096d | 360 | return true; |
39d2f9a7 JS |
361 | } |
362 | ||
39d2f9a7 JS |
363 | #if 0 |
364 | // delete all old buttons, if any | |
365 | for ( size_t pos = 0; pos < m_nButtons; pos++ ) | |
366 | { | |
367 | if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) | |
368 | { | |
369 | wxLogDebug(wxT("TB_DELETEBUTTON failed")); | |
370 | } | |
371 | } | |
7010702f | 372 | #endif // 0 |
39d2f9a7 | 373 | |
16640ba2 | 374 | bool lastWasRadio = false; |
39d2f9a7 JS |
375 | wxToolBarToolsList::Node* node; |
376 | for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) | |
377 | { | |
a9102b36 | 378 | wxToolMenuBarTool *tool = (wxToolMenuBarTool*) node->GetData(); |
39d2f9a7 | 379 | |
ac1f013c | 380 | TBBUTTON buttons[1] ; |
bf95a04f | 381 | |
ac1f013c | 382 | TBBUTTON& button = buttons[0]; |
39d2f9a7 JS |
383 | |
384 | wxZeroMemory(button); | |
385 | ||
16640ba2 | 386 | bool isRadio = false; |
39d2f9a7 JS |
387 | switch ( tool->GetStyle() ) |
388 | { | |
389 | case wxTOOL_STYLE_CONTROL: | |
390 | button.idCommand = tool->GetId(); | |
391 | // fall through: create just a separator too | |
4012b958 | 392 | // TODO: controls are not yet supported on wxToolMenuBar. |
39d2f9a7 JS |
393 | |
394 | case wxTOOL_STYLE_SEPARATOR: | |
395 | button.fsState = TBSTATE_ENABLED; | |
396 | button.fsStyle = TBSTYLE_SEP; | |
397 | break; | |
398 | ||
399 | case wxTOOL_STYLE_BUTTON: | |
ac1f013c | 400 | |
39d2f9a7 JS |
401 | if ( HasFlag(wxTB_TEXT) ) |
402 | { | |
403 | const wxString& label = tool->GetLabel(); | |
404 | if ( !label.empty() ) | |
405 | { | |
406 | button.iString = (int)label.c_str(); | |
407 | } | |
408 | } | |
409 | ||
ac1f013c JS |
410 | const wxBitmap& bmp = tool->GetNormalBitmap(); |
411 | ||
412 | wxBitmap bmpToUse = bmp; | |
413 | ||
ec5f0c24 | 414 | if (bmp.GetWidth() < 16 || bmp.GetHeight() < 16 || bmp.GetMask() != NULL) |
ac1f013c JS |
415 | { |
416 | wxMemoryDC memDC; | |
417 | wxBitmap b(16,16); | |
418 | memDC.SelectObject(b); | |
4012b958 JS |
419 | wxColour col = wxColour(192,192,192); |
420 | memDC.SetBackground(wxBrush(col)); | |
ac1f013c JS |
421 | memDC.Clear(); |
422 | int x = (16 - bmp.GetWidth())/2; | |
423 | int y = (16 - bmp.GetHeight())/2; | |
424 | memDC.DrawBitmap(bmp, x, y, true); | |
425 | memDC.SelectObject(wxNullBitmap); | |
426 | ||
427 | bmpToUse = b; | |
428 | tool->SetNormalBitmap(b); | |
429 | } | |
430 | ||
431 | int n = 0; | |
432 | if ( bmpToUse.Ok() ) | |
bf95a04f | 433 | { |
ac1f013c JS |
434 | n = ::CommandBar_AddBitmap( (HWND) GetHWND(), NULL, (int) (HBITMAP) bmpToUse.GetHBITMAP(), |
435 | 1, 16, 16 ); | |
bf95a04f | 436 | } |
ac1f013c JS |
437 | |
438 | button.idCommand = tool->GetId(); | |
439 | button.iBitmap = n; | |
39d2f9a7 JS |
440 | |
441 | if ( tool->IsEnabled() ) | |
442 | button.fsState |= TBSTATE_ENABLED; | |
443 | if ( tool->IsToggled() ) | |
444 | button.fsState |= TBSTATE_CHECKED; | |
445 | ||
446 | switch ( tool->GetKind() ) | |
447 | { | |
448 | case wxITEM_RADIO: | |
449 | button.fsStyle = TBSTYLE_CHECKGROUP; | |
450 | ||
451 | if ( !lastWasRadio ) | |
452 | { | |
453 | // the first item in the radio group is checked by | |
454 | // default to be consistent with wxGTK and the menu | |
455 | // radio items | |
456 | button.fsState |= TBSTATE_CHECKED; | |
457 | ||
39fc096d | 458 | tool->Toggle(true); |
39d2f9a7 JS |
459 | } |
460 | ||
39fc096d | 461 | isRadio = true; |
39d2f9a7 JS |
462 | break; |
463 | ||
464 | case wxITEM_CHECK: | |
465 | button.fsStyle = TBSTYLE_CHECK; | |
466 | break; | |
467 | ||
468 | default: | |
469 | wxFAIL_MSG( _T("unexpected toolbar button kind") ); | |
470 | // fall through | |
471 | ||
472 | case wxITEM_NORMAL: | |
473 | button.fsStyle = TBSTYLE_BUTTON; | |
474 | } | |
39d2f9a7 JS |
475 | break; |
476 | } | |
477 | ||
30b9db02 VZ |
478 | if ( !::CommandBar_AddButtons( (HWND) GetHWND(), 1, buttons ) ) |
479 | { | |
480 | wxFAIL_MSG( wxT("Could not add toolbar button.")); | |
481 | } | |
7010702f | 482 | |
ac1f013c | 483 | lastWasRadio = isRadio; |
39d2f9a7 | 484 | } |
39d2f9a7 | 485 | |
7010702f | 486 | return true; |
39d2f9a7 JS |
487 | } |
488 | ||
a9102b36 | 489 | bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id) |
39d2f9a7 JS |
490 | { |
491 | wxToolBarToolBase *tool = FindById((int)id); | |
492 | if ( !tool ) | |
493 | { | |
494 | wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED); | |
495 | event.SetEventObject(this); | |
496 | event.SetId(id); | |
497 | event.SetInt(id); | |
498 | ||
499 | return GetEventHandler()->ProcessEvent(event); | |
500 | } | |
501 | ||
502 | if ( tool->CanBeToggled() ) | |
503 | { | |
504 | LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0); | |
505 | tool->Toggle((state & TBSTATE_CHECKED) != 0); | |
506 | } | |
507 | ||
508 | bool toggled = tool->IsToggled(); | |
509 | ||
510 | // avoid sending the event when a radio button is released, this is not | |
511 | // interesting | |
512 | if ( !tool->CanBeToggled() || tool->GetKind() != wxITEM_RADIO || toggled ) | |
513 | { | |
514 | // OnLeftClick() can veto the button state change - for buttons which | |
515 | // may be toggled only, of couse | |
516 | if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() ) | |
517 | { | |
518 | // revert back | |
519 | toggled = !toggled; | |
520 | tool->SetToggle(toggled); | |
521 | ||
522 | ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0)); | |
523 | } | |
524 | } | |
525 | ||
39fc096d | 526 | return true; |
39d2f9a7 JS |
527 | } |
528 | ||
ea9aa80e JS |
529 | WXLRESULT wxToolMenuBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) |
530 | { | |
531 | switch ( nMsg ) | |
532 | { | |
533 | case WM_SIZE: | |
534 | break; | |
535 | ||
536 | case WM_MOUSEMOVE: | |
537 | // we don't handle mouse moves, so always pass the message to | |
538 | // wxControl::MSWWindowProc | |
539 | HandleMouseMove(wParam, lParam); | |
540 | break; | |
541 | ||
542 | case WM_PAINT: | |
543 | break; | |
544 | } | |
545 | ||
546 | return wxControl::MSWWindowProc(nMsg, wParam, lParam); | |
547 | } | |
548 | ||
549 | ||
39d2f9a7 | 550 | #else |
a9102b36 JS |
551 | |
552 | ////////////// For Smartphone | |
39d2f9a7 JS |
553 | |
554 | // ---------------------------------------------------------------------------- | |
a9102b36 | 555 | // Event table |
39d2f9a7 JS |
556 | // ---------------------------------------------------------------------------- |
557 | ||
a9102b36 | 558 | IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase) |
39d2f9a7 | 559 | |
a9102b36 JS |
560 | BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) |
561 | END_EVENT_TABLE() | |
39d2f9a7 | 562 | |
a9102b36 JS |
563 | wxToolBarToolBase *wxToolBar::CreateTool(int id, |
564 | const wxString& label, | |
565 | const wxBitmap& bmpNormal, | |
566 | const wxBitmap& bmpDisabled, | |
567 | wxItemKind kind, | |
568 | wxObject *clientData, | |
569 | const wxString& shortHelp, | |
570 | const wxString& longHelp) | |
39d2f9a7 | 571 | { |
a9102b36 JS |
572 | return new wxToolBarToolBase(this, id, label, bmpNormal, bmpDisabled, kind, |
573 | clientData, shortHelp, longHelp); | |
39d2f9a7 JS |
574 | } |
575 | ||
a9102b36 | 576 | wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control) |
39d2f9a7 | 577 | { |
a9102b36 | 578 | return new wxToolBarToolBase(this, control); |
39d2f9a7 JS |
579 | } |
580 | ||
a9102b36 JS |
581 | bool wxToolBar::Create(wxWindow *parent, |
582 | wxWindowID WXUNUSED(id), | |
583 | const wxPoint& WXUNUSED(pos), | |
584 | const wxSize& WXUNUSED(size), | |
585 | long style, | |
586 | const wxString& name) | |
39d2f9a7 | 587 | { |
a9102b36 JS |
588 | // TODO: we may need to make this a dummy hidden window to |
589 | // satisfy other parts of wxWidgets. | |
39d2f9a7 | 590 | |
a9102b36 JS |
591 | parent->AddChild(this); |
592 | ||
593 | SetWindowStyle(style); | |
594 | SetName(name); | |
595 | ||
596 | return true; | |
39d2f9a7 JS |
597 | } |
598 | ||
a9102b36 JS |
599 | // ---------------------------------------------------------------------------- |
600 | // adding/removing tools | |
601 | // ---------------------------------------------------------------------------- | |
39d2f9a7 | 602 | |
a9102b36 JS |
603 | bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) |
604 | { | |
605 | tool->Attach(this); | |
606 | return true; | |
39d2f9a7 JS |
607 | } |
608 | ||
a9102b36 | 609 | bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) |
39d2f9a7 | 610 | { |
a9102b36 JS |
611 | tool->Detach(); |
612 | return true; | |
39d2f9a7 JS |
613 | } |
614 | ||
a9102b36 | 615 | wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const |
39d2f9a7 | 616 | { |
a9102b36 | 617 | return NULL; |
39d2f9a7 JS |
618 | } |
619 | ||
620 | // ---------------------------------------------------------------------------- | |
621 | // tool state | |
622 | // ---------------------------------------------------------------------------- | |
623 | ||
a9102b36 | 624 | void wxToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(enable)) |
39d2f9a7 | 625 | { |
39d2f9a7 JS |
626 | } |
627 | ||
a9102b36 | 628 | void wxToolBar::DoToggleTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) |
39d2f9a7 | 629 | { |
39d2f9a7 JS |
630 | } |
631 | ||
632 | void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) | |
633 | { | |
39d2f9a7 JS |
634 | wxFAIL_MSG( _T("not implemented") ); |
635 | } | |
636 | ||
a9102b36 JS |
637 | #endif |
638 | // !__SMARTPHONE__ | |
39d2f9a7 | 639 | |
39d2f9a7 | 640 | |
39d2f9a7 | 641 | |
39d2f9a7 JS |
642 | #endif // wxUSE_TOOLBAR && Win95 |
643 |