1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxControl class 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  14 #include "wx/control.h" 
  18 #include "wx/dcclient.h" 
  19 #include "wx/notebook.h" 
  20 #include "wx/tabctrl.h" 
  21 #include "wx/radiobox.h" 
  22 #include "wx/spinbutt.h" 
  23 #include "wx/scrolbar.h" 
  24 #include "wx/button.h" 
  25 #include "wx/dialog.h" 
  26 #include "wx/statbox.h" 
  28 #include "wx/stattext.h" 
  30 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
) 
  32 BEGIN_EVENT_TABLE(wxControl
, wxWindow
) 
  33     EVT_MOUSE_EVENTS( wxControl::OnMouseEvent 
)  
  34     EVT_PAINT( wxControl::OnPaint 
)  
  37 #include "wx/mac/uma.h" 
  38 #include "wx/mac/private.h" 
  43 #if PRAGMA_STRUCT_ALIGN 
  44     #pragma options align=mac68k 
  45 #elif PRAGMA_STRUCT_PACKPUSH 
  47 #elif PRAGMA_STRUCT_PACK 
  52  unsigned short instruction
; 
  54 } cdefRec
, *cdefPtr
, **cdefHandle
; 
  56 #if PRAGMA_STRUCT_ALIGN 
  57     #pragma options align=reset 
  58 #elif PRAGMA_STRUCT_PACKPUSH 
  60 #elif PRAGMA_STRUCT_PACK 
  64 ControlActionUPP wxMacLiveScrollbarActionUPP 
= NULL 
; 
  65 wxControl 
*wxFindControlFromMacControl(ControlHandle inControl 
) ; 
  67 pascal void wxMacLiveScrollbarActionProc( ControlHandle control 
, ControlPartCode partCode 
) ; 
  68 pascal void wxMacLiveScrollbarActionProc( ControlHandle control 
, ControlPartCode partCode 
) 
  72         wxControl
*  wx 
= (wxControl
*) GetControlReference( control 
) ; 
  75             wx
->MacHandleControlClick( (WXWidget
) control 
, partCode 
, true /* stillDown */ ) ; 
  80 ControlColorUPP wxMacSetupControlBackgroundUPP 
= NULL 
; 
  81 ControlDefUPP wxMacControlActionUPP 
= NULL 
; 
  83 pascal SInt32  
wxMacControlDefinition(SInt16 varCode
, ControlRef theControl
, ControlDefProcMessage message
, SInt32 param
) 
  86     wxControl
*  wx 
= (wxControl
*) wxFindControlFromMacControl( theControl 
) ; 
  87     if ( wx 
!= NULL 
&& wx
->IsKindOf( CLASSINFO( wxControl 
) ) ) 
  89         if( message 
== drawCntl 
) 
  91             wxMacWindowClipper 
clip( wx 
) ; 
  92             return InvokeControlDefUPP( varCode 
, theControl 
, message 
, param 
, (ControlDefUPP
) wx
->MacGetControlAction() ) ; 
  95             return InvokeControlDefUPP( varCode 
, theControl 
, message 
, param 
, (ControlDefUPP
) wx
->MacGetControlAction() ) ; 
 100 pascal OSStatus 
wxMacSetupControlBackground( ControlRef iControl 
, SInt16 iMessage 
, SInt16 iDepth 
, Boolean iIsColor 
) 
 102     OSStatus status 
= noErr 
; 
 105         case kControlMsgSetUpBackground 
: 
 107                 wxControl
*  wx 
= (wxControl
*) GetControlReference( iControl 
) ; 
 108                 if ( wx 
!= NULL 
&& wx
->IsKindOf( CLASSINFO( wxControl 
) ) ) 
 110                     wxDC::MacSetupBackgroundForCurrentPort( wx
->MacGetBackgroundBrush() ) ; 
 112                     // under classic this would lead to partial redraws 
 113                     RgnHandle clip 
= NewRgn() ; 
 116                     wx
