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