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