]> git.saurik.com Git - wxWidgets.git/blame - src/mac/toolbar.cpp
attempt to recommit , contained binary data for some reason
[wxWidgets.git] / src / mac / 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"
72055702 22#include "wx/bitmap.h"
e9576ca5 23
2f1ae414 24#if !USE_SHARED_LIBRARY
12ed316d 25IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
e9576ca5
SC
26
27BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
e044f600
RR
28 EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
29 EVT_PAINT( wxToolBar::OnPaint )
e9576ca5 30END_EVENT_TABLE()
2f1ae414 31#endif
e9576ca5 32
d497dca4 33#include "wx/mac/uma.h"
519cb848 34
37e2cb08
SC
35// ----------------------------------------------------------------------------
36// private classes
37// ----------------------------------------------------------------------------
38
39class wxToolBarTool : public wxToolBarToolBase
40{
41public:
42 wxToolBarTool(wxToolBar *tbar,
43 int id,
27e2d606
GD
44 const wxString& label,
45 const wxBitmap& bmpNormal,
46 const wxBitmap& bmpDisabled,
47 wxItemKind kind,
37e2cb08 48 wxObject *clientData,
27e2d606
GD
49 const wxString& shortHelp,
50 const wxString& longHelp)
51 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
52 clientData, shortHelp, longHelp)
37e2cb08
SC
53 {
54 m_nSepCount = 0;
2f1ae414 55 m_index = -1 ;
37e2cb08
SC
56 }
57
58 wxToolBarTool(wxToolBar *tbar, wxControl *control)
59 : wxToolBarToolBase(tbar, control)
60 {
61 m_nSepCount = 1;
2f1ae414 62 m_index = -1 ;
37e2cb08
SC
63 }
64
65 // set/get the number of separators which we use to cover the space used by
66 // a control in the toolbar
67 void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
68 size_t GetSeparatorsCount() const { return m_nSepCount; }
69
e044f600 70 int m_index ;
37e2cb08
SC
71private:
72 size_t m_nSepCount;
73};
74
75
76// ============================================================================
77// implementation
78// ============================================================================
79
80// ----------------------------------------------------------------------------
81// wxToolBarTool
82// ----------------------------------------------------------------------------
83
895f5af7
SC
84const short kwxMacToolBarToolDefaultWidth = 24 ;
85const short kwxMacToolBarToolDefaultHeight = 22 ;
86const short kwxMacToolBarTopMargin = 2 ;
87const short kwxMacToolBarLeftMargin = 2 ;
88
2f1ae414 89
37e2cb08 90wxToolBarToolBase *wxToolBar::CreateTool(int id,
27e2d606
GD
91 const wxString& label,
92 const wxBitmap& bmpNormal,
93 const wxBitmap& bmpDisabled,
94 wxItemKind kind,
37e2cb08 95 wxObject *clientData,
27e2d606
GD
96 const wxString& shortHelp,
97 const wxString& longHelp)
37e2cb08 98{
27e2d606
GD
99 return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
100 clientData, shortHelp, longHelp);
37e2cb08
SC
101}
102
103wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
104{
105 return new wxToolBarTool(this, control);
106}
107
37e2cb08 108void wxToolBar::Init()
e9576ca5
SC
109{
110 m_maxWidth = -1;
111 m_maxHeight = -1;
895f5af7
SC
112 m_defaultWidth = kwxMacToolBarToolDefaultWidth;
113 m_defaultHeight = kwxMacToolBarToolDefaultHeight;
e9576ca5
SC
114}
115
116bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
117 long style, const wxString& name)
118{
e9576ca5 119
519cb848
SC
120 int x = pos.x;
121 int y = pos.y;
122 int width = size.x;
123 int height = size.y;
e9576ca5 124
519cb848
SC
125 if (width <= 0)
126 width = 100;
127 if (height <= 0)
128 height = 30;
129 if (x < 0)
130 x = 0;
131 if (y < 0)
132 y = 0;
e9576ca5 133
895f5af7
SC
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 {
e044f600
RR
148 m_width = size.x ;
149 m_height = size.y ;
150 int x = pos.x ;
151 int y = pos.y ;
152 AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
153 m_x = x ;
154 m_y = y ;
895f5af7 155 }
a90c95aa
RR
156
157 return TRUE;
e9576ca5
SC
158}
159
160wxToolBar::~wxToolBar()
161{
2b5f62a0
VZ
162 size_t index = 0 ;
163 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
164 {
165 // Delete the control as we get ghosts otherwise
166 ::DisposeControl( (ControlHandle) m_macToolHandles[index] );
167 }
168
7810c95b
SC
169 // we must refresh the frame size when the toolbar is deleted but the frame
170 // is not - otherwise toolbar leaves a hole in the place it used to occupy
e9576ca5
SC
171}
172
37e2cb08 173bool wxToolBar::Realize()
e9576ca5 174{
0b7a8cd3
GD
175 if (m_tools.Number() == 0)
176 return FALSE;
177
178 Point localOrigin ;
d84afea9 179 // Rect clipRect ;
76a5e5d2 180 WindowRef window = (WindowRef) MacGetRootWindow() ;
d84afea9 181 // wxWindow *win ;
0b7a8cd3 182
de043984
SC
183 int lx , ly ;
184 lx = ly = 0 ;
185 MacWindowToRootWindow( &lx , &ly ) ;
186 localOrigin.v = ly ;
187 localOrigin.h = lx ;
188
189// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
0b7a8cd3 190
de043984
SC
191 Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
192 m_height + localOrigin.v , m_width + localOrigin.h} ;
0b7a8cd3
GD
193 ControlFontStyleRec controlstyle ;
194
195 controlstyle.flags = kControlUseFontMask ;
196 controlstyle.font = kControlFontSmallSystemFont ;
197
198 wxNode *node = m_tools.First();
199 int noButtons = 0;
200 int x = 0 ;
201 int y = 0 ;
202 wxSize toolSize = GetToolSize() ;
7c551d95
SC
203 int tw, th;
204 GetSize(& tw, & th);
895f5af7
SC
205
206 int maxWidth = 0 ;
207 int maxHeight = 0 ;
208
0b7a8cd3 209 while (node)
7810c95b 210 {
0b7a8cd3 211 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
0b7a8cd3
GD
212
213 if( !tool->IsSeparator() )
214 {
215 Rect toolrect = { toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin,
216 toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
217 toolrect.right = toolrect.left + toolSize.x ;
218 toolrect.bottom = toolrect.top + toolSize.y ;
219
220 ControlButtonContentInfo info ;
1b21409b 221 wxMacCreateBitmapButton( &info , tool->GetNormalBitmap() ) ;
0b7a8cd3
GD
222 ControlHandle m_macToolHandle ;
223
224 SInt16 behaviour = kControlBehaviorOffsetContents ;
225 if ( tool->CanBeToggled() )
226 behaviour += kControlBehaviorToggles ;
227
be295828 228 if ( info.contentType != kControlNoContent )
0b7a8cd3
GD
229 {
230 m_macToolHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
231 behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
232
233 ::SetControlData( m_macToolHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
234 }
235 else
236 {
237 m_macToolHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
238 behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
239 }
240 UMAShowControl( m_macToolHandle ) ;
241 m_macToolHandles.Add( m_macToolHandle ) ;
242 tool->m_index = m_macToolHandles.Count() -1 ;
243 if ( !tool->IsEnabled() )
244 {
245 UMADeactivateControl( m_macToolHandle ) ;
246 }
247 if ( tool->CanBeToggled() && tool->IsToggled() )
248 {
467e3168 249 ::SetControl32BitValue( m_macToolHandle , 1 ) ;
0b7a8cd3
GD
250 }
251 else
252 {
467e3168 253 ::SetControl32BitValue( m_macToolHandle , 0 ) ;
0b7a8cd3
GD
254 }
255 /*
256 ::SetControlFontStyle( m_macToolHandle , &controlstyle ) ;
257 */
76a5e5d2 258 ControlHandle container = (ControlHandle) GetParent()->MacGetContainerForEmbedding() ;
0b7a8cd3
GD
259 wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
260 ::EmbedControl( m_macToolHandle , container ) ;
261
1fd1922a 262 if ( GetWindowStyleFlag() & wxTB_VERTICAL )
0b7a8cd3 263 {
1fd1922a 264 y += (int)toolSize.y;
0b7a8cd3
GD
265 }
266 else
267 {
1fd1922a 268 x += (int)toolSize.x;
0b7a8cd3
GD
269 }
270 noButtons ++;
271 }
272 else
273 {
274 m_macToolHandles.Add( NULL ) ;
1fd1922a
RR
275
276 if ( GetWindowStyleFlag() & wxTB_VERTICAL )
0b7a8cd3 277 {
1fd1922a 278 y += (int)toolSize.y / 4;
0b7a8cd3
GD
279 }
280 else
281 {
1fd1922a 282 x += (int)toolSize.x / 4;
0b7a8cd3
GD
283 }
284 }
285 if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h > maxWidth) {
286 maxWidth = toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin - m_x - localOrigin.h;
287 }
288 if (toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight) {
289 maxHeight = toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v ;
290 }
291 node = node->Next();
7810c95b 292 }
0b7a8cd3
GD
293
294 if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
7810c95b 295 {
0b7a8cd3
GD
296 if ( m_maxRows == 0 )
297 {
298 // if not set yet, only one row
299 SetRows(1);
300 }
301 maxWidth = tw ;
302 maxHeight += toolSize.y;
303 maxHeight += m_yMargin + kwxMacToolBarTopMargin;
304 m_maxHeight = maxHeight ;
7810c95b 305 }
0b7a8cd3
GD
306 else
307 {
308 if ( noButtons > 0 && m_maxRows == 0 )
309 {
310 // if not set yet, have one column
311 SetRows(noButtons);
312 }
313 maxHeight = th ;
314 maxWidth += toolSize.x;
315 maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
316 m_maxWidth = maxWidth ;
317 }
318
319 SetSize(maxWidth, maxHeight);
320
321 return TRUE;
e9576ca5
SC
322}
323
324void wxToolBar::SetToolBitmapSize(const wxSize& size)
325{
9aad97fd 326 m_defaultWidth = size.x+4; m_defaultHeight = size.y+4;
e9576ca5
SC
327}
328
e9576ca5
SC
329// The button size is bigger than the bitmap size
330wxSize wxToolBar::GetToolSize() const
331{
2f1ae414 332 return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
e9576ca5
SC
333}
334
76a5e5d2 335void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
519cb848 336{
7af79c94 337 size_t index = 0 ;
e044f600
RR
338 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
339 {
340 if ( m_macToolHandles[index] == (void*) control )
341 {
342 wxToolBarTool *tool = (wxToolBarTool *)m_tools.Nth( index )->Data();
343 if ( tool->CanBeToggled() )
344 {
467e3168 345 tool->Toggle( GetControl32BitValue( (ControlHandle) control ) ) ;
e044f600
RR
346 }
347 OnLeftClick( tool->GetId() , tool -> IsToggled() ) ;
348 break ;
349 }
350 }
519cb848
SC
351}
352
37e2cb08 353void wxToolBar::SetRows(int nRows)
e9576ca5 354{
37e2cb08 355 if ( nRows == m_maxRows )
e9576ca5 356 {
37e2cb08
SC
357 // avoid resizing the frame uselessly
358 return;
e9576ca5 359 }
37e2cb08
SC
360
361 m_maxRows = nRows;
e9576ca5
SC
362}
363
c257d44d
SC
364void wxToolBar::MacSuperChangedPosition()
365{
366 if (m_tools.Number() > 0)
367 {
368
e044f600 369 Point localOrigin ;
d84afea9
GD
370 // Rect clipRect ;
371 // WindowRef window ;
372 // wxWindow *win ;
de043984
SC
373 int lx , ly ;
374 lx = ly = 0 ;
375 MacWindowToRootWindow( &lx , &ly ) ;
376 localOrigin.v = ly ;
377 localOrigin.h = lx ;
e044f600 378
de043984 379// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
e044f600 380
de043984
SC
381 Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
382 m_height + localOrigin.v , m_width + localOrigin.h} ;
e044f600
RR
383 ControlFontStyleRec controlstyle ;
384
385 controlstyle.flags = kControlUseFontMask ;
386 controlstyle.font = kControlFontSmallSystemFont ;
387
388 wxNode *node = m_tools.First();
389 int noButtons = 0;
390 int x = 0 ;
391 wxSize toolSize = GetToolSize() ;
c257d44d
SC
392 int tw, th;
393 GetSize(& tw, & th);
394
395 int maxWidth = 0 ;
396 int maxHeight = 0 ;
397 int toolcount = 0 ;
398 {
76a5e5d2 399 WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
1fd1922a
RR
400 while (node)
401 {
402 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
1fd1922a
RR
403
404 if( !tool->IsSeparator() )
405 {
406 Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
407 toolrect.right = toolrect.left + toolSize.x ;
408 toolrect.bottom = toolrect.top + toolSize.y ;
409
410 ControlHandle m_macToolHandle = (ControlHandle) m_macToolHandles[toolcount++] ;
411
412 {
413 Rect contrlRect ;
414 GetControlBounds( m_macToolHandle , &contrlRect ) ;
415 int former_mac_x = contrlRect.left ;
416 int former_mac_y = contrlRect.top ;
417 int mac_x = toolrect.left ;
418 int mac_y = toolrect.top ;
419
420 if ( mac_x != former_mac_x || mac_y != former_mac_y )
421 {
422 {
423 Rect inval = { former_mac_y , former_mac_x , former_mac_y + toolSize.y , former_mac_x + toolSize.y } ;
424 InvalWindowRect( rootwindow , &inval ) ;
425 }
426 UMAMoveControl( m_macToolHandle , mac_x , mac_y ) ;
427 {
428 Rect inval = { mac_y , mac_x , mac_y + toolSize.y , mac_x + toolSize.y } ;
429 InvalWindowRect( rootwindow , &inval ) ;
430 }
431 }
432 }
433
434 x += (int)toolSize.x;
435 noButtons ++;
436 }
437 else
438 {
c257d44d 439 toolcount++ ;
e044f600
RR
440 x += (int)toolSize.x / 4;
441 }
442 if ( toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
443 maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
444 if (toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
445 maxHeight = toolbarrect.top + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
446
447 node = node->Next();
448 }
c257d44d
SC
449 }
450
451 if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
452 {
453 if ( m_maxRows == 0 )
454 {
455 // if not set yet, only one row
456 SetRows(1);
457 }
e044f600 458 maxWidth = tw ;
c257d44d 459 maxHeight += toolSize.y;
e044f600
RR
460 maxHeight += m_yMargin + kwxMacToolBarTopMargin;
461 m_maxHeight = maxHeight ;
c257d44d
SC
462 }
463 else
464 {
465 if ( noButtons > 0 && m_maxRows == 0 )
466 {
467 // if not set yet, have one column
468 SetRows(noButtons);
469 }
470 maxHeight = th ;
471 maxWidth += toolSize.x;
e044f600
RR
472 maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
473 m_maxWidth = maxWidth ;
c257d44d
SC
474 }
475
476 SetSize(maxWidth, maxHeight);
477 }
478
479 wxWindow::MacSuperChangedPosition() ;
480}
481
37e2cb08 482wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
e9576ca5 483{
37e2cb08 484 MacClientToRootWindow( &x , &y ) ;
2f1ae414 485 Point pt = { y ,x } ;
37e2cb08 486
7af79c94 487 size_t index = 0 ;
e044f600
RR
488 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
489 {
490 if ( m_macToolHandles[index] )
491 {
492 Rect bounds ;
493 GetControlBounds((ControlHandle) m_macToolHandles[index], &bounds ) ;
494 if ( PtInRect( pt , &bounds ) )
495 {
496 return (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ;
497 }
498 }
499 }
37e2cb08
SC
500
501 return (wxToolBarToolBase *)NULL;
e9576ca5
SC
502}
503
2f1ae414
SC
504wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
505{
e044f600
RR
506 wxToolBarToolBase* tool = FindToolForPosition( pt.x , pt.y ) ;
507 if ( tool )
508 {
509 return tool->GetShortHelp() ;
510 }
511 return "" ;
2f1ae414
SC
512}
513
37e2cb08 514void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
e9576ca5 515{
e044f600
RR
516 if (!IsShown())
517 return ;
518
519 wxToolBarTool *tool = (wxToolBarTool *)t;
520 if ( tool->m_index < 0 )
521 return ;
522
523 ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
524
525 if ( enable )
526 UMAActivateControl( control ) ;
527 else
528 UMADeactivateControl( control ) ;
e9576ca5
SC
529}
530
37e2cb08 531void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
e9576ca5 532{
e044f600
RR
533 if (!IsShown())
534 return ;
535
536 wxToolBarTool *tool = (wxToolBarTool *)t;
537 if ( tool->m_index < 0 )
538 return ;
8208e181 539
e044f600 540 ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
467e3168 541 ::SetControl32BitValue( control , toggle ) ;
37e2cb08 542}
7c551d95 543
37e2cb08
SC
544bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
545 wxToolBarToolBase *tool)
546{
547 // nothing special to do here - we really create the toolbar buttons in
548 // Realize() later
549 tool->Attach(this);
7c551d95 550
37e2cb08
SC
551 return TRUE;
552}
e9576ca5 553
5115c51a 554void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
37e2cb08 555{
5115c51a 556 wxFAIL_MSG( _T("not implemented") );
e9576ca5
SC
557}
558
5115c51a 559bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *WXUNUSED(tool))
37e2cb08 560{
5115c51a
SC
561 wxFAIL_MSG( _T("not implemented") );
562 return TRUE ;
37e2cb08 563}
2f1ae414
SC
564
565void wxToolBar::OnPaint(wxPaintEvent& event)
566{
de043984
SC
567 wxPaintDC dc(this) ;
568 wxMacPortSetter helper(&dc) ;
569
1fd1922a
RR
570 Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
571 dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
572 UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
573 {
7af79c94 574 size_t index = 0 ;
1fd1922a
RR
575 for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
576 {
577 if ( m_macToolHandles[index] )
578 {
579 UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
580 }
581 }
582 }
2f1ae414 583}
895f5af7 584
2f1ae414
SC
585void wxToolBar::OnMouse( wxMouseEvent &event )
586{
1fd1922a
RR
587 if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
588 {
589
590 int x = event.m_x ;
591 int y = event.m_y ;
592
593 MacClientToRootWindow( &x , &y ) ;
594
595 ControlHandle control ;
596 Point localwhere ;
597 SInt16 controlpart ;
598 WindowRef window = (WindowRef) MacGetRootWindow() ;
599
600 localwhere.h = x ;
601 localwhere.v = y ;
602
603 short modifiers = 0;
604
605 if ( !event.m_leftDown && !event.m_rightDown )
606 modifiers |= btnState ;
607
608 if ( event.m_shiftDown )
609 modifiers |= shiftKey ;
610
611 if ( event.m_controlDown )
612 modifiers |= controlKey ;
613
614 if ( event.m_altDown )
615 modifiers |= optionKey ;
616
617 if ( event.m_metaDown )
618 modifiers |= cmdKey ;
619
620 controlpart = ::FindControl( localwhere , window , &control ) ;
621 {
622 if ( control && ::IsControlActive( control ) )
623 {
624 {
625 if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
626 controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
627 else
628 controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
629 wxTheApp->s_lastMouseDown = 0 ;
630 if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
631 && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
632 {
633 MacHandleControlClick( control , controlpart ) ;
634 }
635 }
636 }
637 }
638 }
2f1ae414
SC
639}
640
519cb848
SC
641#endif // wxUSE_TOOLBAR
642