]> git.saurik.com Git - wxWidgets.git/blob - src/univ/toolbar.cpp
fixes to ShowFullScreen (KDE 3.1)
[wxWidgets.git] / src / univ / toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/toolbar.cpp
3 // Purpose: implementation of wxToolBar for wxUniversal
4 // Author: Robert Roebling, Vadim Zeitlin (universalization)
5 // Modified by:
6 // Created: 20.02.02
7 // Id: $Id$
8 // Copyright: (c) 2001 Robert Roebling,
9 // (c) 2002 SciTech Software, Inc. (www.scitechsoft.com)
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 // ============================================================================
14 // declarations
15 // ============================================================================
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #ifdef __GNUG__
22 #pragma implementation "univtoolbar.h"
23 #endif
24
25 // For compilers that support precompilation, includes "wx.h".
26 #include "wx/wxprec.h"
27
28 #ifdef __BORLANDC__
29 #pragma hdrstop
30 #endif
31
32 #if wxUSE_TOOLBAR
33
34 #ifndef WX_PRECOMP
35 #include "wx/utils.h"
36 #include "wx/app.h"
37 #endif
38
39 #include "wx/univ/renderer.h"
40
41 #include "wx/frame.h"
42 #include "wx/toolbar.h"
43 #include "wx/image.h"
44 #include "wx/log.h"
45
46 // ----------------------------------------------------------------------------
47 // constants
48 // ----------------------------------------------------------------------------
49
50 // value meaning that m_widthSeparator is not initialized
51 static const wxCoord INVALID_WIDTH = -1;
52
53 // ----------------------------------------------------------------------------
54 // wxToolBarTool: our implementation of wxToolBarToolBase
55 // ----------------------------------------------------------------------------
56
57 class WXDLLEXPORT wxToolBarTool : public wxToolBarToolBase
58 {
59 public:
60 wxToolBarTool(wxToolBar *tbar,
61 int id,
62 const wxString& label,
63 const wxBitmap& bmpNormal,
64 const wxBitmap& bmpDisabled,
65 wxItemKind kind,
66 wxObject *clientData,
67 const wxString& shortHelp,
68 const wxString& longHelp)
69 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
70 clientData, shortHelp, longHelp)
71 {
72 // no position yet
73 m_x =
74 m_y = -1;
75
76 // not pressed yet
77 m_isInverted = FALSE;
78
79 // mouse not here yet
80 m_underMouse = FALSE;
81 }
82
83 // is this tool pressed, even temporarily? (this is different from being
84 // permanently toggled which is what IsToggled() returns)
85 bool IsPressed() const
86 { return CanBeToggled() ? IsToggled() != m_isInverted : m_isInverted; }
87
88 // are we temporarily pressed/unpressed?
89 bool IsInverted() const { return m_isInverted; }
90
91 // press the tool temporarily by inverting its toggle state
92 void Invert() { m_isInverted = !m_isInverted; }
93
94 // Set underMouse
95 void SetUnderMouse( bool under = TRUE ) { m_underMouse = under; }
96 bool IsUnderMouse() { return m_underMouse; }
97
98 public:
99 // the tool position (the size is known by the toolbar itself)
100 int m_x,
101 m_y;
102
103 private:
104 // TRUE if the tool is pressed
105 bool m_isInverted;
106
107 // TRUE if the tool is under the mouse
108 bool m_underMouse;
109 };
110
111 // ============================================================================
112 // wxToolBar implementation
113 // ============================================================================
114
115 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl);
116
117 // ----------------------------------------------------------------------------
118 // wxToolBar creation
119 // ----------------------------------------------------------------------------
120
121 void wxToolBar::Init()
122 {
123 // no tools yet
124 m_needsLayout = FALSE;
125
126 // unknown widths for the tools and separators
127 m_widthSeparator = INVALID_WIDTH;
128
129 m_maxWidth =
130 m_maxHeight = 0;
131
132 wxRenderer *renderer = GetRenderer();
133
134 SetToolBitmapSize(renderer->GetToolBarButtonSize(&m_widthSeparator));
135 SetMargins(renderer->GetToolBarMargin());
136 }
137
138 bool wxToolBar::Create(wxWindow *parent,
139 wxWindowID id,
140 const wxPoint& pos,
141 const wxSize& size,
142 long style,
143 const wxString& name)
144 {
145 if ( !wxToolBarBase::Create(parent, id, pos, size, style,
146 wxDefaultValidator, name) )
147 {
148 return FALSE;
149 }
150
151 CreateInputHandler(wxINP_HANDLER_TOOLBAR);
152
153 SetBestSize(size);
154
155 return TRUE;
156 }
157
158 wxToolBar::~wxToolBar()
159 {
160 // Make sure the toolbar is removed from the parent.
161 SetSize(0,0);
162 }
163
164 void wxToolBar::SetMargins(int x, int y)
165 {
166 // This required for similar visual effects under
167 // native platforms and wxUniv.
168 wxToolBarBase::SetMargins( x + 3, y + 3 );
169 }
170
171 // ----------------------------------------------------------------------------
172 // wxToolBar tool-related methods
173 // ----------------------------------------------------------------------------
174
175 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
176 {
177 // check the "other" direction first: it must be inside the toolbar or we
178 // don't risk finding anything
179 if ( IsVertical() )
180 {
181 if ( x < 0 || x > m_maxWidth )
182 return NULL;
183
184 // we always use x, even for a vertical toolbar, this makes the code
185 // below simpler
186 x = y;
187 }
188 else // horizontal
189 {
190 if ( y < 0 || y > m_maxHeight )
191 return NULL;
192 }
193
194 for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
195 node;
196 node = node->GetNext() )
197 {
198 wxToolBarToolBase *tool = node->GetData();
199 wxRect rectTool = GetToolRect(tool);
200
201 wxCoord startTool, endTool;
202 GetRectLimits(rectTool, &startTool, &endTool);
203
204 if ( x >= startTool && x <= endTool )
205 {
206 // don't return the separators from here, they don't accept any
207 // input anyhow
208 return tool->IsSeparator() ? NULL : tool;
209 }
210 }
211
212 return NULL;
213 }
214
215 void wxToolBar::SetToolShortHelp(int id, const wxString& help)
216 {
217 wxToolBarToolBase *tool = FindById(id);
218
219 wxCHECK_RET( tool, _T("SetToolShortHelp: no such tool") );
220
221 tool->SetShortHelp(help);
222 }
223
224 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
225 wxToolBarToolBase * WXUNUSED(tool))
226 {
227 // recalculate the toolbar geometry before redrawing it the next time
228 m_needsLayout = TRUE;
229
230 // and ensure that we indeed are going to redraw
231 Refresh();
232
233 return TRUE;
234 }
235
236 bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos),
237 wxToolBarToolBase * WXUNUSED(tool))
238 {
239 // as above
240 m_needsLayout = TRUE;
241
242 Refresh();
243
244 return TRUE;
245 }
246
247 void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
248 {
249 // created disabled-state bitmap on demand
250 if ( !enable && !tool->GetDisabledBitmap().Ok() )
251 {
252 wxImage image( tool->GetNormalBitmap().ConvertToImage() );
253
254 // TODO: don't hardcode 180
255 unsigned char bg_red = 180;
256 unsigned char bg_green = 180;
257 unsigned char bg_blue = 180;
258
259 unsigned char mask_red = image.GetMaskRed();
260 unsigned char mask_green = image.GetMaskGreen();
261 unsigned char mask_blue = image.GetMaskBlue();
262
263 bool has_mask = image.HasMask();
264
265 int x,y;
266 for (y = 0; y < image.GetHeight(); y++)
267 {
268 for (x = 0; x < image.GetWidth(); x++)
269 {
270 unsigned char red = image.GetRed(x,y);
271 unsigned char green = image.GetGreen(x,y);
272 unsigned char blue = image.GetBlue(x,y);
273 if (!has_mask || red != mask_red || green != mask_green || blue != mask_blue)
274 {
275 red = (((wxInt32) red - bg_red) >> 1) + bg_red;
276 green = (((wxInt32) green - bg_green) >> 1) + bg_green;
277 blue = (((wxInt32) blue - bg_blue) >> 1) + bg_blue;
278 image.SetRGB( x, y, red, green, blue );
279 }
280 }
281 }
282
283 for (y = 0; y < image.GetHeight(); y++)
284 {
285 for (x = y % 2; x < image.GetWidth(); x += 2)
286 {
287 unsigned char red = image.GetRed(x,y);
288 unsigned char green = image.GetGreen(x,y);
289 unsigned char blue = image.GetBlue(x,y);
290 if (!has_mask || red != mask_red || green != mask_green || blue != mask_blue)
291 {
292 red = (((wxInt32) red - bg_red) >> 1) + bg_red;
293 green = (((wxInt32) green - bg_green) >> 1) + bg_green;
294 blue = (((wxInt32) blue - bg_blue) >> 1) + bg_blue;
295 image.SetRGB( x, y, red, green, blue );
296 }
297 }
298 }
299
300 tool->SetDisabledBitmap(image);
301 }
302
303 RefreshTool(tool);
304 }
305
306 void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool WXUNUSED(toggle))
307 {
308 // note that if we're called the tool did change state (the base class
309 // checks for it), so it's not necessary to check for this again here
310 RefreshTool(tool);
311 }
312
313 void wxToolBar::DoSetToggle(wxToolBarToolBase *tool, bool WXUNUSED(toggle))
314 {
315 RefreshTool(tool);
316 }
317
318 wxToolBarToolBase *wxToolBar::CreateTool(int id,
319 const wxString& label,
320 const wxBitmap& bmpNormal,
321 const wxBitmap& bmpDisabled,
322 wxItemKind kind,
323 wxObject *clientData,
324 const wxString& shortHelp,
325 const wxString& longHelp)
326 {
327 return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
328 clientData, shortHelp, longHelp);
329 }
330
331 wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
332 {
333 wxFAIL_MSG( wxT("Toolbar doesn't support controls yet (TODO)") );
334
335 return NULL;
336 }
337
338 // ----------------------------------------------------------------------------
339 // wxToolBar geometry
340 // ----------------------------------------------------------------------------
341
342 wxRect wxToolBar::GetToolRect(wxToolBarToolBase *toolBase) const
343 {
344 const wxToolBarTool *tool = (wxToolBarTool *)toolBase;
345
346 wxRect rect;
347
348 wxCHECK_MSG( tool, rect, _T("GetToolRect: NULL tool") );
349
350 // ensure that we always have the valid tool position
351 if ( m_needsLayout )
352 {
353 wxConstCast(this, wxToolBar)->DoLayout();
354 }
355
356 rect.x = tool->m_x - m_xMargin;
357 rect.y = tool->m_y - m_yMargin;
358
359 if ( IsVertical() )
360 {
361 rect.width = m_defaultWidth;
362 rect.height = tool->IsSeparator() ? m_widthSeparator : m_defaultHeight;
363 }
364 else // horizontal
365 {
366 rect.width = tool->IsSeparator() ? m_widthSeparator : m_defaultWidth;
367 rect.height = m_defaultHeight;
368 }
369
370 rect.width += 2*m_xMargin;
371 rect.height += 2*m_yMargin;
372
373 return rect;
374 }
375
376 bool wxToolBar::Realize()
377 {
378 if ( !wxToolBarBase::Realize() )
379 return FALSE;
380
381 m_needsLayout = TRUE;
382 DoLayout();
383
384 SetBestSize(wxDefaultSize);
385
386 return TRUE;
387 }
388
389 void wxToolBar::DoLayout()
390 {
391 wxASSERT_MSG( m_needsLayout, _T("why are we called?") );
392
393 m_needsLayout = FALSE;
394
395 wxCoord x = m_xMargin,
396 y = m_yMargin;
397
398 const wxCoord widthTool = IsVertical() ? m_defaultHeight : m_defaultWidth;
399 wxCoord margin = IsVertical() ? m_xMargin : m_yMargin,
400 *pCur = IsVertical() ? &y : &x;
401
402 // calculate the positions of all elements
403 for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
404 node;
405 node = node->GetNext() )
406 {
407 wxToolBarTool *tool = (wxToolBarTool *) node->GetData();
408
409 tool->m_x = x;
410 tool->m_y = y;
411
412 // TODO ugly number fiddling
413 *pCur += ( tool->IsSeparator() ? m_widthSeparator : (widthTool+2) ) + margin;
414 }
415
416 // calculate the total toolbar size
417 wxCoord xMin = m_defaultWidth + 2*m_xMargin,
418 yMin = m_defaultHeight + 2*m_yMargin;
419
420 m_maxWidth = x < xMin ? xMin : x;
421 m_maxHeight = y < yMin ? yMin : y;
422 }
423
424 wxSize wxToolBar::DoGetBestClientSize() const
425 {
426 return wxSize(m_maxWidth, m_maxHeight);
427 }
428
429 void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
430 {
431 int old_width, old_height;
432 GetSize(&old_width, &old_height);
433
434 wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
435
436 // Correct width and height if needed.
437 if ( width == -1 || height == -1 )
438 {
439 int tmp_width, tmp_height;
440 GetSize(&tmp_width, &tmp_height);
441
442 if ( width == -1 )
443 width = tmp_width;
444 if ( height == -1 )
445 height = tmp_height;
446 }
447
448 // We must refresh the frame size when the toolbar changes size
449 // otherwise the toolbar can be shown incorrectly
450 if ( old_width != width || old_height != height )
451 {
452 // But before we send the size event check it
453 // we have a frame that is not being deleted.
454 wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
455 if ( frame && !frame->IsBeingDeleted() )
456 {
457 frame->SendSizeEvent();
458 }
459 }
460 }
461
462 // ----------------------------------------------------------------------------
463 // wxToolBar drawing
464 // ----------------------------------------------------------------------------
465
466 void wxToolBar::RefreshTool(wxToolBarToolBase *tool)
467 {
468 RefreshRect(GetToolRect(tool));
469 }
470
471 void wxToolBar::GetRectLimits(const wxRect& rect,
472 wxCoord *start,
473 wxCoord *end) const
474 {
475 wxCHECK_RET( start && end, _T("NULL pointer in GetRectLimits") );
476
477 if ( IsVertical() )
478 {
479 *start = rect.GetTop();
480 *end = rect.GetBottom();
481 }
482 else // horizontal
483 {
484 *start = rect.GetLeft();
485 *end = rect.GetRight();
486 }
487 }
488
489 void wxToolBar::DoDraw(wxControlRenderer *renderer)
490 {
491 // prepare the variables used below
492 wxDC& dc = renderer->GetDC();
493 wxRenderer *rend = renderer->GetRenderer();
494 // dc.SetFont(GetFont()); -- uncomment when we support labels
495
496 // draw the border separating us from the menubar (if there is no menubar
497 // we probably shouldn't draw it?)
498 if ( !IsVertical() )
499 {
500 rend->DrawHorizontalLine(dc, 0, 0, GetClientSize().x);
501 }
502
503 // get the update rect and its limits depending on the orientation
504 wxRect rectUpdate = GetUpdateClientRect();
505 wxCoord start, end;
506 GetRectLimits(rectUpdate, &start, &end);
507
508 // and redraw all the tools intersecting it
509 for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
510 node;
511 node = node->GetNext() )
512 {
513 wxToolBarTool *tool = (wxToolBarTool*) node->GetData();
514 wxRect rectTool = GetToolRect(tool);
515 wxCoord startTool, endTool;
516 GetRectLimits(rectTool, &startTool, &endTool);
517
518 if ( endTool < start )
519 {
520 // we're still to the left of the area to redraw
521 continue;
522 }
523
524 if ( startTool > end )
525 {
526 // we're beyond the area to redraw, nothing left to do
527 break;
528 }
529
530 if (tool->IsSeparator() && !HasFlag(wxTB_FLAT))
531 {
532 // Draw seperators only in flat mode
533 continue;
534 }
535
536 // deal with the flags
537 int flags = 0;
538
539 if ( tool->IsEnabled() )
540 {
541 // The toolbars without wxTB_FLAT don't react to the mouse hovering
542 if ( !HasFlag(wxTB_FLAT) || tool->IsUnderMouse() )
543 flags |= wxCONTROL_CURRENT;
544 }
545 else // disabled tool
546 {
547 flags |= wxCONTROL_DISABLED;
548 }
549
550 //if ( tool == m_toolCaptured )
551 // flags |= wxCONTROL_FOCUSED;
552
553 if ( tool->IsPressed() )
554 flags = wxCONTROL_PRESSED;
555
556 wxString label;
557 wxBitmap bitmap;
558 if ( !tool->IsSeparator() )
559 {
560 // label = tool->GetLabel();
561 bitmap = tool->GetBitmap();
562 }
563 //else: leave both the label and the bitmap invalid to draw a separator
564
565 rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags);
566 }
567 }
568
569 // ----------------------------------------------------------------------------
570 // wxToolBar actions
571 // ----------------------------------------------------------------------------
572
573 bool wxToolBar::PerformAction(const wxControlAction& action,
574 long numArg,
575 const wxString& strArg)
576 {
577 wxToolBarTool *tool = (wxToolBarTool*) FindById(numArg);
578
579 if ( action == wxACTION_TOOLBAR_TOGGLE )
580 {
581 PerformAction( wxACTION_BUTTON_RELEASE, numArg );
582
583 PerformAction( wxACTION_BUTTON_CLICK, numArg );
584 }
585 else if ( action == wxACTION_TOOLBAR_PRESS )
586 {
587 wxLogTrace(_T("toolbar"), _T("Button '%s' pressed."), tool->GetShortHelp().c_str());
588
589 tool->Invert();
590
591 RefreshTool( tool );
592 }
593 else if ( action == wxACTION_TOOLBAR_RELEASE )
594 {
595 wxLogTrace(_T("toolbar"), _T("Button '%s' released."), tool->GetShortHelp().c_str());
596
597 wxASSERT_MSG( tool->IsInverted(), _T("release unpressed button?") );
598
599 tool->Invert();
600
601 RefreshTool( tool );
602 }
603 else if ( action == wxACTION_TOOLBAR_CLICK )
604 {
605 bool isToggled;
606 if ( tool->CanBeToggled() )
607 {
608 tool->Toggle();
609
610 RefreshTool( tool );
611
612 isToggled = tool->IsToggled();
613 }
614 else // simple non-checkable tool
615 {
616 isToggled = FALSE;
617 }
618 OnLeftClick( tool->GetId(), isToggled );
619 }
620 else if ( action == wxACTION_TOOLBAR_ENTER )
621 {
622 wxCHECK_MSG( tool, FALSE, _T("no tool to enter?") );
623
624 if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
625 {
626 tool->SetUnderMouse( TRUE );
627
628 if ( !tool->IsToggled() )
629 RefreshTool( tool );
630 }
631 }
632 else if ( action == wxACTION_TOOLBAR_LEAVE )
633 {
634 wxCHECK_MSG( tool, FALSE, _T("no tool to leave?") );
635
636 if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
637 {
638 tool->SetUnderMouse( FALSE );
639
640 if ( !tool->IsToggled() )
641 RefreshTool( tool );
642 }
643 }
644 else
645 return wxControl::PerformAction(action, numArg, strArg);
646
647 return TRUE;
648 }
649
650 // ============================================================================
651 // wxStdToolbarInputHandler implementation
652 // ============================================================================
653
654 wxStdToolbarInputHandler::wxStdToolbarInputHandler(wxInputHandler *handler)
655 : wxStdInputHandler(handler)
656 {
657 m_winCapture = NULL;
658 m_toolCapture = NULL;
659 m_toolLast = NULL;
660 }
661
662 bool wxStdToolbarInputHandler::HandleKey(wxInputConsumer *consumer,
663 const wxKeyEvent& event,
664 bool pressed)
665 {
666 // TODO: when we have a current button we should allow the arrow
667 // keys to move it
668 return wxStdInputHandler::HandleKey(consumer, event, pressed);
669 }
670
671 bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer,
672 const wxMouseEvent& event)
673 {
674 wxToolBar *tbar = wxStaticCast(consumer->GetInputWindow(), wxToolBar);
675 wxToolBarToolBase *tool = tbar->FindToolForPosition(event.GetX(), event.GetY());
676
677 if ( event.Button(1) )
678 {
679
680 if ( event.LeftDown() || event.LeftDClick() )
681 {
682 if ( !tool || !tool->IsEnabled() )
683 return TRUE;
684
685 m_winCapture = tbar;
686 m_winCapture->CaptureMouse();
687
688 m_toolCapture = tool;
689
690 consumer->PerformAction( wxACTION_BUTTON_PRESS, tool->GetId() );
691
692 return TRUE;
693 }
694 else if ( event.LeftUp() )
695 {
696 if ( m_winCapture )
697 {
698 m_winCapture->ReleaseMouse();
699 m_winCapture = NULL;
700 }
701
702 if (m_toolCapture)
703 {
704 if ( tool == m_toolCapture )
705 consumer->PerformAction( wxACTION_BUTTON_TOGGLE, m_toolCapture->GetId() );
706 else
707 consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
708 }
709
710 m_toolCapture = NULL;
711
712 return TRUE;
713 }
714 //else: don't do anything special about the double click
715 }
716
717 return wxStdInputHandler::HandleMouse(consumer, event);
718 }
719
720 bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
721 const wxMouseEvent& event)
722 {
723 if ( !wxStdInputHandler::HandleMouseMove(consumer, event) )
724 {
725 wxToolBar *tbar = wxStaticCast(consumer->GetInputWindow(), wxToolBar);
726
727 wxToolBarTool *tool;
728 if ( event.Leaving() )
729 {
730 // We cannot possibly be over a tool when
731 // leaving the toolbar
732 tool = NULL;
733 }
734 else
735 {
736 tool = (wxToolBarTool*) tbar->FindToolForPosition( event.GetX(), event.GetY() );
737 }
738
739 if (m_toolCapture)
740 {
741 // During capture we only care of the captured tool
742 if (tool && (tool != m_toolCapture))
743 tool = NULL;
744
745 if (tool == m_toolLast)
746 return TRUE;
747
748 if (tool)
749 consumer->PerformAction( wxACTION_BUTTON_PRESS, m_toolCapture->GetId() );
750 else
751 consumer->PerformAction( wxACTION_BUTTON_RELEASE, m_toolCapture->GetId() );
752
753 m_toolLast = tool;
754 }
755 else
756 {
757 if (tool == m_toolLast)
758 return TRUE;
759
760 if (m_toolLast)
761 {
762 // Leave old tool if any
763 consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolLast->GetId() );
764 }
765
766 if (tool)
767 {
768 // Enter new tool if any
769 consumer->PerformAction( wxACTION_TOOLBAR_ENTER, tool->GetId() );
770 }
771
772 m_toolLast = tool;
773 }
774
775 return TRUE;
776 }
777
778 return FALSE;
779 }
780
781 bool wxStdToolbarInputHandler::HandleFocus(wxInputConsumer *consumer,
782 const wxFocusEvent& event)
783 {
784 if (m_toolCapture)
785 {
786 // We shouldn't be left with a highlighted button
787 consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
788 }
789
790 return TRUE;
791 }
792
793 bool wxStdToolbarInputHandler::HandleActivation(wxInputConsumer *consumer,
794 bool activated)
795 {
796 if (m_toolCapture && !activated)
797 {
798 // We shouldn't be left with a highlighted button
799 consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
800 }
801
802 return TRUE;
803 }
804
805 #endif // wxUSE_TOOLBAR
806