->MacWindowToRootWindow( &x
,&y 
) ; 
 117                     CopyRgn( (RgnHandle
) wx
->MacGetVisibleRegion(false).GetWXHRGN() , clip 
) ; 
 118                     OffsetRgn( clip 
, x 
, y 
) ; 
 136 wxControl::wxControl() 
 138     m_macControl 
= NULL 
; 
 139     m_macControlAction 
= NULL 
; 
 140     m_macHorizontalBorder 
= 0 ; // additional pixels around the real control 
 141     m_macVerticalBorder 
= 0 ; 
 142     m_backgroundColour 
= *wxWHITE
; 
 143     m_foregroundColour 
= *wxBLACK
; 
 145     if ( wxMacLiveScrollbarActionUPP 
== NULL 
) 
 147 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) 
 148         wxMacLiveScrollbarActionUPP 
= NewControlActionUPP( wxMacLiveScrollbarActionProc 
); 
 150         wxMacLiveScrollbarActionUPP 
= NewControlActionProc( wxMacLiveScrollbarActionProc 
) ; 
 155 bool wxControl::Create(wxWindow 
*parent
, wxWindowID id
, 
 157                        const wxSize
& size
, long style
, 
 158                        const wxValidator
& validator
, 
 159                        const wxString
& name
) 
 161     m_macControl 
= NULL 
; 
 162     m_macHorizontalBorder 
= 0 ; // additional pixels around the real control 
 163     m_macVerticalBorder 
= 0 ; 
 165     bool rval 
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
); 
 168         m_backgroundColour 
= parent
->GetBackgroundColour() ; 
 169         m_foregroundColour 
= parent
->GetForegroundColour() ; 
 173         SetValidator(validator
); 
 179 wxControl::~wxControl() 
 181     m_isBeingDeleted 
= TRUE
; 
 182     wxRemoveMacControlAssociation( this ) ; 
 183     // If we delete an item, we should initialize the parent panel, 
 184     // because it could now be invalid. 
 185     wxWindow 
*parent 
= GetParent() ; 
 188         if (parent
->GetDefaultItem() == (wxButton
*) this) 
 189             parent
->SetDefaultItem(NULL
); 
 191     if ( (ControlHandle
) m_macControl 
) 
 193         // in case the callback might be called during destruction 
 194         ::SetControlColorProc( (ControlHandle
) m_macControl 
, NULL 
) ; 
 195         ::DisposeControl( (ControlHandle
) m_macControl 
) ; 
 196         m_macControl 
= NULL 
; 
 200 void wxControl::SetLabel(const wxString
& title
) 
 202     m_label 
= wxStripMenuCodes(title
) ; 
 206                 UMASetControlTitle( (ControlHandle
) m_macControl 
, m_label 
, m_font
.GetEncoding() ) ; 
 211 wxSize 
wxControl::DoGetBestSize() const 
 213     if ( (ControlHandle
) m_macControl 
== NULL 
) 
 214         return wxWindow::DoGetBestSize() ; 
 216     Rect    bestsize 
= { 0 , 0 , 0 , 0 } ; 
 217     short   baselineoffset 
; 
 218     int bestWidth
, bestHeight 
; 
 219     ::GetBestControlRect( (ControlHandle
) m_macControl 
, &bestsize 
, &baselineoffset 
) ; 
 221     if ( EmptyRect( &bestsize 
) ) 
 224         bestsize
.left 
= bestsize
.top 
= 0 ; 
 225         bestsize
.right 
= 16 ; 
 226         bestsize
.bottom 
= 16 ; 
 227         if ( IsKindOf( CLASSINFO( wxScrollBar 
) ) ) 
 229             bestsize
.bottom 
= 16 ; 
 231         else if ( IsKindOf( CLASSINFO( wxSpinButton 
) ) ) 
 233             bestsize
.bottom 
= 24 ;  
 237     bestWidth 
= bestsize
.right 
- bestsize
.left 
; 
 239     bestWidth 
