]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/toolbar.cpp
Undo the Test commit
[wxWidgets.git] / src / mac / carbon / toolbar.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: toolbar.cpp
3// Purpose: wxToolBar
4// Author: AUTHOR
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
2f1ae414 8// Copyright: (c) AUTHORy
e9576ca5
SC
9/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "toolbar.h"
13#endif
14
15#include "wx/wx.h"
519cb848
SC
16
17#if wxUSE_TOOLBAR
18
e9576ca5 19#include "wx/toolbar.h"
2f1ae414
SC
20#include "wx/notebook.h"
21#include "wx/tabctrl.h"
e9576ca5 22
2f1ae414 23#if !USE_SHARED_LIBRARY
12ed316d 24IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
e9576ca5
SC
25
26BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
2f1ae414
SC
27 EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
28 EVT_PAINT( wxToolBar::OnPaint )
e9576ca5 29END_EVENT_TABLE()
2f1ae414 30#endif
e9576ca5 31
519cb848
SC
32#include <wx/mac/uma.h>
33
37e2cb08
SC
34// ----------------------------------------------------------------------------
35// private classes
36// ----------------------------------------------------------------------------
37
38class wxToolBarTool : public wxToolBarToolBase
39{
40public:
41 wxToolBarTool(wxToolBar *tbar,
42 int id,
43 const wxBitmap& bitmap1,
44 const wxBitmap& bitmap2,
45 bool toggle,
46 wxObject *clientData,
47 const wxString& shortHelpString,
48 const wxString& longHelpString)
49 : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle,
50 clientData, shortHelpString, longHelpString)
51 {
52 m_nSepCount = 0;
2f1ae414 53 m_index = -1 ;
37e2cb08
SC
54 }
55
56 wxToolBarTool(wxToolBar *tbar, wxControl *control)
57 : wxToolBarToolBase(tbar, control)
58 {
59 m_nSepCount = 1;
2f1ae414 60 m_index = -1 ;
37e2cb08
SC
61 }
62
63 // set/get the number of separators which we use to cover the space used by
64 // a control in the toolbar
65 void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
66 size_t GetSeparatorsCount() const { return m_nSepCount; }
67
68 int m_index ;
69private:
70 size_t m_nSepCount;
71};
72
73
74// ============================================================================
75// implementation
76// ============================================================================
77
78// ----------------------------------------------------------------------------
79// wxToolBarTool
80// ----------------------------------------------------------------------------
81
2f1ae414
SC
82const short defwidth = 24 ;
83const short defheight = 22 ;
84
37e2cb08
SC
85wxToolBarToolBase *wxToolBar::CreateTool(int id,
86 const wxBitmap& bitmap1,
87 const wxBitmap& bitmap2,
88 bool toggle,
89 wxObject *clientData,
90 const wxString& shortHelpString,
91 const wxString& longHelpString)
92{
93 return new wxToolBarTool(this, id, bitmap1, bitmap2, toggle,
94 clientData, shortHelpString, longHelpString);
95}
96
97wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
98{
99 return new wxToolBarTool(this, control);
100}
101
37e2cb08 102void wxToolBar::Init()
e9576ca5
SC
103{
104 m_maxWidth = -1;
105 m_maxHeight = -1;
2f1ae414
SC
106 m_defaultWidth = defwidth;
107 m_defaultHeight = defheight;
e9576ca5
SC
108 // TODO
109}
110
111bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
112 long style, const wxString& name)
113{
7c551d95 114 m_maxWidth = m_maxHeight = 0;
519cb848 115
2f1ae414
SC
116 m_defaultWidth = defwidth;
117 m_defaultHeight = defheight;
e9576ca5 118
519cb848
SC
119 int x = pos.x;
120 int y = pos.y;
121 int width = size.x;
122 int height = size.y;
e9576ca5 123
519cb848
SC
124 if (width <= 0)
125 width = 100;
126 if (height <= 0)
127 height = 30;
128 if (x < 0)
129 x = 0;
130 if (y < 0)
131 y = 0;
2f1ae414
SC
132#if 1
133 {
134 SetName(name);
135
136 m_windowStyle = style;
137 parent->AddChild(this);
138
139 m_backgroundColour = parent->GetBackgroundColour() ;
140 m_foregroundColour = parent->GetForegroundColour() ;
141
142 if (id == -1)
143 m_windowId = NewControlId();
144 else
145 m_windowId = id;
146
147 m_width = size.x ;
148 m_height = size.y ;
149 int x = pos.x ;
150 int y = pos.y ;
151 AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
152 m_x = x ;
153 m_y = y ;
154 }
155#else
519cb848
SC
156 Rect bounds ;
157 Str255 title ;
158
2f1ae414 159 MacPreControlCreate( parent , id , "" , wxPoint( x , y ) , wxSize( width , height ) ,style, wxDefaultValidator , name , &bounds , title ) ;
e9576ca5 160
519cb848
SC
161 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
162 kControlPlacardProc , (long) this ) ;
163 MacPostControlCreate() ;
2f1ae414 164#endif
519cb848 165 return TRUE;
e9576ca5
SC
166}
167
168wxToolBar::~wxToolBar()
169{
170 // TODO
171}
172
2f1ae414
SC
173PicHandle MakePict(GWorldPtr wp, GWorldPtr mask ) ;
174PicHandle MakePict(GWorldPtr wp, GWorldPtr mask )
519cb848
SC
175{
176 CGrafPtr origPort ;
177 GDHandle origDev ;
178
179 PicHandle pict; // this is the Picture we give back
180
181 RGBColor gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
2f1ae414
SC
182 RGBColor white = { 0xffff ,0xffff , 0xffff } ;
183 RGBColor black = { 0x0000 ,0x0000 , 0x0000 } ;
519cb848 184
2f1ae414
SC
185 unsigned char *maskimage = NULL ;
186 Rect portRect ;
187 GetPortBounds( wp , &portRect ) ;
188 int width = portRect.right - portRect.left ;
189 int height = portRect.bottom - portRect.top ;
519cb848 190
2f1ae414
SC
191 LockPixels( GetGWorldPixMap( wp ) ) ;
192 GetGWorld( &origPort , &origDev ) ;
519cb848 193
2f1ae414
SC
194 if ( mask )
195 {
196
197 maskimage = (unsigned char*) malloc( width * height ) ;
198 SetGWorld( mask , NULL ) ;
199 LockPixels( GetGWorldPixMap( mask ) ) ;
200 for ( int y = 0 ; y < height ; ++y )
201 {
202 for( int x = 0 ; x < width ; ++x )
203 {
204 RGBColor col ;
205
206 GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
207 maskimage[y*width + x] = ( col.red == 0 ) ; // for monochrome masks
208 }
209 }
210 UnlockPixels( GetGWorldPixMap( mask ) ) ;
211 }
519cb848 212
519cb848
SC
213 SetGWorld( wp , NULL ) ;
214
2f1ae414 215 pict = OpenPicture(&portRect); // open a picture, this disables drawing
519cb848
SC
216 if(!pict)
217 return NULL;
2f1ae414
SC
218
219 RGBBackColor( &gray ) ;
220 RGBForeColor( &black ) ;
221 EraseRect(&portRect) ;
519cb848 222 RGBBackColor( &white ) ;
2f1ae414
SC
223
224 if ( maskimage )
225 {
226 for ( int y = 0 ; y < height ; ++y )
227 {
228 for( int x = 0 ; x < width ; ++x )
229 {
230 if ( maskimage[y*width + x] )
231 {
232 RGBColor col ;
233
234 GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
235 SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
236 }
237 }
238 }
239 free( maskimage ) ;
240 maskimage = NULL ;
241 }
242 else
243 {
244 CopyBits(GetPortBitMapForCopyBits(wp), // src PixMap - we copy image over itself -
245 GetPortBitMapForCopyBits(wp), // dst PixMap - no drawing occurs -
246 &portRect, // srcRect - it will be recorded and compressed -
247 &portRect, // dstRect - into the picture that is open -
519cb848
SC
248 srcCopy,NULL); // copyMode and no clip region
249
2f1ae414 250 }
519cb848 251 ClosePicture(); // We are done recording the picture
2f1ae414 252 UnlockPixels( GetGWorldPixMap( wp ) ) ;
519cb848
SC
253 SetGWorld( origPort , origDev ) ;
254 return pict; // return our groovy pict handle
255}
256
257const short kwxMacToolBarTopMargin = 2 ;
258const short kwxMacToolBarLeftMargin = 2 ;
259
37e2cb08 260bool wxToolBar::Realize()
e9576ca5 261{
519cb848
SC
262 if (m_tools.Number() == 0)
263 return FALSE;
e9576ca5 264
80645074
SC
265 Point localOrigin ;
266 Rect clipRect ;
267 WindowRef window ;
268 wxWindow *win ;
269
270 MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
271
272 Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
273 m_y + m_height + localOrigin.v , m_x + m_width + localOrigin.h} ;
519cb848 274 ControlFontStyleRec controlstyle ;
80645074 275
519cb848
SC
276 controlstyle.flags = kControlUseFontMask ;
277 controlstyle.font = kControlFontSmallSystemFont ;
278
279 wxNode *node = m_tools.First();
280 int noButtons = 0;
281 int x = 0 ;
7c551d95
SC
282 wxSize toolSize = GetToolSize() ;
283 int tw, th;
284 GetSize(& tw, & th);
519cb848
SC
285 while (node)
286 {
287 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
37e2cb08 288 wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
519cb848 289
2f1ae414 290 if( !tool->IsSeparator() )
519cb848
SC
291 {
292 Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
7c551d95
SC
293 toolrect.right = toolrect.left + toolSize.x ;
294 toolrect.bottom = toolrect.top + toolSize.y ;
519cb848
SC
295
296 PicHandle icon = NULL ;
297 if ( bmap )
298 {
299 if ( bmap->m_bitmapType == kMacBitmapTypePict )
300 icon = bmap->m_hPict ;
301 else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
302 {
2f1ae414
SC
303 if ( tool->GetBitmap1().GetMask() )
304 {
305 icon = MakePict( bmap->m_hBitmap , tool->GetBitmap1().GetMask()->GetMaskBitmap() ) ;
306 }
307 else
308 {
309 icon = MakePict( bmap->m_hBitmap , NULL ) ;
310 }
519cb848
SC
311 }
312 }
313
314 ControlHandle m_macToolHandle ;
2f1ae414 315
8208e181
SC
316 SInt16 behaviour = kControlBehaviorOffsetContents ;
317 if ( tool->CanBeToggled() )
318 behaviour += kControlBehaviorToggles ;
319
519cb848
SC
320 if ( icon )
321 {
322 m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
8208e181 323 behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
519cb848
SC
324 ControlButtonContentInfo info ;
325
326 info.contentType = kControlContentPictHandle ;
327 info.u.picture = icon ;
328
329 UMASetControlData( m_macToolHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
330 }
331 else
332 {
333 m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
8208e181 334 behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
519cb848
SC
335 }
336 m_macToolHandles.Add( m_macToolHandle ) ;
2f1ae414
SC
337 tool->m_index = m_macToolHandles.Count() -1 ;
338 if ( !tool->IsEnabled() )
339 {
340 UMADeactivateControl( m_macToolHandle ) ;
341 }
342 if ( tool->CanBeToggled() && tool->IsToggled() )
343 {
344 ::SetControlValue( m_macToolHandle , 1 ) ;
345 }
519cb848 346 UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
2f1ae414
SC
347 ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
348 wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
349 UMAEmbedControl( m_macToolHandle , container ) ;
519cb848 350
7c551d95 351 x += (int)toolSize.x;
519cb848
SC
352 noButtons ++;
353 }
354 else
355 {
356 m_macToolHandles.Add( NULL ) ;
7c551d95 357 x += (int)toolSize.x / 4;
519cb848 358 }
7c551d95
SC
359 if ( toolbarrect.left + x + kwxMacToolBarLeftMargin > m_maxWidth)
360 m_maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin;
361 if (toolbarrect.top + kwxMacToolBarTopMargin + toolSize.y > m_maxHeight)
362 m_maxHeight = toolbarrect.top + kwxMacToolBarTopMargin ;
363
519cb848
SC
364 node = node->Next();
365 }
366
7c551d95
SC
367 if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
368 {
369 m_maxWidth = tw ; // +=toolSize.x;
370 m_maxHeight += toolSize.y;
371 m_maxHeight += m_yMargin;
372 }
373 else
374 {
375 m_maxHeight = th ;// += toolSize.y;
376 m_maxWidth += toolSize.x;
377 m_maxWidth += m_xMargin;
378 }
379
380 SetSize(m_maxWidth, m_maxHeight);
381
519cb848 382 return TRUE;
e9576ca5
SC
383}
384
385void wxToolBar::SetToolBitmapSize(const wxSize& size)
386{
387 m_defaultWidth = size.x; m_defaultHeight = size.y;
e9576ca5
SC
388}
389
e9576ca5
SC
390// The button size is bigger than the bitmap size
391wxSize wxToolBar::GetToolSize() const
392{
2f1ae414 393 return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
e9576ca5
SC
394}
395
519cb848
SC
396void wxToolBar::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
397{
398 int index = 0 ;
399 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
400 {
401 if ( m_macToolHandles[index] == (void*) control )
402 {
2f1ae414
SC
403 wxToolBarTool *tool = (wxToolBarTool *)m_tools.Nth( index )->Data();
404 if ( tool->CanBeToggled() )
405 {
406 tool->Toggle( GetControlValue( control ) ) ;
407 }
408 OnLeftClick( tool->GetId() , tool -> IsToggled() ) ;
409 break ;
519cb848
SC
410 }
411 }
412}
413
37e2cb08 414void wxToolBar::SetRows(int nRows)
e9576ca5 415{
37e2cb08 416 if ( nRows == m_maxRows )
e9576ca5 417 {
37e2cb08
SC
418 // avoid resizing the frame uselessly
419 return;
e9576ca5 420 }
37e2cb08
SC
421
422 m_maxRows = nRows;
e9576ca5
SC
423}
424
37e2cb08 425wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
e9576ca5 426{
37e2cb08 427 MacClientToRootWindow( &x , &y ) ;
2f1ae414 428 Point pt = { y ,x } ;
37e2cb08
SC
429
430 int index = 0 ;
431 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
432 {
2f1ae414 433 if ( m_macToolHandles[index] )
37e2cb08 434 {
2f1ae414
SC
435 Rect bounds ;
436 GetControlBounds((ControlHandle) m_macToolHandles[index], &bounds ) ;
437 if ( PtInRect( pt , &bounds ) )
438 {
439 return (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
440 }
37e2cb08
SC
441 }
442 }
443
444 return (wxToolBarToolBase *)NULL;
e9576ca5
SC
445}
446
2f1ae414
SC
447wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
448{
449 wxToolBarToolBase* tool = FindToolForPosition( pt.x , pt.y ) ;
450 if ( tool )
451 {
452 return tool->GetShortHelp() ;
453 }
454 return "" ;
455}
456
37e2cb08 457void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
e9576ca5 458{
37e2cb08 459 wxToolBarTool *tool = (wxToolBarTool *)t;
2f1ae414
SC
460 if ( tool->m_index < 0 )
461 return ;
462
8208e181 463 ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
2f1ae414
SC
464
465 if ( enable )
466 UMAActivateControl( control ) ;
8208e181 467 else
2f1ae414 468 UMADeactivateControl( control ) ;
e9576ca5
SC
469}
470
37e2cb08 471void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
e9576ca5 472{
37e2cb08 473 wxToolBarTool *tool = (wxToolBarTool *)t;
2f1ae414
SC
474 if ( tool->m_index < 0 )
475 return ;
8208e181
SC
476
477 ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
478 ::SetControlValue( control , toggle ) ;
37e2cb08 479}
7c551d95 480
37e2cb08
SC
481bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
482 wxToolBarToolBase *tool)
483{
484 // nothing special to do here - we really create the toolbar buttons in
485 // Realize() later
486 tool->Attach(this);
7c551d95 487
37e2cb08
SC
488 return TRUE;
489}
e9576ca5 490
37e2cb08
SC
491void wxToolBar::DoSetToggle(wxToolBarToolBase *t, bool toggle)
492{
493 wxToolBarTool *tool = (wxToolBarTool *)t;
494 // TODO: set toggle state
e9576ca5
SC
495}
496
37e2cb08
SC
497bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
498{
499 return TRUE ;
500}
2f1ae414
SC
501
502void wxToolBar::OnPaint(wxPaintEvent& event)
503{
80645074
SC
504 Point localOrigin ;
505 Rect clipRect ;
506 WindowRef window ;
507 wxWindow *win ;
508
509 MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
510 if ( window && win )
511 {
512 wxMacDrawingHelper help( win ) ;
513 // the mac control manager always assumes to have the origin at 0,0
514 SetOrigin( 0 , 0 ) ;
515
516 bool hasTabBehind = false ;
517 wxWindow* parent = GetParent() ;
518 while ( parent )
519 {
520 if( parent->MacGetWindowData() )
521 {
522 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
523 break ;
524 }
525
526 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
527 {
528 if ( ((wxControl*)parent)->GetMacControl() )
529 SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
530 break ;
531 }
532
533 parent = parent->GetParent() ;
534 }
535 Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
536 m_y + localOrigin.v + m_height , m_x + localOrigin.h + m_width } ;
537
538 UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
539 {
540 int index = 0 ;
541 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
542 {
543 if ( m_macToolHandles[index] )
544 {
545 UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
546 }
547 }
548 }
549 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
550 wxDC::MacInvalidateSetup() ;
551 }
552 /*
2f1ae414
SC
553 WindowRef window = GetMacRootWindow() ;
554 if ( window )
555 {
556 wxWindow* win = wxFindWinFromMacWindow( window ) ;
557 if ( win )
558 {
559 wxMacDrawingHelper help( win ) ;
560 // the mac control manager always assumes to have the origin at 0,0
561 SetOrigin( 0 , 0 ) ;
562
563 bool hasTabBehind = false ;
564 wxWindow* parent = GetParent() ;
565 while ( parent )
566 {
567 if( parent->MacGetWindowData() )
568 {
569 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
570 break ;
571 }
572
573 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
574 {
575 if ( ((wxControl*)parent)->GetMacControl() )
576 SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
577 break ;
578 }
579
580 parent = parent->GetParent() ;
581 }
582 Rect toolbarrect = { m_y , m_x , m_y + m_height , m_x + m_width } ;
583
584 UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
585 {
586 int index = 0 ;
587 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
588 {
589 if ( m_macToolHandles[index] )
590 {
591 UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
592 }
593 }
594 }
595 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
b89dac78 596 wxDC::MacInvalidateSetup() ;
2f1ae414
SC
597 }
598 }
80645074 599 */
2f1ae414
SC
600}
601void wxToolBar::OnMouse( wxMouseEvent &event )
602{
603
604 if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
605 {
606
607 int x = event.m_x ;
608 int y = event.m_y ;
609
610 MacClientToRootWindow( &x , &y ) ;
611
612 ControlHandle control ;
613 Point localwhere ;
614 GrafPtr port ;
615 SInt16 controlpart ;
616 WindowRef window = GetMacRootWindow() ;
617
618 localwhere.h = x ;
619 localwhere.v = y ;
620
621 short modifiers = 0;
622
623 if ( !event.m_leftDown && !event.m_rightDown )
624 modifiers |= btnState ;
625
626 if ( event.m_shiftDown )
627 modifiers |= shiftKey ;
628
629 if ( event.m_controlDown )
630 modifiers |= controlKey ;
631
632 if ( event.m_altDown )
633 modifiers |= optionKey ;
634
635 if ( event.m_metaDown )
636 modifiers |= cmdKey ;
637
638 controlpart = FindControl( localwhere , window , &control ) ;
639 {
640 if ( AcceptsFocus() && FindFocus() != this )
641 {
642 SetFocus() ;
643 }
644 if ( control && UMAIsControlActive( control ) )
645 {
646 {
647 if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
648 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
649 else
650 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
651 wxTheApp->s_lastMouseDown = 0 ;
652 if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
653 && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
654 {
655 MacHandleControlClick( control , controlpart ) ;
656 }
657 }
658 }
659 }
660 }
661}
662
519cb848
SC
663#endif // wxUSE_TOOLBAR
664