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