+= 2 * m_macHorizontalBorder 
; 
 241     bestHeight 
= bestsize
.bottom 
- bestsize
.top 
; 
 242     if ( bestHeight 
< 10 ) 
 245     bestHeight 
+= 2 * m_macVerticalBorder
; 
 248     return wxSize(bestWidth
, bestHeight
); 
 251 bool wxControl::ProcessCommand (wxCommandEvent 
& event
) 
 254     // 1) OnCommand, starting at this window and working up parent hierarchy 
 255     // 2) OnCommand then calls ProcessEvent to search the event tables. 
 256     return GetEventHandler()->ProcessEvent(event
); 
 259 // ------------------------ 
 260 wxList 
*wxWinMacControlList 
= NULL
; 
 261 wxControl 
*wxFindControlFromMacControl(ControlHandle inControl 
) 
 263     wxNode 
*node 
= wxWinMacControlList
->Find((long)inControl
); 
 266     return (wxControl 
*)node
->GetData(); 
 269 void wxAssociateControlWithMacControl(ControlHandle inControl
, wxControl 
*control
) 
 271     // adding NULL WindowRef is (first) surely a result of an error and 
 272     // (secondly) breaks menu command processing 
 273     wxCHECK_RET( inControl 
!= (ControlHandle
) NULL
, wxT("attempt to add a NULL WindowRef to window list") ); 
 275     if ( !wxWinMacControlList
->Find((long)inControl
) ) 
 276         wxWinMacControlList
->Append((long)inControl
, control
); 
 279 void wxRemoveMacControlAssociation(wxControl 
*control
) 
 281     if ( wxWinMacControlList 
) 
 282         wxWinMacControlList
->DeleteObject(control
); 
 285 void wxControl::MacPreControlCreate( wxWindow 
*parent
, wxWindowID id
, wxString label 
,  
 287              const wxSize
& size
, long style
, 
 288              const wxValidator
& validator
, 
 289              const wxString
& name 
, WXRECTPTR outBounds 
, unsigned char* maclabel 
)  
 293     // These sizes will be adjusted in MacPostControlCreate 
 299     ((Rect
*)outBounds
)->top 
= -10; 
 300     ((Rect
*)outBounds
)->left 
= -10; 
 301     ((Rect
*)outBounds
)->bottom 
= 0; 
 302     ((Rect
*)outBounds
)->right 
= 0; 
 304     wxMacStringToPascal( wxStripMenuCodes(label
) , maclabel 
) ; 
 307 void wxControl::MacPostControlCreate() 
 309     wxASSERT_MSG( (ControlHandle
) m_macControl 
!= NULL 
, wxT("No valid mac control") ) ; 
 310     DoSetWindowVariant( m_windowVariant 
) ; 
 312     if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) 
 316     else if ( !UMAHasAquaLayout() && (IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) ) ) 
 318         ControlFontStyleRec     controlstyle ; 
 319         controlstyle.flags = kControlUseFontMask ; 
 320         controlstyle.font = kControlFontSmallBoldSystemFont ; 
 322         ::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ; 
 326         ControlFontStyleRec     controlstyle ; 
 327         controlstyle.flags = kControlUseFontMask ; 
 329         if (IsKindOf( CLASSINFO( wxButton ) ) ) 
 330             controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ; 
 332             controlstyle.font = kControlFontSmallSystemFont ; 
 334         ::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ; 
 337     ControlHandle container 
= (ControlHandle
) GetParent()->MacGetContainerForEmbedding() ; 
 338     wxASSERT_MSG( container 
!= NULL 
, wxT("No valid mac container control") ) ; 
 339     ::EmbedControl( (ControlHandle
) m_macControl 
, container 
) ; 
 340     m_macControlIsShown  
= MacIsReallyShown() ; 
 342     wxAssociateControlWithMacControl( (ControlHandle
) m_macControl 
, this ) ; 
 343     if ( wxMacSetupControlBackgroundUPP 
== NULL 
) 
 345         wxMacSetupControlBackgroundUPP 
