]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/toolbar.cpp
setting up correct port origin as well
[wxWidgets.git] / src / mac / carbon / toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: toolbar.cpp
3 // Purpose: wxToolBar
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: The wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "toolbar.h"
14 #endif
15
16 #include "wx/wxprec.h"
17
18 #if wxUSE_TOOLBAR
19
20 #include "wx/wx.h"
21 #include "wx/toolbar.h"
22 #include "wx/notebook.h"
23 #include "wx/tabctrl.h"
24 #include "wx/bitmap.h"
25
26 #if !USE_SHARED_LIBRARY
27 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
28
29 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
30 EVT_PAINT( wxToolBar::OnPaint )
31 END_EVENT_TABLE()
32 #endif
33
34 #include "wx/mac/uma.h"
35 #include "wx/geometry.h"
36
37 #ifdef __WXMAC_OSX__
38 const short kwxMacToolBarToolDefaultWidth = 24 ;
39 const short kwxMacToolBarToolDefaultHeight = 24 ;
40 const short kwxMacToolBarTopMargin = 4 ;
41 const short kwxMacToolBarLeftMargin = 4 ;
42 const short kwxMacToolBorder = 0 ;
43 const short kwxMacToolSpacing = 6 ;
44 #else
45 const short kwxMacToolBarToolDefaultWidth = 24 ;
46 const short kwxMacToolBarToolDefaultHeight = 22 ;
47 const short kwxMacToolBarTopMargin = 2 ;
48 const short kwxMacToolBarLeftMargin = 2 ;
49 const short kwxMacToolBorder = 4 ;
50 const short kwxMacToolSpacing = 0 ;
51 #endif
52
53 // ----------------------------------------------------------------------------
54 // private classes
55 // ----------------------------------------------------------------------------
56
57 class 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
70 wxToolBarTool(wxToolBar *tbar, wxControl *control)
71 : wxToolBarToolBase(tbar, control)
72 {
73 Init() ;
74 }
75
76 ~wxToolBarTool()
77 {
78 if ( m_controlHandle )
79 DisposeControl( m_controlHandle ) ;
80 }
81
82 WXWidget GetControlHandle() { return (WXWidget) m_controlHandle ; }
83 void SetControlHandle( ControlRef handle ) { m_controlHandle = handle ; }
84
85 void SetSize(const wxSize& size) ;
86 void SetPosition( const wxPoint& position ) ;
87
88 wxSize GetSize() const
89 {
90 if ( IsControl() )
91 {
92 return GetControl()->GetSize() ;
93 }
94 else if ( IsButton() )
95 {
96 return GetToolBar()->GetToolSize() ;
97 }
98 else
99 {
100 // separator size
101 wxSize sz = GetToolBar()->GetToolSize() ;
102 sz.x /= 4 ;
103 sz.y /= 4 ;
104 return sz ;
105 }
106 }
107 wxPoint GetPosition() const
108 {
109 return wxPoint(m_x, m_y);
110 }
111 bool DoEnable( bool enable ) ;
112
113 void UpdateToggleImage( bool toggle ) ;
114 private :
115 void Init()
116 {
117 m_controlHandle = NULL ;
118 }
119 ControlRef m_controlHandle ;
120
121 wxCoord m_x;
122 wxCoord m_y;
123 };
124
125 static const EventTypeSpec eventList[] =
126 {
127 { kEventClassControl , kEventControlHit } ,
128 #ifdef __WXMAC_OSX__
129 { kEventClassControl , kEventControlHitTest } ,
130 #endif
131 } ;
132
133 static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
134 {
135 OSStatus result = eventNotHandledErr ;
136
137 wxMacCarbonEvent cEvent( event ) ;
138
139 ControlRef controlRef ;
140
141 cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
142
143 switch( GetEventKind( event ) )
144 {
145 case kEventControlHit :
146 {
147 wxToolBarTool* tbartool = (wxToolBarTool*)data ;
148 if ( tbartool->CanBeToggled() )
149 {
150 ((wxToolBar*)tbartool->GetToolBar())->ToggleTool(tbartool->GetId(), GetControl32BitValue((ControlRef)tbartool->GetControlHandle()));
151 }
152 ((wxToolBar*)tbartool->GetToolBar())->OnLeftClick( tbartool->GetId() , tbartool -> IsToggled() ) ;
153 result = noErr;
154 }
155 break ;
156 #ifdef __WXMAC_OSX__
157 case kEventControlHitTest :
158 {
159 HIPoint pt = cEvent.GetParameter<HIPoint>(kEventParamMouseLocation) ;
160 HIRect rect ;
161 HIViewGetBounds( controlRef , &rect ) ;
162
163 ControlPartCode pc = kControlNoPart ;
164 if ( CGRectContainsPoint( rect , pt ) )
165 pc = kControlButtonPart ;
166 cEvent.SetParameter( kEventParamControlPart , typeControlPartCode, pc ) ;
167 result = noErr ;
168 }
169 break ;
170 #endif
171 default :
172 break ;
173 }
174 return result ;
175 }
176
177 pascal OSStatus wxMacToolBarToolEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
178 {
179 OSStatus result = eventNotHandledErr ;
180
181 switch ( GetEventClass( event ) )
182 {
183 case kEventClassControl :
184 result = wxMacToolBarToolControlEventHandler( handler, event, data ) ;
185 break ;
186 default :
187 break ;
188 }
189 return result ;
190 }
191
192 DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler )
193
194 // ============================================================================
195 // implementation
196 // ============================================================================
197
198 // ----------------------------------------------------------------------------
199 // wxToolBarTool
200 // ----------------------------------------------------------------------------
201
202 bool wxToolBarTool::DoEnable(bool enable)
203 {
204 if ( IsControl() )
205 {
206 GetControl()->Enable( enable ) ;
207 }
208 else if ( IsButton() )
209 {
210 #if TARGET_API_MAC_OSX
211 if ( enable )
212 EnableControl( m_controlHandle ) ;
213 else
214 DisableControl( m_controlHandle ) ;
215 #else
216 if ( enable )
217 ActivateControl( m_controlHandle ) ;
218 else
219 DeactivateControl( m_controlHandle ) ;
220 #endif
221 }
222 return true ;
223 }
224 void wxToolBarTool::SetSize(const wxSize& size)
225 {
226 if ( IsControl() )
227 {
228 GetControl()->SetSize( size ) ;
229 }
230 }
231
232 void wxToolBarTool::SetPosition(const wxPoint& position)
233 {
234 m_x = position.x;
235 m_y = position.y;
236
237 if ( IsButton() )
238 {
239 int x , y ;
240 x = y = 0 ;
241 int mac_x = position.x ;
242 int mac_y = position.y ;
243 #ifdef __WXMAC_OSX__
244 // already correctly set up
245 #else
246 WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetTopLevelWindowRef() ;
247 GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
248 mac_x += x;
249 mac_y += y;
250 #endif
251 Rect contrlRect ;
252 GetControlBounds( m_controlHandle , &contrlRect ) ;
253 int former_mac_x = contrlRect.left ;
254 int former_mac_y = contrlRect.top ;
255 GetToolBar()->GetToolSize() ;
256
257 if ( mac_x != former_mac_x || mac_y != former_mac_y )
258 {
259 UMAMoveControl( m_controlHandle , mac_x , mac_y ) ;
260 }
261 }
262 else if ( IsControl() )
263 {
264 GetControl()->Move( position ) ;
265 }
266 else
267 {
268 // separator
269 #ifdef __WXMAC_OSX__
270 int x , y ;
271 x = y = 0 ;
272 int mac_x = position.x ;
273 int mac_y = position.y ;
274
275 Rect contrlRect ;
276 GetControlBounds( m_controlHandle , &contrlRect ) ;
277 int former_mac_x = contrlRect.left ;
278 int former_mac_y = contrlRect.top ;
279
280 if ( mac_x != former_mac_x || mac_y != former_mac_y )
281 {
282 UMAMoveControl( m_controlHandle , mac_x , mac_y ) ;
283 }
284 #endif
285 }
286 }
287
288 void wxToolBarTool::UpdateToggleImage( bool toggle )
289 {
290 #ifdef __WXMAC_OSX__
291 if ( toggle )
292 {
293 int w = m_bmpNormal.GetWidth() ;
294 int h = m_bmpNormal.GetHeight() ;
295 wxBitmap bmp( w , h ) ;
296 wxMemoryDC dc ;
297 dc.SelectObject( bmp ) ;
298 dc.SetPen( wxNullPen ) ;
299 dc.SetBackground( *wxWHITE ) ;
300 dc.DrawRectangle( 0 , 0 , w , h ) ;
301 dc.DrawBitmap( m_bmpNormal , 0 , 0 , true) ;
302 dc.SelectObject( wxNullBitmap ) ;
303 ControlButtonContentInfo info ;
304 wxMacCreateBitmapButton( &info , bmp ) ;
305 SetControlData( m_controlHandle , 0, kControlIconContentTag, sizeof( info ),
306 (Ptr)&info );
307 wxMacReleaseBitmapButton( &info ) ;
308 }
309 else
310 {
311 ControlButtonContentInfo info ;
312 wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
313 SetControlData( m_controlHandle , 0, kControlIconContentTag, sizeof( info ),
314 (Ptr)&info );
315 wxMacReleaseBitmapButton( &info ) ;
316 }
317
318 IconTransformType transform = toggle ? kTransformSelected : kTransformNone ;
319 SetControlData( m_controlHandle, 0, kControlIconTransformTag, sizeof( transform ),
320 (Ptr)&transform );
321 HIViewSetNeedsDisplay( m_controlHandle , true ) ;
322
323 #else
324 ::SetControl32BitValue( m_controlHandle , toggle ) ;
325 #endif
326 }
327
328 wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
329 int id,
330 const wxString& label,
331 const wxBitmap& bmpNormal,
332 const wxBitmap& bmpDisabled,
333 wxItemKind kind,
334 wxObject *clientData,
335 const wxString& shortHelp,
336 const wxString& longHelp)
337 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
338 clientData, shortHelp, longHelp)
339 {
340 Init();
341
342 WindowRef window = (WindowRef) tbar->MacGetTopLevelWindowRef() ;
343 wxSize toolSize = tbar->GetToolSize() ;
344 Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
345
346 if ( id == wxID_SEPARATOR )
347 {
348 toolSize.x /= 4 ;
349 toolSize.y /= 4 ;
350 if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
351 {
352 toolrect.bottom = toolSize.y ;
353 }
354 else
355 {
356 toolrect.right = toolSize.x ;
357 }
358 #ifdef __WXMAC_OSX__
359 // in flat style we need a visual separator
360 CreateSeparatorControl( window , &toolrect , &m_controlHandle ) ;
361 #endif
362 }
363 else
364 {
365 ControlButtonContentInfo info ;
366 wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
367
368 #ifdef __WXMAC_OSX__
369 CreateIconControl( window , &toolrect , &info , false , &m_controlHandle ) ;
370 #else
371 SInt16 behaviour = kControlBehaviorOffsetContents ;
372 if ( CanBeToggled() )
373 behaviour += kControlBehaviorToggles ;
374 CreateBevelButtonControl( window , &toolrect , CFSTR("") , kControlBevelButtonNormalBevel , behaviour , &info ,
375 0 , 0 , 0 , &m_controlHandle ) ;
376 #endif
377
378 wxMacReleaseBitmapButton( &info ) ;
379 /*
380 SetBevelButtonTextPlacement( m_controlHandle , kControlBevelButtonPlaceBelowGraphic ) ;
381 UMASetControlTitle( m_controlHandle , label , wxFont::GetDefaultEncoding() ) ;
382 */
383
384 InstallControlEventHandler( (ControlRef) m_controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
385 GetEventTypeCount(eventList), eventList, this,NULL);
386
387 }
388 ControlRef container = (ControlRef) tbar->GetHandle() ;
389 wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
390 if ( m_controlHandle )
391 {
392 UMAShowControl( m_controlHandle ) ;
393 ::EmbedControl( m_controlHandle , container ) ;
394 }
395 if ( CanBeToggled() && IsToggled() )
396 {
397 UpdateToggleImage( true ) ;
398 }
399 }
400
401
402 wxToolBarToolBase *wxToolBar::CreateTool(int id,
403 const wxString& label,
404 const wxBitmap& bmpNormal,
405 const wxBitmap& bmpDisabled,
406 wxItemKind kind,
407 wxObject *clientData,
408 const wxString& shortHelp,
409 const wxString& longHelp)
410 {
411 return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
412 clientData, shortHelp, longHelp);
413 }
414
415 wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
416 {
417 return new wxToolBarTool(this, control);
418 }
419
420 void wxToolBar::Init()
421 {
422 m_maxWidth = -1;
423 m_maxHeight = -1;
424 m_defaultWidth = kwxMacToolBarToolDefaultWidth;
425 m_defaultHeight = kwxMacToolBarToolDefaultHeight;
426 }
427
428 bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
429 long style, const wxString& name)
430 {
431
432 if ( !wxToolBarBase::Create( parent , id , pos , size , style ) )
433 return FALSE ;
434
435 return TRUE;
436 }
437
438 wxToolBar::~wxToolBar()
439 {
440 // we must refresh the frame size when the toolbar is deleted but the frame
441 // is not - otherwise toolbar leaves a hole in the place it used to occupy
442 }
443
444 bool wxToolBar::Realize()
445 {
446 if (m_tools.GetCount() == 0)
447 return FALSE;
448
449 int x = m_xMargin + kwxMacToolBarLeftMargin ;
450 int y = m_yMargin + kwxMacToolBarTopMargin ;
451
452 int tw, th;
453 GetSize(& tw, & th);
454
455 int maxWidth = 0 ;
456 int maxHeight = 0 ;
457
458 int maxToolWidth = 0;
459 int maxToolHeight = 0;
460
461 // Find the maximum tool width and height
462 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
463 while ( node )
464 {
465 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
466 wxSize sz = tool->GetSize() ;
467
468 if ( sz.x > maxToolWidth )
469 maxToolWidth = sz.x ;
470 if (sz.y> maxToolHeight)
471 maxToolHeight = sz.y;
472
473 node = node->GetNext();
474 }
475
476 bool lastWasRadio = FALSE;
477 node = m_tools.GetFirst();
478 while (node)
479 {
480 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
481 wxSize cursize = tool->GetSize() ;
482
483 bool isRadio = FALSE;
484
485 if ( tool->IsButton() && tool->GetKind() == wxITEM_RADIO )
486 {
487 if ( !lastWasRadio )
488 {
489 if (tool->Toggle(true))
490 {
491 DoToggleTool(tool, true);
492 }
493 }
494 isRadio = TRUE;
495 }
496 else
497 {
498 isRadio = FALSE;
499 }
500 lastWasRadio = isRadio;
501
502 // for the moment we just do a single row/column alignement
503 if ( x + cursize.x > maxWidth )
504 maxWidth = x + cursize.x ;
505 if ( y + cursize.y > maxHeight )
506 maxHeight = y + cursize.y ;
507
508 if ( GetWindowStyleFlag() & wxTB_VERTICAL )
509 {
510 int x1 = x + (maxToolWidth - cursize.x)/2 ;
511 tool->SetPosition( wxPoint( x1 , y ) ) ;
512 }
513 else
514 {
515 int y1 = y + (maxToolHeight - cursize.y)/2 ;
516 tool->SetPosition( wxPoint( x , y1 ) ) ;
517 }
518 if ( GetWindowStyleFlag() & wxTB_VERTICAL )
519 {
520 y += cursize.y ;
521 y += kwxMacToolSpacing ;
522 }
523 else
524 {
525 x += cursize.x ;
526 x += kwxMacToolSpacing ;
527 }
528
529 node = node->GetNext();
530 }
531
532 if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
533 {
534 if ( m_maxRows == 0 )
535 {
536 // if not set yet, only one row
537 SetRows(1);
538 }
539 m_minWidth = maxWidth;
540 maxWidth = tw ;
541 maxHeight += m_yMargin + kwxMacToolBarTopMargin;
542 m_minHeight = m_maxHeight = maxHeight ;
543 }
544 else
545 {
546 if ( GetToolsCount() > 0 && m_maxRows == 0 )
547 {
548 // if not set yet, have one column
549 SetRows(GetToolsCount());
550 }
551 m_minHeight = maxHeight;
552 maxHeight = th ;
553 maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
554 m_minWidth = m_maxWidth = maxWidth ;
555 }
556
557 SetSize( maxWidth, maxHeight );
558 InvalidateBestSize();
559
560 return TRUE;
561 }
562
563 void wxToolBar::SetToolBitmapSize(const wxSize& size)
564 {
565 m_defaultWidth = size.x+kwxMacToolBorder; m_defaultHeight = size.y+kwxMacToolBorder;
566 }
567
568 // The button size is bigger than the bitmap size
569 wxSize wxToolBar::GetToolSize() const
570 {
571 return wxSize(m_defaultWidth + kwxMacToolBorder, m_defaultHeight + kwxMacToolBorder);
572 }
573
574 void wxToolBar::SetRows(int nRows)
575 {
576 if ( nRows == m_maxRows )
577 {
578 // avoid resizing the frame uselessly
579 return;
580 }
581
582 m_maxRows = nRows;
583 }
584
585 void wxToolBar::MacSuperChangedPosition()
586 {
587 wxWindow::MacSuperChangedPosition() ;
588 Realize() ;
589 }
590
591 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
592 {
593 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
594 while (node)
595 {
596 wxToolBarTool *tool = (wxToolBarTool *)node->GetData() ;
597 wxRect2DInt r( tool->GetPosition() , tool->GetSize() ) ;
598 if ( r.Contains( wxPoint( x , y ) ) )
599 {
600 return tool;
601 }
602
603 node = node->GetNext();
604 }
605
606 return (wxToolBarToolBase *)NULL;
607 }
608
609 wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
610 {
611 wxToolBarToolBase* tool = FindToolForPosition( pt.x , pt.y ) ;
612 if ( tool )
613 {
614 return tool->GetShortHelp() ;
615 }
616 return wxEmptyString ;
617 }
618
619 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
620 {
621 ((wxToolBarTool*)t)->DoEnable( enable ) ;
622 }
623
624 void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
625 {
626 wxToolBarTool *tool = (wxToolBarTool *)t;
627 if ( tool->IsButton() )
628 {
629 tool->UpdateToggleImage( toggle ) ;
630 }
631 }
632
633 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
634 wxToolBarToolBase *tool)
635 {
636 // nothing special to do here - we relayout in Realize() later
637 tool->Attach(this);
638 InvalidateBestSize();
639
640 return TRUE;
641 }
642
643 void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
644 {
645 wxFAIL_MSG( _T("not implemented") );
646 }
647
648 bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
649 {
650 wxToolBarToolsList::compatibility_iterator node;
651 for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
652 {
653 wxToolBarToolBase *tool2 = node->GetData();
654 if ( tool2 == tool )
655 {
656 // let node point to the next node in the list
657 node = node->GetNext();
658
659 break;
660 }
661 }
662
663 wxSize sz = ((wxToolBarTool*)tool)->GetSize() ;
664
665 tool->Detach();
666
667 // and finally reposition all the controls after this one
668
669 for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
670 {
671 wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
672 wxPoint pt = tool2->GetPosition() ;
673
674 if ( GetWindowStyleFlag() & wxTB_VERTICAL )
675 {
676 pt.y -= sz.y ;
677 }
678 else
679 {
680 pt.x -= sz.x ;
681 }
682 tool2->SetPosition( pt ) ;
683 }
684
685 InvalidateBestSize();
686 return TRUE ;
687 }
688
689 void wxToolBar::OnPaint(wxPaintEvent& event)
690 {
691 wxPaintDC dc(this) ;
692 #if wxMAC_USE_CORE_GRAPHICS
693 // leave the background as it is (striped or metal)
694 #else
695 wxMacPortSetter helper(&dc) ;
696 int w, h ;
697 GetSize( &w , &h ) ;
698
699 Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
700 dc.YLOG2DEVMAC(h) , dc.XLOG2DEVMAC(w) } ;
701 /*
702 if( toolbarrect.left < 0 )
703 toolbarrect.left = 0 ;
704 if ( toolbarrect.top < 0 )
705 toolbarrect.top = 0 ;
706 */
707 if ( !MacGetTopLevelWindow()->MacGetMetalAppearance() )
708 {
709 UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
710 }
711 else
712 {
713 #if TARGET_API_MAC_OSX
714 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
715 if ( UMAGetSystemVersion() >= 0x1030 )
716 {
717 HIRect hiToolbarrect = CGRectMake( dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
718 dc.YLOG2DEVREL(h) , dc.XLOG2DEVREL(w) );
719 CGContextRef cgContext ;
720 Rect bounds ;
721 GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
722 QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
723 CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
724 CGContextScaleCTM( cgContext , 1 , -1 ) ;
725
726 {
727 HIThemeBackgroundDrawInfo drawInfo ;
728 drawInfo.version = 0 ;
729 drawInfo.state = kThemeStateActive ;
730 drawInfo.kind = kThemeBackgroundMetal ;
731 HIThemeApplyBackground( &hiToolbarrect, &drawInfo , cgContext,kHIThemeOrientationNormal) ;
732 }
733 QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
734 }
735 else
736 #endif
737 {
738 UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
739 }
740 #endif
741 }
742 #endif
743
744 event.Skip() ;
745 }
746
747 #endif // wxUSE_TOOLBAR
748