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