= NewControlColorUPP( wxMacSetupControlBackground 
) ; 
 347     if ( wxMacControlActionUPP 
== NULL 
) 
 349         wxMacControlActionUPP 
= NewControlDefUPP( wxMacControlDefinition 
) ; 
 351     // The following block of code is responsible for crashes when switching 
 352     // back to windows, which can be seen in the dialogs sample. 
 353     // It is disabled until a proper solution can be found. 
 357     only working under classic carbon 
 358     m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ; 
 359     (**(ControlHandle)m_macControl).contrlDefProc = (Handle) &wxMacControlActionUPP ; 
 362     m_macControlAction 
= *(**(ControlHandle
)m_macControl
).contrlDefProc 
; 
 365     cdef 
= (cdefHandle
) NewHandle( sizeof(cdefRec
) ) ; 
 366     if (  (**(ControlHandle
)m_macControl
).contrlDefProc 
!= NULL 
) 
 368         (**cdef
).instruction 
= 0x4EF9;  /* JMP instruction */ 
 369         (**cdef
).function 
= (void(*)()) wxMacControlActionUPP
; 
 370         (**(ControlHandle
)m_macControl
).contrlDefProc 
= (Handle
) cdef 
; 
 374     SetControlColorProc( (ControlHandle
) m_macControl 
, wxMacSetupControlBackgroundUPP 
) ; 
 376     // Adjust the controls size and position 
 377     wxPoint 
pos(m_x
, m_y
); 
 378     wxSize 
best_size( DoGetBestSize() ); 
 379     wxSize 
new_size( m_width
, m_height 
); 
 381     m_x 
