]> git.saurik.com Git - wxWidgets.git/blob - src/mac/control.cpp
applied (slightly modified) wxToggleButton patch from John Norris and Axel Schlueter
[wxWidgets.git] / src / mac / control.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.cpp
3 // Purpose: wxControl class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "control.h"
14 #endif
15
16 #include "wx/control.h"
17 #include "wx/notebook.h"
18 #include "wx/tabctrl.h"
19 #include "wx/radiobox.h"
20 #include "wx/spinbutt.h"
21
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
24
25 BEGIN_EVENT_TABLE(wxControl, wxWindow)
26 EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
27 EVT_CHAR( wxControl::OnKeyDown )
28 EVT_PAINT( wxControl::OnPaint )
29 END_EVENT_TABLE()
30 #endif
31
32 #include <wx/mac/uma.h>
33
34 // Item members
35
36 ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
37
38 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode ) ;
39 pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
40 {
41 if ( partCode != 0)
42 {
43 wxControl* wx = (wxControl*) GetControlReference( control ) ;
44 if ( wx )
45 {
46 wx->MacHandleControlClick( control , partCode ) ;
47 }
48 }
49 }
50
51 wxControl::wxControl()
52 {
53 m_macControl = NULL ;
54 m_macHorizontalBorder = 0 ; // additional pixels around the real control
55 m_macVerticalBorder = 0 ;
56 m_backgroundColour = *wxWHITE;
57 m_foregroundColour = *wxBLACK;
58 #if WXWIN_COMPATIBILITY
59 m_callback = 0;
60 #endif // WXWIN_COMPATIBILITY
61
62 if ( wxMacLiveScrollbarActionUPP == NULL )
63 {
64 wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
65 }
66 }
67
68 bool wxControl::Create(wxWindow *parent, wxWindowID id,
69 const wxPoint& pos,
70 const wxSize& size, long style,
71 const wxValidator& validator,
72 const wxString& name)
73 {
74 m_macControl = NULL ;
75 m_macHorizontalBorder = 0 ; // additional pixels around the real control
76 m_macVerticalBorder = 0 ;
77 bool rval = wxWindow::Create(parent, id, pos, size, style, name);
78 if (rval) {
79 #if wxUSE_VALIDATORS
80 SetValidator(validator);
81 #endif
82 }
83 return rval;
84 }
85
86 wxControl::~wxControl()
87 {
88 m_isBeingDeleted = TRUE;
89 // If we delete an item, we should initialize the parent panel,
90 // because it could now be invalid.
91 wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
92 if ( panel )
93 {
94 if (panel->GetDefaultItem() == (wxButton*) this)
95 panel->SetDefaultItem(NULL);
96 }
97 if ( m_macControl )
98 {
99 UMADisposeControl( m_macControl ) ;
100 m_macControl = NULL ;
101 }
102 }
103
104 void wxControl::SetLabel(const wxString& title)
105 {
106 m_label = title ;
107
108 if ( m_macControl )
109 {
110 Str255 maclabel ;
111 wxString label ;
112
113 if( wxApp::s_macDefaultEncodingIsPC )
114 label = wxMacMakeMacStringFromPC( title ) ;
115 else
116 label = title ;
117
118 strcpy( (char*) maclabel , label ) ;
119 c2pstr( (char*) maclabel ) ;
120
121 ::SetControlTitle( m_macControl , maclabel ) ;
122 }
123 }
124
125 wxSize wxControl::DoGetBestSize() const
126 {
127 return wxSize(20, 20);
128 }
129
130 bool wxControl::ProcessCommand (wxCommandEvent & event)
131 {
132 // Tries:
133 // 1) A callback function (to become obsolete)
134 // 2) OnCommand, starting at this window and working up parent hierarchy
135 // 3) OnCommand then calls ProcessEvent to search the event tables.
136 #if WXWIN_COMPATIBILITY
137 if ( m_callback )
138 {
139 (void)(*m_callback)(this, event);
140
141 return TRUE;
142 }
143 else
144 #endif // WXWIN_COMPATIBILITY
145 {
146 return GetEventHandler()->ProcessEvent(event);
147 }
148 }
149
150 // ------------------------
151 wxList *wxWinMacControlList = NULL;
152 wxControl *wxFindControlFromMacControl(ControlHandle inControl )
153 {
154 wxNode *node = wxWinMacControlList->Find((long)inControl);
155 if (!node)
156 return NULL;
157 return (wxControl *)node->Data();
158 }
159
160 void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control)
161 {
162 // adding NULL WindowRef is (first) surely a result of an error and
163 // (secondly) breaks menu command processing
164 wxCHECK_RET( inControl != (ControlHandle) NULL, "attempt to add a NULL WindowRef to window list" );
165
166 if ( !wxWinMacControlList->Find((long)inControl) )
167 wxWinMacControlList->Append((long)inControl, control);
168 }
169
170 void wxRemoveMacControlAssociation(wxControl *control)
171 {
172 wxWinMacControlList->DeleteObject(control);
173 }
174
175 void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
176 const wxPoint& pos,
177 const wxSize& size, long style,
178 const wxValidator& validator,
179 const wxString& name , Rect *outBounds , StringPtr maclabel )
180 {
181 m_label = label ;
182 SetName(name);
183 if ( &validator )
184 SetValidator(validator);
185
186 m_windowStyle = style;
187 parent->AddChild((wxButton *)this);
188
189 m_backgroundColour = parent->GetBackgroundColour() ;
190 m_foregroundColour = parent->GetForegroundColour() ;
191
192 if (id == -1)
193 m_windowId = NewControlId();
194 else
195 m_windowId = id;
196
197 m_width = size.x ;
198 m_height = size.y ;
199 int x = pos.x ;
200 int y = pos.y ;
201 AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
202 m_x = x ;
203 m_y = y ;
204
205
206 parent->MacClientToRootWindow( &x , &y ) ;
207 outBounds->top = y + m_macVerticalBorder ;
208 outBounds->left = x + m_macHorizontalBorder ;
209 outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
210 outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
211
212 strcpy( (char*) maclabel , label ) ;
213 if( wxApp::s_macDefaultEncodingIsPC )
214 {
215 wxMacConvertFromPCForControls( (char*) maclabel ) ;
216 }
217
218 c2pstr( (char*) maclabel ) ;
219 }
220
221 void wxControl::MacPostControlCreate()
222 {
223 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
224
225 if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
226 {
227 // no font
228 }
229 else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) )
230 {
231 ControlFontStyleRec controlstyle ;
232 controlstyle.flags = kControlUseFontMask ;
233 controlstyle.font = kControlFontSmallBoldSystemFont ;
234
235 ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
236 }
237 else
238 {
239 ControlFontStyleRec controlstyle ;
240 controlstyle.flags = kControlUseFontMask ;
241 controlstyle.font = kControlFontSmallSystemFont ;
242
243 ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
244 }
245 ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
246 wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
247 ::UMAEmbedControl( m_macControl , container ) ;
248 MacAdjustControlRect() ;
249 wxAssociateControlWithMacControl( m_macControl , this ) ;
250 }
251
252 void wxControl::MacAdjustControlRect()
253 {
254 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
255 if ( m_width == -1 || m_height == -1 )
256 {
257 Rect bestsize = { 0 , 0 , 0 , 0 } ;
258 short baselineoffset ;
259
260 UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
261
262 if ( EmptyRect( &bestsize ) )
263 {
264 baselineoffset = 0;
265 bestsize.left = bestsize.top = 0 ;
266 bestsize.right = 16 ;
267 bestsize.bottom = 16 ;
268 if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
269 {
270 bestsize.bottom = 16 ;
271 }
272 else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
273 {
274 bestsize.bottom = 24 ;
275 }
276 }
277
278 if ( m_width == -1 )
279 {
280 if ( IsKindOf( CLASSINFO( wxButton ) ) )
281 {
282 m_width = m_label.Length() * 8 + 12 ;
283 }
284 else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
285 {
286 m_width = m_label.Length() * 8 ;
287 }
288 else
289 m_width = bestsize.right - bestsize.left ;
290
291 m_width += 2 * m_macHorizontalBorder ;
292 }
293 if ( m_height == -1 )
294 {
295 m_height = bestsize.bottom - bestsize.top ;
296 if ( m_height < 10 )
297 m_height = 13 ;
298
299 m_height += 2 * m_macVerticalBorder;
300 }
301
302 wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
303 if ( helper.Ok() )
304 {
305 UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
306 }
307 }
308 }
309 ControlHandle wxControl::MacGetContainerForEmbedding()
310 {
311 if ( m_macControl )
312 return m_macControl ;
313
314 return wxWindow::MacGetContainerForEmbedding() ;
315 }
316
317 void wxControl::MacSuperChangedPosition()
318 {
319 if ( m_macControl )
320 {
321 Rect contrlRect ;
322 GetControlBounds( m_macControl , &contrlRect ) ;
323 int former_mac_x = contrlRect.left ;
324 int former_mac_y = contrlRect.top ;
325 int mac_x = m_x ;
326 int mac_y = m_y ;
327 GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
328
329 WindowRef rootwindow = GetMacRootWindow() ;
330 wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
331 UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
332 wxMacDrawingHelper focus( wxrootwindow ) ;
333
334 if ( mac_x != former_mac_x || mac_y != former_mac_y )
335 {
336 {
337 Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
338 InvalWindowRect( rootwindow , &inval ) ;
339 }
340 UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
341 {
342 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
343 InvalWindowRect( rootwindow , &inval ) ;
344 }
345 }
346 if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
347 {
348 }
349 else
350 {
351 UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
352 }
353 }
354
355 wxWindow::MacSuperChangedPosition() ;
356 }
357
358 void wxControl::MacSuperEnabled( bool enabled )
359 {
360 /*
361 if ( m_macControl )
362 {
363 if ( UMAHasAppearance() )
364 {
365 if ( !enabled )
366 {
367 ::DeactivateControl( m_macControl ) ;
368 }
369 else
370 {
371 if ( m_macEnabled )
372 ::ActivateControl( m_macControl ) ;
373 }
374 }
375 else
376 {
377 if ( !enabled )
378 {
379 ::HiliteControl( m_macControl , 255 ) ;
380 }
381 else
382 {
383 if ( m_macEnabled )
384 ::HiliteControl( m_macControl , 0 ) ;
385 }
386 }
387 }
388 wxWindow::MacSuperEnabled( enabled ) ;
389 */
390 }
391
392 void wxControl::MacSuperShown( bool show )
393 {
394 if ( m_macControl )
395 {
396 if ( !show )
397 {
398 ::UMAHideControl( m_macControl ) ;
399 }
400 else
401 {
402 if ( m_isShown )
403 ::UMAShowControl( m_macControl ) ;
404 }
405 }
406
407 wxWindow::MacSuperShown( show ) ;
408 }
409
410 void wxControl::DoSetSize(int x, int y,
411 int width, int height,
412 int sizeFlags )
413 {
414 if ( m_macControl == NULL )
415 {
416 wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
417 return ;
418 }
419
420 WindowRef rootwindow = GetMacRootWindow() ;
421 wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
422 UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
423
424 int former_x = m_x ;
425 int former_y = m_y ;
426 int former_w = m_width ;
427 int former_h = m_height ;
428
429 Rect contrlRect ;
430 GetControlBounds( m_macControl , &contrlRect ) ;
431 int former_mac_x = contrlRect.left ;
432 int former_mac_y = contrlRect.top ;
433
434 int currentX, currentY;
435 GetPosition(&currentX, &currentY);
436 int currentW,currentH;
437 GetSize(&currentW, &currentH);
438
439 int actualWidth = width;
440 int actualHeight = height;
441 int actualX = x;
442 int actualY = y;
443 if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
444 actualX = currentX;
445 if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
446 actualY = currentY;
447 if (width == -1)
448 actualWidth = currentW ;
449 if (height == -1)
450 actualHeight = currentH ;
451
452 if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
453 return ;
454
455 AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
456 WindowRef macrootwindow = GetMacRootWindow() ;
457 wxMacDrawingHelper focus( wxFindWinFromMacWindow( macrootwindow ) ) ;
458
459 int mac_x = actualX ;
460 int mac_y = actualY ;
461 GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
462
463 if ( mac_x != former_mac_x || mac_y != former_mac_y )
464 {
465 {
466 Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
467 InvalWindowRect( macrootwindow, &inval ) ;
468 }
469 UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
470 {
471 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
472 InvalWindowRect(macrootwindow, &inval ) ;
473 }
474 }
475
476 if ( actualX != former_x || actualY != former_y )
477 {
478 m_x = actualX ;
479 m_y = actualY ;
480
481 MacRepositionScrollBars() ;
482 // To consider -> should the parameters be the effective or the virtual coordinates (AdjustForParent..)
483 wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
484 event.SetEventObject(this);
485 GetEventHandler()->ProcessEvent(event);
486 }
487 if ( actualWidth != former_w || actualHeight != former_h )
488 {
489 {
490 Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
491 InvalWindowRect( macrootwindow, &inval ) ;
492 }
493 m_width = actualWidth ;
494 m_height = actualHeight ;
495
496 UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
497 {
498 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
499 InvalWindowRect( macrootwindow , &inval ) ;
500 }
501
502 MacRepositionScrollBars() ;
503 wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
504 event.SetEventObject(this);
505 GetEventHandler()->ProcessEvent(event);
506 }
507 if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
508 {
509 }
510 else
511 {
512 UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
513 }
514 }
515
516 bool wxControl::Show(bool show)
517 {
518 if ( !wxWindow::Show( show ) )
519 return FALSE ;
520
521 if ( m_macControl )
522 {
523 if ( show )
524 ::UMAShowControl( m_macControl ) ;
525 else
526 ::UMAHideControl( m_macControl ) ;
527 }
528 return TRUE ;
529 }
530
531 bool wxControl::Enable(bool enable)
532 {
533 if ( !wxWindow::Enable(enable) )
534 return FALSE;
535
536 if ( m_macControl )
537 {
538
539 if ( UMAHasAppearance() )
540 {
541 if ( enable )
542 ::ActivateControl( m_macControl ) ;
543 else
544 ::DeactivateControl( m_macControl ) ;
545 }
546 else
547 {
548 if ( enable )
549 ::HiliteControl( m_macControl , 0 ) ;
550 else
551 ::HiliteControl( m_macControl , 255 ) ;
552 }
553 }
554 return TRUE ;
555 }
556
557 void wxControl::Refresh(bool eraseBack, const wxRect *rect)
558 {
559 if ( m_macControl )
560 {
561 wxWindow::Refresh( eraseBack , rect ) ;
562 }
563 else
564 {
565 wxWindow::Refresh( eraseBack , rect ) ;
566 }
567 }
568
569 void wxControl::MacRedrawControl()
570 {
571 if ( m_macControl )
572 {
573 WindowRef window = GetMacRootWindow() ;
574 if ( window )
575 {
576 wxWindow* win = wxFindWinFromMacWindow( window ) ;
577 if ( win )
578 {
579 wxMacDrawingHelper help( win ) ;
580 // the mac control manager always assumes to have the origin at 0,0
581 SetOrigin( 0 , 0 ) ;
582
583 bool hasTabBehind = false ;
584 wxWindow* parent = GetParent() ;
585 while ( parent )
586 {
587 if( parent->MacGetWindowData() )
588 {
589 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
590 break ;
591 }
592
593 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
594 {
595 if ( ((wxControl*)parent)->m_macControl )
596 SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
597 break ;
598 }
599
600 parent = parent->GetParent() ;
601 }
602
603 UMADrawControl( m_macControl ) ;
604 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
605 }
606 }
607 }
608 }
609
610 void wxControl::OnPaint(wxPaintEvent& event)
611 {
612 if ( m_macControl )
613 {
614 WindowRef window = GetMacRootWindow() ;
615 if ( window )
616 {
617 wxWindow* win = wxFindWinFromMacWindow( window ) ;
618 if ( win )
619 {
620 wxMacDrawingHelper help( win ) ;
621 // the mac control manager always assumes to have the origin at 0,0
622 SetOrigin( 0 , 0 ) ;
623
624 bool hasTabBehind = false ;
625 wxWindow* parent = GetParent() ;
626 while ( parent )
627 {
628 if( parent->MacGetWindowData() )
629 {
630 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
631 break ;
632 }
633
634 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
635 {
636 if ( ((wxControl*)parent)->m_macControl )
637 SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
638 break ;
639 }
640
641 parent = parent->GetParent() ;
642 }
643
644 UMADrawControl( m_macControl ) ;
645 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
646 }
647 }
648 }
649 else
650 {
651 // wxWindow::OnPaint( event ) ;
652 }
653 }
654 void wxControl::OnEraseBackground(wxEraseEvent& event)
655 {
656 // In general, you don't want to erase the background of a control,
657 // or you'll get a flicker.
658 // TODO: move this 'null' function into each control that
659 // might flicker.
660 }
661
662
663 void wxControl::OnKeyDown( wxKeyEvent &event )
664 {
665 if ( m_macControl == NULL )
666 return ;
667
668 EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
669 short keycode ;
670 short keychar ;
671 keychar = short(ev->message & charCodeMask);
672 keycode = short(ev->message & keyCodeMask) >> 8 ;
673
674 UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
675 }
676
677 void wxControl::OnMouseEvent( wxMouseEvent &event )
678 {
679 if ( m_macControl == NULL )
680 {
681 event.Skip() ;
682 return ;
683 }
684
685 if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
686 {
687
688 int x = event.m_x ;
689 int y = event.m_y ;
690
691 MacClientToRootWindow( &x , &y ) ;
692
693 ControlHandle control ;
694 Point localwhere ;
695 GrafPtr port ;
696 SInt16 controlpart ;
697 WindowRef window = GetMacRootWindow() ;
698
699 localwhere.h = x ;
700 localwhere.v = y ;
701
702 short modifiers = 0;
703
704 if ( !event.m_leftDown && !event.m_rightDown )
705 modifiers |= btnState ;
706
707 if ( event.m_shiftDown )
708 modifiers |= shiftKey ;
709
710 if ( event.m_controlDown )
711 modifiers |= controlKey ;
712
713 if ( event.m_altDown )
714 modifiers |= optionKey ;
715
716 if ( event.m_metaDown )
717 modifiers |= cmdKey ;
718
719 controlpart = FindControl( localwhere , window , &control ) ;
720 {
721 if ( AcceptsFocus() && FindFocus() != this )
722 {
723 SetFocus() ;
724 }
725 if ( control && UMAIsControlActive( control ) )
726 {
727 {
728 if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
729 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
730 else
731 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
732 wxTheApp->s_lastMouseDown = 0 ;
733 if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
734 && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
735 {
736 MacHandleControlClick( control , controlpart ) ;
737 }
738 }
739 }
740 }
741 }
742 }
743
744 bool wxControl::MacCanFocus() const
745 {
746 { if ( m_macControl == NULL )
747 return true ;
748 else
749 return false ;
750 }
751 }
752
753 void wxControl::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
754 {
755 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
756 }
757