]> git.saurik.com Git - wxWidgets.git/blob - src/common/tbarbase.cpp
Some typos corrected in iniconf.cpp
[wxWidgets.git] / src / common / tbarbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbarbase.cpp
3 // Purpose: Toolbar base classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "tbarbase.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 // For ::UpdateWindow
28 #ifdef __WXMSW__
29 #include <windows.h>
30 #endif
31
32 #if wxUSE_TOOLBAR
33
34 #include "wx/tbarbase.h"
35
36 #if !USE_SHARED_LIBRARY
37 IMPLEMENT_ABSTRACT_CLASS(wxToolBarBase, wxControl)
38 IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
39
40 BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
41 EVT_SCROLL(wxToolBarBase::OnScroll)
42 EVT_SIZE(wxToolBarBase::OnSize)
43 EVT_IDLE(wxToolBarBase::OnIdle)
44 END_EVENT_TABLE()
45 #endif
46
47 // Keep a list of all toolbars created, so you can tell whether a toolbar
48 // is still valid: a tool may have quit the toolbar.
49 static wxList gs_ToolBars;
50
51 #ifdef __WXGTK__
52 wxToolBarTool::wxToolBarTool(wxToolBar *owner, int theIndex,
53 const wxBitmap& theBitmap1, const wxBitmap& theBitmap2,
54 bool toggle, wxObject *clientData,
55 const wxString& helpS1, const wxString& helpS2,
56 GtkWidget *item )
57 #else
58 wxToolBarTool::wxToolBarTool(int theIndex,
59 const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle,
60 long xPos, long yPos, const wxString& helpS1, const wxString& helpS2)
61 #endif
62 {
63 m_toolStyle = wxTOOL_STYLE_BUTTON;
64 #ifdef __WXGTK__
65 m_owner = owner;
66 m_item = item;
67 m_clientData = clientData;
68 m_x = 0;
69 m_y = 0;
70 #else
71 m_clientData = NULL;
72 m_x = xPos;
73 m_y = yPos;
74 #endif
75 m_index = theIndex;
76 m_isToggle = toggle;
77 m_toggleState = FALSE;
78 m_enabled = TRUE;
79 m_bitmap1 = theBitmap1;
80 m_bitmap2 = theBitmap2;
81 m_width = m_height = 0;
82 m_deleteSecondBitmap = FALSE;
83 if (m_bitmap1.Ok())
84 {
85 m_width = m_bitmap1.GetWidth()+2;
86 m_height = m_bitmap1.GetHeight()+2;
87 }
88 m_shortHelpString = helpS1;
89 m_longHelpString = helpS2;
90 }
91
92 wxToolBarTool::~wxToolBarTool()
93 {
94 /*
95 if (m_deleteSecondBitmap && m_bitmap2)
96 delete m_bitmap2;
97 */
98 }
99
100
101 // class wxToolBar
102
103 wxToolBarBase::wxToolBarBase(void) : m_tools(wxKEY_INTEGER)
104 {
105 gs_ToolBars.Append(this);
106
107 m_maxRows = 1;
108 m_maxCols = 32000;
109 m_maxWidth = 0;
110 m_maxHeight = 0;
111 m_defaultWidth = 16;
112 m_defaultHeight = 15;
113 m_xMargin = 0;
114 m_yMargin = 0;
115 m_toolPacking = 1;
116 m_toolSeparation = 5;
117 m_currentTool = -1;
118
119 m_xScrollPixelsPerLine = 0;
120 m_yScrollPixelsPerLine = 0;
121 m_xScrollingEnabled = TRUE;
122 m_yScrollingEnabled = TRUE;
123 m_xScrollPosition = 0;
124 m_yScrollPosition = 0;
125 m_calcScrolledOffset = TRUE;
126 m_xScrollLines = 0;
127 m_yScrollLines = 0;
128 m_xScrollLinesPerPage = 0;
129 m_yScrollLinesPerPage = 0;
130 }
131
132 wxToolBarBase::~wxToolBarBase ()
133 {
134 gs_ToolBars.DeleteObject(this);
135
136 for ( wxNode *node = m_tools.First(); node; node = node->Next() )
137 {
138 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
139 delete tool;
140 }
141 }
142
143 // Only allow toggle if returns TRUE
144 bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown)
145 {
146 wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
147 event.SetEventObject(this);
148 event.SetExtraLong((long) toggleDown);
149
150 GetEventHandler()->ProcessEvent(event);
151
152 return TRUE;
153 }
154
155 // Call when right button down.
156 void wxToolBarBase::OnRightClick(int toolIndex,
157 long WXUNUSED(x),
158 long WXUNUSED(y))
159 {
160 wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
161 event.SetEventObject(this);
162 event.SetInt(toolIndex);
163
164 GetEventHandler()->ProcessEvent(event);
165 }
166
167 // Called when the mouse cursor enters a tool bitmap (no button pressed).
168 // Argument is -1 if mouse is exiting the toolbar.
169 // Note that for this event, the id of the window is used,
170 // and the integer parameter of wxCommandEvent is used to retrieve
171 // the tool id.
172 void wxToolBarBase::OnMouseEnter ( int toolIndex )
173 {
174 wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, GetId());
175 event.SetEventObject(this);
176 event.SetInt(toolIndex);
177
178 GetEventHandler()->ProcessEvent(event);
179 }
180
181 // If pushedBitmap is NULL, a reversed version of bitmap is
182 // created and used as the pushed/toggled image.
183 // If toggle is TRUE, the button toggles between the two states.
184 wxToolBarTool *wxToolBarBase::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap,
185 bool toggle, long xPos, long yPos, wxObject *clientData,
186 const wxString& helpString1, const wxString& helpString2)
187 {
188 #ifdef __WXGTK__
189 wxToolBarTool *tool = new wxToolBarTool( (wxToolBar*)this, index, bitmap, pushedBitmap, toggle,
190 (wxObject*) NULL, helpString1, helpString2);
191 #else
192 wxToolBarTool *tool = new wxToolBarTool(index, bitmap, pushedBitmap, toggle, xPos, yPos, helpString1, helpString2);
193 #endif
194 tool->m_clientData = clientData;
195
196 if (xPos > -1)
197 tool->m_x = xPos;
198 else
199 tool->m_x = m_xMargin;
200
201 if (yPos > -1)
202 tool->m_y = yPos;
203 else
204 tool->m_y = m_yMargin;
205
206 // Calculate reasonable max size in case Layout() not called
207 if ((tool->m_x + bitmap.GetWidth() + m_xMargin) > m_maxWidth)
208 m_maxWidth = (tool->m_x + bitmap.GetWidth() + m_xMargin);
209
210 if ((tool->m_y + bitmap.GetHeight() + m_yMargin) > m_maxHeight)
211 m_maxHeight = (tool->m_y + bitmap.GetHeight() + m_yMargin);
212
213 m_tools.Append((long)index, tool);
214 return tool;
215 }
216
217 void wxToolBarBase::AddSeparator ()
218 {
219 wxToolBarTool *tool = new wxToolBarTool;
220 tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR;
221 m_tools.Append(-1, tool);
222 }
223
224 void wxToolBarBase::ClearTools()
225 {
226 m_pressedTool = m_currentTool = -1;
227 wxNode *node = m_tools.First();
228 while (node)
229 {
230 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
231 wxNode *nextNode = node->Next();
232 delete tool;
233 delete node;
234 node = nextNode;
235 }
236 }
237
238 void wxToolBarBase::EnableTool(int index, bool enable)
239 {
240 wxNode *node = m_tools.Find((long)index);
241 if (node)
242 {
243 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
244 if (tool)
245 tool->m_enabled = enable;
246 }
247 }
248
249 void wxToolBarBase::ToggleTool(int WXUNUSED(index),
250 bool WXUNUSED(toggle))
251 {
252 }
253
254 void wxToolBarBase::SetToggle(int index, bool value)
255 {
256 wxNode *node=m_tools.Find((long)index);
257 if (node){
258 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
259 tool->m_isToggle = value;
260 }
261 }
262
263 bool wxToolBarBase::GetToolState(int index) const
264 {
265 wxNode *node = m_tools.Find((long)index);
266 if (node)
267 {
268 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
269 if (tool)
270 {
271 return tool->m_toggleState;
272 }
273 else return FALSE;
274 }
275 else return FALSE;
276 }
277
278 bool wxToolBarBase::GetToolEnabled(int index) const
279 {
280 wxNode *node = m_tools.Find((long)index);
281 if (node)
282 {
283 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
284 if (tool)
285 {
286 return tool->m_enabled;
287 }
288 else return FALSE;
289 }
290 else return FALSE;
291 }
292
293 wxObject *wxToolBarBase::GetToolClientData(int index) const
294 {
295 wxNode *node = m_tools.Find((long)index);
296 if (node)
297 {
298 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
299 if (tool)
300 {
301 return tool->m_clientData;
302 }
303 else return NULL;
304 }
305 else return NULL;
306 }
307
308 void wxToolBarBase::SetToolShortHelp(int index, const wxString& helpString)
309 {
310 wxNode *node=m_tools.Find((long)index);
311 if (node)
312 {
313 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
314 tool->m_shortHelpString = helpString;
315 }
316 }
317
318 wxString wxToolBarBase::GetToolShortHelp(int index) const
319 {
320 wxNode *node=m_tools.Find((long)index);
321 if (node)
322 {
323 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
324 return tool->m_shortHelpString;
325 }
326 else
327 return wxString("");
328 }
329
330 void wxToolBarBase::SetToolLongHelp(int index, const wxString& helpString)
331 {
332 wxNode *node=m_tools.Find((long)index);
333 if (node)
334 {
335 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
336 tool->m_longHelpString = helpString;
337 }
338 }
339
340 wxString wxToolBarBase::GetToolLongHelp(int index) const
341 {
342 wxNode *node=m_tools.Find((long)index);
343 if (node)
344 {
345 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
346 return tool->m_longHelpString;
347 }
348 else
349 return wxString("");
350 }
351
352 wxToolBarTool *wxToolBarBase::FindToolForPosition(long x, long y) const
353 {
354 wxNode *node = m_tools.First();
355 while (node)
356 {
357 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
358 if ((x >= tool->m_x) && (y >= tool->m_y) &&
359 (x <= (tool->m_x + tool->GetWidth())) &&
360 (y <= (tool->m_y + tool->GetHeight())))
361 return tool;
362
363 node = node->Next();
364 }
365 return NULL;
366 }
367
368 wxSize wxToolBarBase::GetMaxSize ( void ) const
369 {
370 return wxSize(m_maxWidth, m_maxHeight);
371 }
372
373 // Okay, so we've left the tool we're in ... we must check if
374 // the tool we're leaving was a 'sprung push button' and if so,
375 // spring it back to the up state.
376 //
377 void wxToolBarBase::SetMargins(int x, int y)
378 {
379 m_xMargin = x;
380 m_yMargin = y;
381 }
382
383 void wxToolBarBase::SetToolPacking(int packing)
384 {
385 m_toolPacking = packing;
386 }
387
388 void wxToolBarBase::SetToolSeparation(int separation)
389 {
390 m_toolSeparation = separation;
391 }
392
393 void wxToolBarBase::Command(wxCommandEvent& WXUNUSED(event))
394 {
395 }
396
397 void wxToolBarBase::Layout()
398 {
399 }
400
401
402 // SCROLLING IMPLEMENTATION
403
404 /*
405 * pixelsPerUnitX/pixelsPerUnitY: number of pixels per unit (e.g. pixels per text line)
406 * noUnitsX/noUnitsY: : no. units per scrollbar
407 */
408 void wxToolBarBase::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
409 int noUnitsX, int noUnitsY,
410 int xPos, int yPos)
411 {
412 m_xScrollPixelsPerLine = pixelsPerUnitX;
413 m_yScrollPixelsPerLine = pixelsPerUnitY;
414 m_xScrollLines = noUnitsX;
415 m_yScrollLines = noUnitsY;
416
417 int w, h;
418 GetSize(&w, &h);
419
420 // Recalculate scroll bar range and position
421 if (m_xScrollLines > 0)
422 {
423 m_xScrollPosition = xPos;
424 SetScrollPos (wxHORIZONTAL, m_xScrollPosition, TRUE);
425 }
426 else
427 {
428 SetScrollbar(wxHORIZONTAL, 0, 0, 0, FALSE);
429 m_xScrollPosition = 0;
430 }
431
432 if (m_yScrollLines > 0)
433 {
434 m_yScrollPosition = yPos;
435 SetScrollPos (wxVERTICAL, m_yScrollPosition, TRUE);
436 }
437 else
438 {
439 SetScrollbar(wxVERTICAL, 0, 0, 0, FALSE);
440 m_yScrollPosition = 0;
441 }
442 AdjustScrollbars();
443 Refresh();
444 #ifdef __WXMSW__
445 ::UpdateWindow ((HWND) GetHWND());
446 #endif
447 }
448
449
450 void wxToolBarBase::OnScroll(wxScrollEvent& event)
451 {
452 int orient = event.GetOrientation();
453
454 int nScrollInc = CalcScrollInc(event);
455 if (nScrollInc == 0)
456 return;
457
458 if (orient == wxHORIZONTAL)
459 {
460 int newPos = m_xScrollPosition + nScrollInc;
461 SetScrollPos(wxHORIZONTAL, newPos, TRUE );
462 }
463 else
464 {
465 int newPos = m_yScrollPosition + nScrollInc;
466 SetScrollPos(wxVERTICAL, newPos, TRUE );
467 }
468
469 if (orient == wxHORIZONTAL)
470 {
471 if (m_xScrollingEnabled)
472 ScrollWindow(-m_xScrollPixelsPerLine * nScrollInc, 0, NULL);
473 else
474 Refresh();
475 }
476 else
477 {
478 if (m_yScrollingEnabled)
479 ScrollWindow(0, -m_yScrollPixelsPerLine * nScrollInc, NULL);
480 else
481 Refresh();
482 }
483
484 if (orient == wxHORIZONTAL)
485 {
486 m_xScrollPosition += nScrollInc;
487 }
488 else
489 {
490 m_yScrollPosition += nScrollInc;
491 }
492
493 }
494
495 int wxToolBarBase::CalcScrollInc(wxScrollEvent& event)
496 {
497 int pos = event.GetPosition();
498 int orient = event.GetOrientation();
499
500 int nScrollInc = 0;
501 switch (event.GetEventType())
502 {
503 case wxEVT_SCROLL_TOP:
504 {
505 if (orient == wxHORIZONTAL)
506 nScrollInc = - m_xScrollPosition;
507 else
508 nScrollInc = - m_yScrollPosition;
509 break;
510 }
511 case wxEVT_SCROLL_BOTTOM:
512 {
513 if (orient == wxHORIZONTAL)
514 nScrollInc = m_xScrollLines - m_xScrollPosition;
515 else
516 nScrollInc = m_yScrollLines - m_yScrollPosition;
517 break;
518 }
519 case wxEVT_SCROLL_LINEUP:
520 {
521 nScrollInc = -1;
522 break;
523 }
524 case wxEVT_SCROLL_LINEDOWN:
525 {
526 nScrollInc = 1;
527 break;
528 }
529 case wxEVT_SCROLL_PAGEUP:
530 {
531 if (orient == wxHORIZONTAL)
532 nScrollInc = -GetScrollPageSize(wxHORIZONTAL);
533 else
534 nScrollInc = -GetScrollPageSize(wxVERTICAL);
535 break;
536 }
537 case wxEVT_SCROLL_PAGEDOWN:
538 {
539 if (orient == wxHORIZONTAL)
540 nScrollInc = GetScrollPageSize(wxHORIZONTAL);
541 else
542 nScrollInc = GetScrollPageSize(wxVERTICAL);
543 break;
544 }
545 case wxEVT_SCROLL_THUMBTRACK:
546 {
547 if (orient == wxHORIZONTAL)
548 nScrollInc = pos - m_xScrollPosition;
549 else
550 nScrollInc = pos - m_yScrollPosition;
551 break;
552 }
553 default:
554 {
555 break;
556 }
557 }
558 if (orient == wxHORIZONTAL)
559 {
560 int w, h;
561 GetClientSize(&w, &h);
562
563 int nMaxWidth = m_xScrollLines*m_xScrollPixelsPerLine;
564 int noPositions = (int) ( ((nMaxWidth - w)/(float)m_xScrollPixelsPerLine) + 0.5 );
565 if (noPositions < 0)
566 noPositions = 0;
567
568 if ( (m_xScrollPosition + nScrollInc) < 0 )
569 nScrollInc = -m_xScrollPosition; // As -ve as we can go
570 else if ( (m_xScrollPosition + nScrollInc) > noPositions )
571 nScrollInc = noPositions - m_xScrollPosition; // As +ve as we can go
572
573 return nScrollInc;
574 }
575 else
576 {
577 int w, h;
578 GetClientSize(&w, &h);
579
580 int nMaxHeight = m_yScrollLines*m_yScrollPixelsPerLine;
581 int noPositions = (int) ( ((nMaxHeight - h)/(float)m_yScrollPixelsPerLine) + 0.5 );
582 if (noPositions < 0)
583 noPositions = 0;
584
585 if ( (m_yScrollPosition + nScrollInc) < 0 )
586 nScrollInc = -m_yScrollPosition; // As -ve as we can go
587 else if ( (m_yScrollPosition + nScrollInc) > noPositions )
588 nScrollInc = noPositions - m_yScrollPosition; // As +ve as we can go
589
590 return nScrollInc;
591 }
592 }
593
594 // Adjust the scrollbars - new version.
595 void wxToolBarBase::AdjustScrollbars()
596 {
597 int w, h;
598 GetClientSize(&w, &h);
599
600 // Recalculate scroll bar range and position
601 if (m_xScrollLines > 0)
602 {
603 int nMaxWidth = m_xScrollLines*m_xScrollPixelsPerLine;
604 int newRange = (int) ( ((nMaxWidth)/(float)m_xScrollPixelsPerLine) + 0.5 );
605 if (newRange < 0)
606 newRange = 0;
607
608 m_xScrollPosition = wxMin(newRange, m_xScrollPosition);
609
610 // Calculate page size i.e. number of scroll units you get on the
611 // current client window
612 int noPagePositions = (int) ( (w/(float)m_xScrollPixelsPerLine) + 0.5 );
613 if (noPagePositions < 1)
614 noPagePositions = 1;
615
616 SetScrollbar(wxHORIZONTAL, m_xScrollPosition, noPagePositions, newRange);
617 SetScrollPageSize(wxHORIZONTAL, noPagePositions);
618 }
619 if (m_yScrollLines > 0)
620 {
621 int nMaxHeight = m_yScrollLines*m_yScrollPixelsPerLine;
622 int newRange = (int) ( ((nMaxHeight)/(float)m_yScrollPixelsPerLine) + 0.5 );
623 if (newRange < 0)
624 newRange = 0;
625
626 m_yScrollPosition = wxMin(newRange, m_yScrollPosition);
627
628 // Calculate page size i.e. number of scroll units you get on the
629 // current client window
630 int noPagePositions = (int) ( (h/(float)m_yScrollPixelsPerLine) + 0.5 );
631 if (noPagePositions < 1)
632 noPagePositions = 1;
633
634 SetScrollbar(wxVERTICAL, m_yScrollPosition, noPagePositions, newRange);
635 SetScrollPageSize(wxVERTICAL, noPagePositions);
636 }
637 }
638
639 // Default OnSize resets scrollbars, if any
640 void wxToolBarBase::OnSize(wxSizeEvent& WXUNUSED(event))
641 {
642 #if wxUSE_CONSTRAINTS
643 if (GetAutoLayout())
644 Layout();
645 #endif
646
647 AdjustScrollbars();
648 }
649
650 // Prepare the DC by translating it according to the current scroll position
651 void wxToolBarBase::PrepareDC(wxDC& dc)
652 {
653 dc.SetDeviceOrigin(- m_xScrollPosition * m_xScrollPixelsPerLine, - m_yScrollPosition * m_yScrollPixelsPerLine);
654 }
655
656 void wxToolBarBase::GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const
657 {
658 *x_unit = m_xScrollPixelsPerLine;
659 *y_unit = m_yScrollPixelsPerLine;
660 }
661
662 int wxToolBarBase::GetScrollPageSize(int orient) const
663 {
664 if ( orient == wxHORIZONTAL )
665 return m_xScrollLinesPerPage;
666 else
667 return m_yScrollLinesPerPage;
668 }
669
670 void wxToolBarBase::SetScrollPageSize(int orient, int pageSize)
671 {
672 if ( orient == wxHORIZONTAL )
673 m_xScrollLinesPerPage = pageSize;
674 else
675 m_yScrollLinesPerPage = pageSize;
676 }
677
678 /*
679 * Scroll to given position (scroll position, not pixel position)
680 */
681 void wxToolBarBase::Scroll (int x_pos, int y_pos)
682 {
683 int old_x, old_y;
684 ViewStart (&old_x, &old_y);
685 if (((x_pos == -1) || (x_pos == old_x)) && ((y_pos == -1) || (y_pos == old_y)))
686 return;
687
688 if (x_pos > -1)
689 {
690 m_xScrollPosition = x_pos;
691 SetScrollPos (wxHORIZONTAL, x_pos, TRUE);
692 }
693 if (y_pos > -1)
694 {
695 m_yScrollPosition = y_pos;
696 SetScrollPos (wxVERTICAL, y_pos, TRUE);
697 }
698 Refresh();
699 #ifdef __WXMSW__
700 UpdateWindow ((HWND) GetHWND());
701 #endif
702 }
703
704 void wxToolBarBase::EnableScrolling (bool x_scroll, bool y_scroll)
705 {
706 m_xScrollingEnabled = x_scroll;
707 m_yScrollingEnabled = y_scroll;
708 }
709
710 void wxToolBarBase::GetVirtualSize (int *x, int *y) const
711 {
712 *x = m_xScrollPixelsPerLine * m_xScrollLines;
713 *y = m_yScrollPixelsPerLine * m_yScrollLines;
714 }
715
716 // Where the current view starts from
717 void wxToolBarBase::ViewStart (int *x, int *y) const
718 {
719 *x = m_xScrollPosition;
720 *y = m_yScrollPosition;
721 }
722
723 void wxToolBarBase::OnIdle(wxIdleEvent& event)
724 {
725 #ifndef __WXGTK__
726 wxWindow::OnIdle(event);
727 #endif
728
729 DoToolbarUpdates();
730 }
731
732 // Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
733 void wxToolBarBase::DoToolbarUpdates()
734 {
735 wxNode* node = GetTools().First();
736 while (node)
737 {
738 wxToolBarTool* tool = (wxToolBarTool* ) node->Data();
739
740 wxUpdateUIEvent event(tool->m_index);
741 event.SetEventObject(this);
742
743 if (GetEventHandler()->ProcessEvent(event))
744 {
745 if (event.GetSetEnabled())
746 EnableTool(tool->m_index, event.GetEnabled());
747 if (event.GetSetChecked())
748 ToggleTool(tool->m_index, event.GetChecked());
749 /*
750 if (event.GetSetText())
751 // Set tooltip?
752 */
753 }
754
755 node = node->Next();
756 }
757 }
758
759 #ifdef __WXMSW__
760 // Circumvent wxControl::MSWOnMouseMove which doesn't set the cursor.
761 void wxToolBarBase::MSWOnMouseMove(int x, int y, WXUINT flags)
762 {
763 wxWindow::MSWOnMouseMove(x, y, flags);
764 }
765 #endif
766
767 #endif