1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "control.h"
18 #include "wx/control.h"
22 #include "wx/dcclient.h"
23 #include "wx/notebook.h"
24 #include "wx/tabctrl.h"
25 #include "wx/radiobox.h"
26 #include "wx/spinbutt.h"
27 #include "wx/scrolbar.h"
28 #include "wx/button.h"
29 #include "wx/dialog.h"
30 #include "wx/statbox.h"
32 #include "wx/stattext.h"
34 #if !USE_SHARED_LIBRARY
35 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
37 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
38 EVT_MOUSE_EVENTS( wxControl::OnMouseEvent
)
39 EVT_PAINT( wxControl::OnPaint
)
43 #include "wx/mac/uma.h"
44 #include "wx/mac/private.h"
49 #if PRAGMA_STRUCT_ALIGN
50 #pragma options align=mac68k
51 #elif PRAGMA_STRUCT_PACKPUSH
53 #elif PRAGMA_STRUCT_PACK
58 unsigned short instruction
;
60 } cdefRec
, *cdefPtr
, **cdefHandle
;
62 #if PRAGMA_STRUCT_ALIGN
63 #pragma options align=reset
64 #elif PRAGMA_STRUCT_PACKPUSH
66 #elif PRAGMA_STRUCT_PACK
70 ControlActionUPP wxMacLiveScrollbarActionUPP
= NULL
;
71 wxControl
*wxFindControlFromMacControl(ControlHandle inControl
) ;
73 pascal void wxMacLiveScrollbarActionProc( ControlHandle control
, ControlPartCode partCode
) ;
74 pascal void wxMacLiveScrollbarActionProc( ControlHandle control
, ControlPartCode partCode
)
78 wxControl
* wx
= (wxControl
*) GetControlReference( control
) ;
81 wx
->MacHandleControlClick( control
, partCode
, true /* stillDown */ ) ;
86 ControlColorUPP wxMacSetupControlBackgroundUPP
= NULL
;
87 ControlDefUPP wxMacControlActionUPP
= NULL
;
89 pascal SInt32
wxMacControlDefinition(SInt16 varCode
, ControlRef theControl
, ControlDefProcMessage message
, SInt32 param
)
92 wxControl
* wx
= (wxControl
*) wxFindControlFromMacControl( theControl
) ;
93 if ( wx
!= NULL
&& wx
->IsKindOf( CLASSINFO( wxControl
) ) )
95 if( message
== drawCntl
)
97 wxMacWindowClipper
clip( wx
) ;
98 return InvokeControlDefUPP( varCode
, theControl
, message
, param
, (ControlDefUPP
) wx
->MacGetControlAction() ) ;
101 return InvokeControlDefUPP( varCode
, theControl
, message
, param
, (ControlDefUPP
) wx
->MacGetControlAction() ) ;
106 pascal OSStatus
wxMacSetupControlBackground( ControlRef iControl
, SInt16 iMessage
, SInt16 iDepth
, Boolean iIsColor
)
108 OSStatus status
= noErr
;
111 case kControlMsgSetUpBackground
:
113 wxControl
* wx
= (wxControl
*) GetControlReference( iControl
) ;
114 if ( wx
!= NULL
&& wx
->IsKindOf( CLASSINFO( wxControl
) ) )
116 wxDC::MacSetupBackgroundForCurrentPort( wx
->MacGetBackgroundBrush() ) ;
118 // under classic this would lead to partial redraws
119 RgnHandle clip
= NewRgn() ;
122 wx
->MacWindowToRootWindow( &x
,&y
) ;
123 CopyRgn( (RgnHandle
) wx
->MacGetVisibleRegion(false).GetWXHRGN() , clip
) ;
124 OffsetRgn( clip
, x
, y
) ;
142 wxControl::wxControl()
144 m_macControl
= NULL
;
145 m_macControlAction
= NULL
;
146 m_macHorizontalBorder
= 0 ; // additional pixels around the real control
147 m_macVerticalBorder
= 0 ;
148 m_backgroundColour
= *wxWHITE
;
149 m_foregroundColour
= *wxBLACK
;
151 if ( wxMacLiveScrollbarActionUPP
== NULL
)
153 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
154 wxMacLiveScrollbarActionUPP
= NewControlActionUPP( wxMacLiveScrollbarActionProc
);
156 wxMacLiveScrollbarActionUPP
= NewControlActionProc( wxMacLiveScrollbarActionProc
) ;
161 bool wxControl::Create(wxWindow
*parent
, wxWindowID id
,
163 const wxSize
& size
, long style
,
164 const wxValidator
& validator
,
165 const wxString
& name
)
167 m_macControl
= NULL
;
168 m_macHorizontalBorder
= 0 ; // additional pixels around the real control
169 m_macVerticalBorder
= 0 ;
171 bool rval
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
174 m_backgroundColour
= parent
->GetBackgroundColour() ;
175 m_foregroundColour
= parent
->GetForegroundColour() ;
179 SetValidator(validator
);
185 wxControl::~wxControl()
187 m_isBeingDeleted
= TRUE
;
188 wxRemoveMacControlAssociation( this ) ;
189 // If we delete an item, we should initialize the parent panel,
190 // because it could now be invalid.
191 wxWindow
*parent
= GetParent() ;
194 if (parent
->GetDefaultItem() == (wxButton
*) this)
195 parent
->SetDefaultItem(NULL
);
197 if ( (ControlHandle
) m_macControl
)
199 ::DisposeControl( (ControlHandle
) m_macControl
) ;
200 m_macControl
= NULL
;
204 void wxControl::SetLabel(const wxString
& title
)
206 m_label
= wxStripMenuCodes(title
) ;
210 UMASetControlTitle( (ControlHandle
) m_macControl
, m_label
) ;
215 wxSize
wxControl::DoGetBestSize() const
217 Rect bestsize
= { 0 , 0 , 0 , 0 } ;
218 short baselineoffset
;
219 int bestWidth
, bestHeight
;
220 ::GetBestControlRect( (ControlHandle
) m_macControl
, &bestsize
, &baselineoffset
) ;
222 if ( EmptyRect( &bestsize
) )
225 bestsize
.left
= bestsize
.top
= 0 ;
226 bestsize
.right
= 16 ;
227 bestsize
.bottom
= 16 ;
228 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
230 bestsize
.bottom
= 16 ;
232 else if ( IsKindOf( CLASSINFO( wxSpinButton
) ) )
234 bestsize
.bottom
= 24 ;
238 if ( IsKindOf( CLASSINFO( wxButton
) ) )
240 bestWidth
= m_label
.Length() * 8 + 12 ;
241 if ( bestWidth
< 70 )
244 else if ( IsKindOf( CLASSINFO( wxStaticText
) ) )
246 bestWidth
= m_label
.Length() * 8 ;
249 bestWidth
= bestsize
.right
- bestsize
.left
;
251 bestWidth
+= 2 * m_macHorizontalBorder
;
253 bestHeight
= bestsize
.bottom
- bestsize
.top
;
254 if ( bestHeight
< 10 )
257 bestHeight
+= 2 * m_macVerticalBorder
;
260 return wxSize(bestWidth
, bestHeight
);
263 bool wxControl::ProcessCommand (wxCommandEvent
& event
)
266 // 1) OnCommand, starting at this window and working up parent hierarchy
267 // 2) OnCommand then calls ProcessEvent to search the event tables.
268 return GetEventHandler()->ProcessEvent(event
);
271 // ------------------------
272 wxList
*wxWinMacControlList
= NULL
;
273 wxControl
*wxFindControlFromMacControl(ControlHandle inControl
)
275 wxNode
*node
= wxWinMacControlList
->Find((long)inControl
);
278 return (wxControl
*)node
->GetData();
281 void wxAssociateControlWithMacControl(ControlHandle inControl
, wxControl
*control
)
283 // adding NULL WindowRef is (first) surely a result of an error and
284 // (secondly) breaks menu command processing
285 wxCHECK_RET( inControl
!= (ControlHandle
) NULL
, wxT("attempt to add a NULL WindowRef to window list") );
287 if ( !wxWinMacControlList
->Find((long)inControl
) )
288 wxWinMacControlList
->Append((long)inControl
, control
);
291 void wxRemoveMacControlAssociation(wxControl
*control
)
293 wxWinMacControlList
->DeleteObject(control
);
296 void wxControl::MacPreControlCreate( wxWindow
*parent
, wxWindowID id
, wxString label
,
298 const wxSize
& size
, long style
,
299 const wxValidator
& validator
,
300 const wxString
& name
, WXRECTPTR outBounds
, unsigned char* maclabel
)
304 // These sizes will be adjusted in MacPostControlCreate
310 ((Rect
*)outBounds
)->top
= -10;
311 ((Rect
*)outBounds
)->left
= -10;
312 ((Rect
*)outBounds
)->bottom
= 0;
313 ((Rect
*)outBounds
)->right
= 0;
315 wxMacStringToPascal( wxStripMenuCodes(label
) , maclabel
) ;
318 void wxControl::MacPostControlCreate()
320 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, wxT("No valid mac control") ) ;
322 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
326 else if ( !UMAHasAquaLayout() && (IsKindOf( CLASSINFO( wxStaticBox
) ) || IsKindOf( CLASSINFO( wxRadioBox
) ) || IsKindOf( CLASSINFO( wxButton
) ) ) )
328 ControlFontStyleRec controlstyle
;
329 controlstyle
.flags
= kControlUseFontMask
;
330 controlstyle
.font
= kControlFontSmallBoldSystemFont
;
332 ::SetControlFontStyle( (ControlHandle
) m_macControl
, &controlstyle
) ;
336 ControlFontStyleRec controlstyle
;
337 controlstyle
.flags
= kControlUseFontMask
;
339 if (IsKindOf( CLASSINFO( wxButton
) ) )
340 controlstyle
.font
= kControlFontSmallSystemFont
; // eventually kControlFontBigSystemFont ;
342 controlstyle
.font
= kControlFontSmallSystemFont
;
344 ::SetControlFontStyle( (ControlHandle
) m_macControl
, &controlstyle
) ;
346 ControlHandle container
= (ControlHandle
) GetParent()->MacGetContainerForEmbedding() ;
347 wxASSERT_MSG( container
!= NULL
, wxT("No valid mac container control") ) ;
348 ::EmbedControl( (ControlHandle
) m_macControl
, container
) ;
349 m_macControlIsShown
= true ;
351 wxAssociateControlWithMacControl( (ControlHandle
) m_macControl
, this ) ;
352 if ( wxMacSetupControlBackgroundUPP
== NULL
)
354 wxMacSetupControlBackgroundUPP
= NewControlColorUPP( wxMacSetupControlBackground
) ;
356 if ( wxMacControlActionUPP
== NULL
)
358 wxMacControlActionUPP
= NewControlDefUPP( wxMacControlDefinition
) ;
360 // The following block of code is responsible for crashes when switching
361 // back to windows, which can be seen in the dialogs sample.
362 // It is disabled until a proper solution can be found.
366 only working under classic carbon
367 m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ;
368 (**(ControlHandle)m_macControl).contrlDefProc = (Handle) &wxMacControlActionUPP ;
371 m_macControlAction
= *(**(ControlHandle
)m_macControl
).contrlDefProc
;
374 cdef
= (cdefHandle
) NewHandle( sizeof(cdefRec
) ) ;
375 if ( (**(ControlHandle
)m_macControl
).contrlDefProc
!= NULL
)
377 (**cdef
).instruction
= 0x4EF9; /* JMP instruction */
378 (**cdef
).function
= (void(*)()) wxMacControlActionUPP
;
379 (**(ControlHandle
)m_macControl
).contrlDefProc
= (Handle
) cdef
;
383 SetControlColorProc( (ControlHandle
) m_macControl
, wxMacSetupControlBackgroundUPP
) ;
385 // Adjust the controls size and position
386 wxPoint
pos(m_x
, m_y
);
387 wxSize
best_size( DoGetBestSize() );
388 wxSize
new_size( m_width
, m_height
);
390 m_x
= m_y
= m_width
= m_height
= -1; // Forces SetSize to move/size the control
392 if (new_size
.x
== -1) {
393 new_size
.x
= best_size
.x
;
395 if (new_size
.y
== -1) {
396 new_size
.y
= best_size
.y
;
399 SetSize(pos
.x
, pos
.y
, new_size
.x
, new_size
.y
);
402 UMASetControlTitle( (ControlHandle
) m_macControl
, wxStripMenuCodes(m_label
) ) ;
405 UMAShowControl( (ControlHandle
) m_macControl
) ;
407 SetCursor( *wxSTANDARD_CURSOR
) ;
412 void wxControl::MacAdjustControlRect()
414 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, wxT("No valid mac control") ) ;
415 if ( m_width
== -1 || m_height
== -1 )
417 Rect bestsize
= { 0 , 0 , 0 , 0 } ;
418 short baselineoffset
;
420 ::GetBestControlRect( (ControlHandle
) m_macControl
, &bestsize
, &baselineoffset
) ;
422 if ( EmptyRect( &bestsize
) )
425 bestsize
.left
= bestsize
.top
= 0 ;
426 bestsize
.right
= 16 ;
427 bestsize
.bottom
= 16 ;
428 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
430 bestsize
.bottom
= 16 ;
432 else if ( IsKindOf( CLASSINFO( wxSpinButton
) ) )
434 bestsize
.bottom
= 24 ;
440 if ( IsKindOf( CLASSINFO( wxButton
) ) )
442 m_width
= m_label
.Length() * 8 + 12 ;
446 else if ( IsKindOf( CLASSINFO( wxStaticText
) ) )
448 m_width
= m_label
.Length() * 8 ;
451 m_width
= bestsize
.right
- bestsize
.left
;
453 m_width
+= 2 * m_macHorizontalBorder
+ MacGetLeftBorderSize() + MacGetRightBorderSize() ;
455 if ( m_height
== -1 )
457 m_height
= bestsize
.bottom
- bestsize
.top
;
461 m_height
+= 2 * m_macVerticalBorder
+ MacGetTopBorderSize() + MacGetBottomBorderSize() ;
463 MacUpdateDimensions() ;
464 // UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
468 WXWidget
wxControl::MacGetContainerForEmbedding()
471 return m_macControl
;
473 return wxWindow::MacGetContainerForEmbedding() ;
476 void wxControl::MacUpdateDimensions()
478 // actually in the current systems this should never be possible, but later reparenting
479 // may become a reality
481 if ( (ControlHandle
) m_macControl
== NULL
)
484 if ( GetParent() == NULL
)
487 WindowRef rootwindow
= (WindowRef
) MacGetRootWindow() ;
488 if ( rootwindow
== NULL
)
492 GetControlBounds( (ControlHandle
) m_macControl
, &oldBounds
) ;
494 int new_x
= m_x
+ MacGetLeftBorderSize() + m_macHorizontalBorder
;
495 int new_y
= m_y
+ MacGetTopBorderSize() + m_macVerticalBorder
;
496 int new_width
= m_width
- MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder
;
497 int new_height
= m_height
- MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder
;
499 GetParent()->MacWindowToRootWindow( & new_x
, & new_y
) ;
500 bool doMove
= new_x
!= oldBounds
.left
|| new_y
!= oldBounds
.top
;
501 bool doResize
= ( oldBounds
.right
- oldBounds
.left
) != new_width
|| (oldBounds
.bottom
- oldBounds
.top
) != new_height
;
502 if ( doMove
|| doResize
)
504 InvalWindowRect( rootwindow
, &oldBounds
) ;
507 UMAMoveControl( (ControlHandle
) m_macControl
, new_x
, new_y
) ;
511 UMASizeControl( (ControlHandle
) m_macControl
, new_width
, new_height
) ;
516 void wxControl::MacSuperChangedPosition()
518 MacUpdateDimensions() ;
519 wxWindow::MacSuperChangedPosition() ;
522 void wxControl::MacSuperEnabled( bool enabled
)
525 wxWindow::MacSuperEnabled( enabled
) ;
528 void wxControl::MacSuperShown( bool show
)
530 if ( (ControlHandle
) m_macControl
)
534 if ( m_macControlIsShown
)
536 ::UMAHideControl( (ControlHandle
) m_macControl
) ;
537 m_macControlIsShown
= false ;
542 if ( MacIsReallyShown() && !m_macControlIsShown
)
544 ::UMAShowControl( (ControlHandle
) m_macControl
) ;
545 m_macControlIsShown
= true ;
550 wxWindow::MacSuperShown( show
) ;
553 void wxControl::DoSetSize(int x
, int y
,
554 int width
, int height
,
557 wxWindow::DoSetSize( x
, y
,width
, height
,sizeFlags
) ;
560 Rect meta
, control
;
561 GetControlBounds( (ControlHandle
) m_macControl
, &control
) ;
562 RgnHandle rgn
= NewRgn() ;
563 GetControlRegion( (ControlHandle
) m_macControl
, kControlStructureMetaPart
, rgn
) ;
564 GetRegionBounds( rgn
, &meta
) ;
565 if ( !EmptyRect( &meta
) )
567 wxASSERT( meta
.left
>= control
.left
- m_macHorizontalBorder
) ;
568 wxASSERT( meta
.right
<= control
.right
+ m_macHorizontalBorder
) ;
569 wxASSERT( meta
.top
>= control
.top
- m_macVerticalBorder
) ;
570 wxASSERT( meta
.bottom
<= control
.bottom
+ m_macVerticalBorder
) ;
578 if ( (ControlHandle) m_macControl == NULL )
580 wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
585 int new_x, new_y, new_width, new_height;
591 new_height = m_height;
593 if (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)
602 if (x != -1) new_x = x;
603 if (y != -1) new_y = y;
604 if (width != -1) new_width = width;
605 if (height != -1) new_height = height;
608 if(sizeFlags & wxSIZE_AUTO)
610 wxSize size = GetBestSize();
611 if (sizeFlags & wxSIZE_AUTO_WIDTH)
613 if (width == -1) new_width = size.x;
615 if (sizeFlags & wxSIZE_AUTO_HEIGHT)
617 if (height == -1) new_height = size.y;
620 AdjustForParentClientOrigin(new_x, new_y, sizeFlags);
625 GetParent()->MacWindowToRootWindow(&mac_x, &mac_y);
627 GetControlBounds( (ControlHandle) m_macControl, &oldbounds);
628 oldbounds.right = oldbounds.left + m_width;
629 oldbounds.bottom = oldbounds.top + m_height;
632 bool doResize = false;
634 if ( mac_x != (oldbounds.left - m_macHorizontalBorder) ||
635 mac_y != (oldbounds.top - m_macVerticalBorder) )
639 if ( new_width != oldbounds.right - oldbounds.left - 2 * m_macHorizontalBorder ||
640 new_height != oldbounds.bottom - oldbounds.top - 2 * m_macVerticalBorder)
645 if ( doMove || doResize )
649 // Ensure resize is within constraints
650 if ((m_minWidth != -1) && (new_width < m_minWidth)) {
651 new_width = m_minWidth;
653 if ((m_minHeight != -1) && (new_height < m_minHeight)) {
654 new_height = m_minHeight;
656 if ((m_maxWidth != -1) && (new_width > m_maxWidth)) {
657 new_width = m_maxWidth;
659 if ((m_maxHeight != -1) && (new_height > m_maxHeight)) {
660 new_height = m_maxHeight;
668 UMAMoveControl( (ControlHandle) m_macControl,
669 mac_x + m_macHorizontalBorder, mac_y + m_macVerticalBorder);
671 wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
672 event.SetEventObject(this);
673 GetEventHandler()->ProcessEvent(event) ;
678 m_height = new_height;
680 UMASizeControl( (ControlHandle) m_macControl,
681 m_width - 2 * m_macHorizontalBorder,
682 m_height - 2 * m_macVerticalBorder ) ;
685 wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
686 event.SetEventObject(this);
687 GetEventHandler()->ProcessEvent(event);
695 bool wxControl::Show(bool show
)
697 if ( !wxWindow::Show( show
) )
700 if ( (ControlHandle
) m_macControl
)
704 if ( m_macControlIsShown
)
706 ::UMAHideControl( (ControlHandle
) m_macControl
) ;
707 m_macControlIsShown
= false ;
712 if ( MacIsReallyShown() && !m_macControlIsShown
)
714 ::UMAShowControl( (ControlHandle
) m_macControl
) ;
715 m_macControlIsShown
= true ;
722 bool wxControl::Enable(bool enable
)
724 if ( !wxWindow::Enable(enable
) )
727 if ( (ControlHandle
) m_macControl
)
730 UMAActivateControl( (ControlHandle
) m_macControl
) ;
732 UMADeactivateControl( (ControlHandle
) m_macControl
) ;
737 void wxControl::Refresh(bool eraseBack
, const wxRect
*rect
)
739 wxWindow::Refresh( eraseBack
, rect
) ;
742 void wxControl::MacRedrawControl()
744 if ( (ControlHandle
) m_macControl
&& MacGetRootWindow() && m_macControlIsShown
)
746 wxClientDC
dc(this) ;
747 wxMacPortSetter
helper(&dc
) ;
748 wxMacWindowClipper
clipper(this) ;
749 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
750 UMADrawControl( (ControlHandle
) m_macControl
) ;
754 void wxControl::OnPaint(wxPaintEvent
& event
)
756 if ( (ControlHandle
) m_macControl
)
759 wxMacPortSetter
helper(&dc
) ;
760 wxMacWindowClipper
clipper(this) ;
761 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
762 UMADrawControl( (ControlHandle
) m_macControl
) ;
769 void wxControl::OnEraseBackground(wxEraseEvent
& event
)
771 wxWindow::OnEraseBackground( event
) ;
774 void wxControl::OnKeyDown( wxKeyEvent
&event
)
776 if ( (ControlHandle
) m_macControl
== NULL
)
785 GetEventParameter( (EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyMacCharCodes
, typeChar
, NULL
,sizeof(char), NULL
,&charCode
);
786 GetEventParameter( (EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyCode
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &keyCode
);
787 GetEventParameter((EventRef
) wxTheApp
->MacGetCurrentEvent(), kEventParamKeyModifiers
, typeUInt32
, NULL
, sizeof(UInt32
), NULL
, &modifiers
);
789 ::HandleControlKey( (ControlHandle
) m_macControl
, keyCode
, charCode
, modifiers
) ;
792 EventRecord
*ev
= (EventRecord
*) wxTheApp
->MacGetCurrentEvent() ;
795 keychar
= short(ev
->message
& charCodeMask
);
796 keycode
= short(ev
->message
& keyCodeMask
) >> 8 ;
798 ::HandleControlKey( (ControlHandle
) m_macControl
, keycode
, keychar
, ev
->modifiers
) ;
802 void wxControl::OnMouseEvent( wxMouseEvent
&event
)
804 if ( (ControlHandle
) m_macControl
== NULL
)
810 if (event
.GetEventType() == wxEVT_LEFT_DOWN
|| event
.GetEventType() == wxEVT_LEFT_DCLICK
)
816 MacClientToRootWindow( &x
, &y
) ;
818 ControlHandle control
;
827 if ( !event
.m_leftDown
&& !event
.m_rightDown
)
828 modifiers
|= btnState
;
830 if ( event
.m_shiftDown
)
831 modifiers
|= shiftKey
;
833 if ( event
.m_controlDown
)
834 modifiers
|= controlKey
;
836 if ( event
.m_altDown
)
837 modifiers
|= optionKey
;
839 if ( event
.m_metaDown
)
840 modifiers
|= cmdKey
;
842 control
= (ControlHandle
) m_macControl
;
843 if ( control
&& ::IsControlActive( control
) )
846 controlpart
= ::HandleControlClick( control
, localwhere
, modifiers
, (ControlActionUPP
) -1 ) ;
847 wxTheApp
->s_lastMouseDown
= 0 ;
848 if ( control
&& controlpart
!= kControlNoPart
)
850 MacHandleControlClick( control
, controlpart
, false /* mouse not down anymore */ ) ;
862 bool wxControl::MacCanFocus() const
864 if ( (ControlHandle
) m_macControl
== NULL
)
870 void wxControl::MacHandleControlClick( WXWidget control
, wxInt16 controlpart
, bool WXUNUSED( mouseStillDown
) )
872 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, wxT("No valid mac control") ) ;