= m_y 
= m_width 
= m_height 
= -1;  // Forces SetSize to move/size the control 
 383     if (new_size
.x 
== -1) { 
 384         new_size
.x 
= best_size
.x
; 
 386     if (new_size
.y 
== -1) { 
 387         new_size
.y 
= best_size
.y
; 
 390     SetSize(pos
.x
, pos
.y
, new_size
.x
, new_size
.y
); 
 393     UMASetControlTitle( (ControlHandle
) m_macControl 
, wxStripMenuCodes(m_label
) , m_font
.GetEncoding() ) ; 
 396     if ( m_macControlIsShown 
) 
 397         UMAShowControl( (ControlHandle
) m_macControl 
) ; 
 399     SetCursor( *wxSTANDARD_CURSOR 
) ; 
 404 void wxControl::MacAdjustControlRect()  
 406     wxASSERT_MSG( (ControlHandle
) m_macControl 
!= NULL 
, wxT("No valid mac control") ) ; 
 407     if ( m_width 
== -1 || m_height 
== -1 ) 
 409         Rect    bestsize 
= { 0 , 0 , 0 , 0 } ; 
 410         short   baselineoffset 
; 
 412         ::GetBestControlRect( (ControlHandle
) m_macControl 
, &bestsize 
, &baselineoffset 
) ; 
 414         if ( EmptyRect( &bestsize 
) ) 
 417             bestsize
.left 
= bestsize
.top 
= 0 ; 
 418             bestsize
.right 
= 16 ; 
 419             bestsize
.bottom 
= 16 ; 
 420             if ( IsKindOf( CLASSINFO( wxScrollBar 
) ) ) 
 422                 bestsize
.bottom 
= 16 ; 
 424             else if ( IsKindOf( CLASSINFO( wxSpinButton 
) ) ) 
 426                 bestsize
.bottom 
= 24 ;  
 432             if ( IsKindOf( CLASSINFO( wxButton 
) ) ) 
 434                 m_width 
= m_label
.Length() * 8 + 12 ; 
 438             else if ( IsKindOf( CLASSINFO( wxStaticText 
) ) ) 
 440                 m_width 
= m_label
.Length() * 8 ; 
 443                 m_width 
= bestsize
.right 
- bestsize
.left 
; 
 445             m_width 
+= 2 * m_macHorizontalBorder 
+ MacGetLeftBorderSize() + MacGetRightBorderSize() ; 
 447         if ( m_height 
== -1 ) 
 449             m_height 
= bestsize
.bottom 
- bestsize
.top 
; 
 453             m_height 
+= 2 * m_macVerticalBorder 
+ MacGetTopBorderSize() + MacGetBottomBorderSize() ; 
 455          MacUpdateDimensions() ;       
 459 WXWidget 
wxControl::MacGetContainerForEmbedding()  
 462         return m_macControl 
; 
 464     return wxWindow::MacGetContainerForEmbedding() ; 
 467 void wxControl::MacUpdateDimensions()  
 469     // actually in the current systems this should never be possible, but later reparenting 
 470     // may become a reality 
 472     if ( (ControlHandle
) m_macControl 
== NULL 
) 
 475     if ( GetParent() == NULL 
) 
 478     WindowRef rootwindow 
= (WindowRef
) MacGetRootWindow() ; 
 479     if ( rootwindow 
== NULL 
) 
 483     GetControlBounds( (ControlHandle
) m_macControl 
, &oldBounds 
) ;  
 485     int new_x 
= m_x 
+ MacGetLeftBorderSize() + m_macHorizontalBorder 
; 
 486     int new_y 
= m_y 
+ MacGetTopBorderSize() + m_macVerticalBorder 
; 
 487     int new_width 
= m_width 
- MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder 
; 
 488     int new_height 
= m_height 
- MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder 
; 
 490     GetParent()->MacWindowToRootWindow( & new_x 
, & new_y 
) ; 
 491     bool doMove 
= new_x 
!= oldBounds
.left 
|| new_y 
!= oldBounds
.top 
; 
 492     bool doResize 
=  ( oldBounds
.right 
- oldBounds
.left 
) != new_width 
|| (oldBounds
.bottom 
- oldBounds
.top 
) != new_height 
; 
 493     if ( doMove 
|| doResize 
) 
 495         InvalWindowRect( rootwindow
, &oldBounds 
) ; 
 498             UMAMoveControl( (ControlHandle
) m_macControl 
, new_x 
, new_y 
) ; 
 502             UMASizeControl( (ControlHandle
) m_macControl 
, new_width 
, new_height 
) ; 
 507 void wxControl::MacSuperChangedPosition()  
 509      MacUpdateDimensions() ; 
 510     wxWindow::MacSuperChangedPosition() ; 
 513 void wxControl::MacSuperEnabled( bool enabled 
)  
 516     wxWindow::MacSuperEnabled( enabled 
) ; 
 519 void wxControl::MacSuperShown( bool show 
)  
 521     if ( (ControlHandle
) m_macControl 
) 
 525             if ( m_macControlIsShown 
) 
 527                 ::UMAHideControl( (ControlHandle
) m_macControl 
) ; 
 528                 m_macControlIsShown 
= false ; 
 533             if ( MacIsReallyShown() && !m_macControlIsShown 
) 
 535                 ::UMAShowControl( (ControlHandle
) m_macControl 
) ; 
 536                 m_macControlIsShown 
= true ; 
 541     wxWindow::MacSuperShown( show 
) ; 
 544 void  wxControl::DoSetSize(int x
, int y
, 
 545             int width
, int height
, 
 548     wxWindow::DoSetSize( x 
, y 
,width 
, height 
,sizeFlags 
) ; 
 551         Rect meta 
, control 
; 
 552         GetControlBounds( (ControlHandle
) m_macControl 
, &control 
) ; 
 553         RgnHandle rgn 
= NewRgn() ; 
 554         GetControlRegion( (ControlHandle
) m_macControl 
, kControlStructureMetaPart 
, rgn 
) ; 
 555         GetRegionBounds( rgn 
, &meta 
) ; 
 556         if ( !EmptyRect( &meta 
) ) 
 558             wxASSERT( meta
.left 
>= control
.left 
- m_macHorizontalBorder 
) ; 
 559             wxASSERT( meta
.right 
<= control
.right 
+ m_macHorizontalBorder 
) ; 
 560             wxASSERT( meta
.top 
>= control
.top 
- m_macVerticalBorder 
) ; 
 561             wxASSERT( meta
.bottom 
<= control
.bottom 
+ m_macVerticalBorder 
) ; 
 569 bool  wxControl::Show(bool show
)  
 571     if ( !wxWindow::Show( show 
) ) 
 574     if ( (ControlHandle
) m_macControl 
) 
 578             if ( m_macControlIsShown 
) 
 580                 ::UMAHideControl( (ControlHandle
) m_macControl 
) ; 
 581                 m_macControlIsShown 
= false ; 
 586             if ( MacIsReallyShown() && !m_macControlIsShown 
) 
 588                 ::UMAShowControl( (ControlHandle
) m_macControl 
) ; 
 589                 m_macControlIsShown 
= true ; 
 596 bool  wxControl::Enable(bool enable
)  
 598     if ( !wxWindow::Enable(enable
) ) 
 601     if ( (ControlHandle
) m_macControl 
) 
 604             UMAActivateControl( (ControlHandle
) m_macControl 
) ; 
 606             UMADeactivateControl( (ControlHandle
) m_macControl 
) ; 
 611 void wxControl::Refresh(bool eraseBack
, const wxRect 
*rect
) 
 613     wxWindow::Refresh( eraseBack 
, rect 
) ; 
 616 void wxControl::MacRedrawControl() 
 618     if ( (ControlHandle
) m_macControl 
&& MacGetRootWindow() && m_macControlIsShown 
) 
 620         wxClientDC 
dc(this) ; 
 621         wxMacPortSetter 
helper(&dc
) ; 
 622         wxMacWindowClipper 
clipper(this) ; 
 623         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; 
 624         UMADrawControl( (ControlHandle
) m_macControl 
) ; 
 628 void wxControl::OnPaint(wxPaintEvent
& event
) 
 630     if ( (ControlHandle
) m_macControl 
) 
 633         wxMacPortSetter 
helper(&dc
) ; 
 634         wxMacWindowClipper 
clipper(this) ; 
 635         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; 
 636         UMADrawControl( (ControlHandle
) m_macControl 
) ; 
 643 void wxControl::OnEraseBackground(wxEraseEvent
& event
) 
 645     wxWindow::OnEraseBackground( event 
) ;  
 648 void  wxControl::OnKeyDown( wxKeyEvent 
&event 
)  
 650     if ( (ControlHandle
) m_macControl 
== NULL 
) 
 659     GetEventParameter( (EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyMacCharCodes
, typeChar
, NULL
,sizeof(char), NULL
,&charCode 
); 
 660     GetEventParameter( (EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyCode
, typeUInt32
, NULL
,  sizeof(UInt32
), NULL
, &keyCode 
); 
 661        GetEventParameter((EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &modifiers
); 
 663     ::HandleControlKey( (ControlHandle
) m_macControl 
, keyCode 
, charCode 
, modifiers 
) ; 
 666     EventRecord 
*ev 
= (EventRecord
*) wxTheApp
->MacGetCurrentEvent() ; 
 669     keychar 
= short(ev
->message 
& charCodeMask
); 
 670     keycode 
= short(ev
->message 
& keyCodeMask
) >> 8 ; 
 672     ::HandleControlKey( (ControlHandle
) m_macControl 
, keycode 
, keychar 
, ev
->modifiers 
) ; 
 676 void  wxControl::OnMouseEvent( wxMouseEvent 
&event 
)  
 678     if ( (ControlHandle
) m_macControl 
== NULL 
) 
 684     if (event
.GetEventType() == wxEVT_LEFT_DOWN 
|| event
.GetEventType() == wxEVT_LEFT_DCLICK 
) 
 690         MacClientToRootWindow( &x 
, &y 
) ; 
 692         ControlHandle   control 
; 
 701         if ( !event
.m_leftDown 
&& !event
.m_rightDown 
) 
 702             modifiers  
|= btnState 
; 
 704         if ( event
.m_shiftDown 
) 
 705             modifiers 
|= shiftKey 
; 
 707         if ( event
.m_controlDown 
) 
 708             modifiers 
|= controlKey 
; 
 710         if ( event
.m_altDown 
) 
 711             modifiers 
|= optionKey 
; 
 713         if ( event
.m_metaDown 
) 
 714             modifiers 
|= cmdKey 
; 
 716             control 
= (ControlHandle
) m_macControl 
; 
 717             if ( control 
&& ::IsControlActive( control 
) ) 
 720                     controlpart 
= ::HandleControlClick( control 
, localwhere 
, modifiers 
, (ControlActionUPP
) -1 ) ; 
 721                     wxTheApp
->s_lastMouseDown 
= 0 ; 
 722                     if ( control 
&& controlpart 
!= kControlNoPart 
)  
 724                         MacHandleControlClick( (WXWidget
) control 
, controlpart 
, false /* mouse not down anymore */ ) ; 
 736 bool wxControl::MacCanFocus() const 
 738     if ( (ControlHandle
) m_macControl 
== NULL 
)  
 744 void wxControl::MacHandleControlClick( WXWidget control 
, wxInt16 controlpart 
, bool WXUNUSED( mouseStillDown 
) )  
 746     wxASSERT_MSG( (ControlHandle
) m_macControl 
!= NULL 
, wxT("No valid mac control") ) ; 
 749 void wxControl::DoSetWindowVariant( wxWindowVariant variant 
) 
 751     if ( m_macControl 
== NULL 
) 
 753         wxWindow::SetWindowVariant( variant 
) ; 
 757     m_windowVariant 
= variant 
;  
 760         ControlFontStyleRec     fontStyle
; 
 761         fontStyle
.flags 
= kControlUseFontMask  
; 
 763     // we will get that from the settings later 
 764     // and make this NORMAL later, but first  
 765     // we have a few calculations that we must fix 
 767     if ( variant 
== wxWINDOW_VARIANT_NORMAL 
) 
 769         if ( IsKindOf( CLASSINFO( wxScrollBar 
) ) ) 
 770             variant  
= wxWINDOW_VARIANT_NORMAL 
; 
 772             variant 
= wxWINDOW_VARIANT_SMALL 
; 
 777         case wxWINDOW_VARIANT_NORMAL 
: 
 778             size 
= kControlSizeNormal
;  
 779                 fontStyle
.font 
= kControlFontBigSystemFont
; 
 781         case wxWINDOW_VARIANT_SMALL 
: 
 782             size 
= kControlSizeSmall
;  
 783                 fontStyle
.font 
= kControlFontSmallSystemFont
; 
 785         case wxWINDOW_VARIANT_MINI 
: 
 786            if (UMAGetSystemVersion() >= 0x1030 ) 
 788                 size 
= 3 ; // not always defined in the header  
 789                     fontStyle
.font 
= -5 ; // not always defined in the header  
 793                 size 
= kControlSizeSmall
;  
 794                     fontStyle
.font 
= kControlFontSmallSystemFont
; 
 798         case wxWINDOW_VARIANT_LARGE 
: 
 799             size 
= kControlSizeLarge
;  
 800                 fontStyle
.font 
= kControlFontBigSystemFont
; 
 803             wxFAIL_MSG(_T("unexpected window variant")); 
 806         ::SetControlData( (ControlHandle
) m_macControl 
, kControlEntireControl
, kControlSizeTag
, sizeof( ControlSize 
), &size 
); 
 807         ::SetControlFontStyle( (ControlHandle
) m_macControl 
, &fontStyle 
);