]> git.saurik.com Git - wxWidgets.git/blob - src/mac/control.cpp
changed wxLogWarning('catalog not found') message to wxLogVerbose; wxLocale::Init...
[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 Point localOrigin ;
207 Rect clipRect ;
208
209 parent->MacClientToRootWindow( &x , &y ) ;
210 outBounds->top = y + m_macVerticalBorder ;
211 outBounds->left = x + m_macHorizontalBorder ;
212 outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
213 outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
214
215 strcpy( (char*) maclabel , label ) ;
216 if( wxApp::s_macDefaultEncodingIsPC )
217 {
218 wxMacConvertFromPCForControls( (char*) maclabel ) ;
219 }
220
221 c2pstr( (char*) maclabel ) ;
222 }
223
224 void wxControl::MacPostControlCreate()
225 {
226 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
227
228 if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
229 {
230 // no font
231 }
232 else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) )
233 {
234 ControlFontStyleRec controlstyle ;
235 controlstyle.flags = kControlUseFontMask ;
236 controlstyle.font = kControlFontSmallBoldSystemFont ;
237
238 ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
239 }
240 else
241 {
242 ControlFontStyleRec controlstyle ;
243 controlstyle.flags = kControlUseFontMask ;
244 controlstyle.font = kControlFontSmallSystemFont ;
245
246 ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
247 }
248 ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
249 wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
250 ::UMAEmbedControl( m_macControl , container ) ;
251 MacAdjustControlRect() ;
252 wxAssociateControlWithMacControl( m_macControl , this ) ;
253 }
254
255 void wxControl::MacAdjustControlRect()
256 {
257 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
258 if ( m_width == -1 || m_height == -1 )
259 {
260 Rect bestsize = { 0 , 0 , 0 , 0 } ;
261 short baselineoffset ;
262
263 UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
264
265 if ( EmptyRect( &bestsize ) )
266 {
267 baselineoffset = 0;
268 bestsize.left = bestsize.top = 0 ;
269 bestsize.right = 16 ;
270 bestsize.bottom = 16 ;
271 if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
272 {
273 bestsize.bottom = 16 ;
274 }
275 else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
276 {
277 bestsize.bottom = 24 ;
278 }
279 }
280
281 if ( m_width == -1 )
282 {
283 if ( IsKindOf( CLASSINFO( wxButton ) ) )
284 {
285 m_width = m_label.Length() * 8 + 12 ;
286 }
287 else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
288 {
289 m_width = m_label.Length() * 8 ;
290 }
291 else
292 m_width = bestsize.right - bestsize.left ;
293
294 m_width += 2 * m_macHorizontalBorder ;
295 }
296 if ( m_height == -1 )
297 {
298 m_height = bestsize.bottom - bestsize.top ;
299 if ( m_height < 10 )
300 m_height = 13 ;
301
302 m_height += 2 * m_macVerticalBorder;
303 }
304
305 wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
306 if ( helper.Ok() )
307 {
308 UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
309 }
310 }
311 }
312 ControlHandle wxControl::MacGetContainerForEmbedding()
313 {
314 if ( m_macControl )
315 return m_macControl ;
316
317 return wxWindow::MacGetContainerForEmbedding() ;
318 }
319
320 void wxControl::MacSuperChangedPosition()
321 {
322 if ( m_macControl )
323 {
324 Rect contrlRect ;
325 GetControlBounds( m_macControl , &contrlRect ) ;
326 int former_mac_x = contrlRect.left ;
327 int former_mac_y = contrlRect.top ;
328 int mac_x = m_x ;
329 int mac_y = m_y ;
330 GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
331
332 WindowRef rootwindow = GetMacRootWindow() ;
333 wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
334 UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
335 wxMacDrawingHelper focus( wxrootwindow ) ;
336
337 if ( mac_x != former_mac_x || mac_y != former_mac_y )
338 {
339 {
340 Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
341 InvalWindowRect( rootwindow , &inval ) ;
342 }
343 UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
344 {
345 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
346 InvalWindowRect( rootwindow , &inval ) ;
347 }
348 }
349 if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
350 {
351 }
352 else
353 {
354 UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
355 }
356 }
357
358 wxWindow::MacSuperChangedPosition() ;
359 }
360
361 void wxControl::MacSuperEnabled( bool enabled )
362 {
363 /*
364 if ( m_macControl )
365 {
366 if ( UMAHasAppearance() )
367 {
368 if ( !enabled )
369 {
370 ::DeactivateControl( m_macControl ) ;
371 }
372 else
373 {
374 if ( m_macEnabled )
375 ::ActivateControl( m_macControl ) ;
376 }
377 }
378 else
379 {
380 if ( !enabled )
381 {
382 ::HiliteControl( m_macControl , 255 ) ;
383 }
384 else
385 {
386 if ( m_macEnabled )
387 ::HiliteControl( m_macControl , 0 ) ;
388 }
389 }
390 }
391 wxWindow::MacSuperEnabled( enabled ) ;
392 */
393 }
394
395 void wxControl::MacSuperShown( bool show )
396 {
397 if ( m_macControl )
398 {
399 if ( !show )
400 {
401 ::UMAHideControl( m_macControl ) ;
402 }
403 else
404 {
405 if ( m_isShown )
406 ::UMAShowControl( m_macControl ) ;
407 }
408 }
409
410 wxWindow::MacSuperShown( show ) ;
411 }
412
413 void wxControl::DoSetSize(int x, int y,
414 int width, int height,
415 int sizeFlags )
416 {
417 if ( m_macControl == NULL )
418 {
419 wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
420 return ;
421 }
422
423 WindowRef rootwindow = GetMacRootWindow() ;
424 wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
425 UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
426
427 int former_x = m_x ;
428 int former_y = m_y ;
429 int former_w = m_width ;
430 int former_h = m_height ;
431
432 Rect contrlRect ;
433 GetControlBounds( m_macControl , &contrlRect ) ;
434 int former_mac_x = contrlRect.left ;
435 int former_mac_y = contrlRect.top ;
436
437 int currentX, currentY;
438 GetPosition(&currentX, &currentY);
439 int currentW,currentH;
440 GetSize(&currentW, &currentH);
441
442 int actualWidth = width;
443 int actualHeight = height;
444 int actualX = x;
445 int actualY = y;
446 if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
447 actualX = currentX;
448 if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
449 actualY = currentY;
450 if (width == -1)
451 actualWidth = currentW ;
452 if (height == -1)
453 actualHeight = currentH ;
454
455 if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
456 return ;
457
458 AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
459 WindowRef macrootwindow = GetMacRootWindow() ;
460 wxMacDrawingHelper focus( wxFindWinFromMacWindow( macrootwindow ) ) ;
461
462 int mac_x = actualX ;
463 int mac_y = actualY ;
464 GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
465
466 if ( mac_x != former_mac_x || mac_y != former_mac_y )
467 {
468 {
469 Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
470 InvalWindowRect( macrootwindow, &inval ) ;
471 }
472 UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
473 {
474 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
475 InvalWindowRect(macrootwindow, &inval ) ;
476 }
477 }
478
479 if ( actualX != former_x || actualY != former_y )
480 {
481 m_x = actualX ;
482 m_y = actualY ;
483
484 MacRepositionScrollBars() ;
485 // To consider -> should the parameters be the effective or the virtual coordinates (AdjustForParent..)
486 wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
487 event.SetEventObject(this);
488 GetEventHandler()->ProcessEvent(event);
489 }
490 if ( actualWidth != former_w || actualHeight != former_h )
491 {
492 {
493 Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
494 InvalWindowRect( macrootwindow, &inval ) ;
495 }
496 m_width = actualWidth ;
497 m_height = actualHeight ;
498
499 UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
500 {
501 Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
502 InvalWindowRect( macrootwindow , &inval ) ;
503 }
504
505 MacRepositionScrollBars() ;
506 wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
507 event.SetEventObject(this);
508 GetEventHandler()->ProcessEvent(event);
509 }
510 if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
511 {
512 }
513 else
514 {
515 UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
516 }
517 }
518
519 bool wxControl::Show(bool show)
520 {
521 if ( !wxWindow::Show( show ) )
522 return FALSE ;
523
524 if ( m_macControl )
525 {
526 if ( show )
527 ::UMAShowControl( m_macControl ) ;
528 else
529 ::UMAHideControl( m_macControl ) ;
530 }
531 return TRUE ;
532 }
533
534 bool wxControl::Enable(bool enable)
535 {
536 if ( !wxWindow::Enable(enable) )
537 return FALSE;
538
539 if ( m_macControl )
540 {
541
542 if ( UMAHasAppearance() )
543 {
544 if ( enable )
545 ::ActivateControl( m_macControl ) ;
546 else
547 ::DeactivateControl( m_macControl ) ;
548 }
549 else
550 {
551 if ( enable )
552 ::HiliteControl( m_macControl , 0 ) ;
553 else
554 ::HiliteControl( m_macControl , 255 ) ;
555 }
556 }
557 return TRUE ;
558 }
559
560 void wxControl::Refresh(bool eraseBack, const wxRect *rect)
561 {
562 if ( m_macControl )
563 {
564 wxWindow::Refresh( eraseBack , rect ) ;
565 }
566 else
567 {
568 wxWindow::Refresh( eraseBack , rect ) ;
569 }
570 }
571
572 void wxControl::MacRedrawControl()
573 {
574 if ( m_macControl )
575 {
576 WindowRef window = GetMacRootWindow() ;
577 if ( window )
578 {
579 wxWindow* win = wxFindWinFromMacWindow( window ) ;
580 if ( win )
581 {
582 wxMacDrawingHelper help( win ) ;
583 // the mac control manager always assumes to have the origin at 0,0
584 SetOrigin( 0 , 0 ) ;
585
586 bool hasTabBehind = false ;
587 wxWindow* parent = GetParent() ;
588 while ( parent )
589 {
590 if( parent->MacGetWindowData() )
591 {
592 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
593 break ;
594 }
595
596 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
597 {
598 if ( ((wxControl*)parent)->m_macControl )
599 SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
600 break ;
601 }
602
603 parent = parent->GetParent() ;
604 }
605
606 UMADrawControl( m_macControl ) ;
607 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
608 }
609 }
610 }
611 }
612
613 void wxControl::OnPaint(wxPaintEvent& event)
614 {
615 if ( m_macControl )
616 {
617 WindowRef window = GetMacRootWindow() ;
618 if ( window )
619 {
620 wxWindow* win = wxFindWinFromMacWindow( window ) ;
621 if ( win )
622 {
623 wxMacDrawingHelper help( win ) ;
624 // the mac control manager always assumes to have the origin at 0,0
625 SetOrigin( 0 , 0 ) ;
626
627 bool hasTabBehind = false ;
628 wxWindow* parent = GetParent() ;
629 while ( parent )
630 {
631 if( parent->MacGetWindowData() )
632 {
633 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
634 break ;
635 }
636
637 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
638 {
639 if ( ((wxControl*)parent)->m_macControl )
640 SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
641 break ;
642 }
643
644 parent = parent->GetParent() ;
645 }
646
647 UMADrawControl( m_macControl ) ;
648 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
649 }
650 }
651 }
652 else
653 {
654 // wxWindow::OnPaint( event ) ;
655 }
656 }
657 void wxControl::OnEraseBackground(wxEraseEvent& event)
658 {
659 // In general, you don't want to erase the background of a control,
660 // or you'll get a flicker.
661 // TODO: move this 'null' function into each control that
662 // might flicker.
663 }
664
665
666 void wxControl::OnKeyDown( wxKeyEvent &event )
667 {
668 if ( m_macControl == NULL )
669 return ;
670
671 EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
672 short keycode ;
673 short keychar ;
674 keychar = short(ev->message & charCodeMask);
675 keycode = short(ev->message & keyCodeMask) >> 8 ;
676
677 UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
678 }
679
680 void wxControl::OnMouseEvent( wxMouseEvent &event )
681 {
682 if ( m_macControl == NULL )
683 {
684 event.Skip() ;
685 return ;
686 }
687
688 if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
689 {
690
691 int x = event.m_x ;
692 int y = event.m_y ;
693
694 MacClientToRootWindow( &x , &y ) ;
695
696 ControlHandle control ;
697 Point localwhere ;
698 GrafPtr port ;
699 SInt16 controlpart ;
700 WindowRef window = GetMacRootWindow() ;
701
702 localwhere.h = x ;
703 localwhere.v = y ;
704
705 short modifiers = 0;
706
707 if ( !event.m_leftDown && !event.m_rightDown )
708 modifiers |= btnState ;
709
710 if ( event.m_shiftDown )
711 modifiers |= shiftKey ;
712
713 if ( event.m_controlDown )
714 modifiers |= controlKey ;
715
716 if ( event.m_altDown )
717 modifiers |= optionKey ;
718
719 if ( event.m_metaDown )
720 modifiers |= cmdKey ;
721
722 controlpart = FindControl( localwhere , window , &control ) ;
723 {
724 if ( AcceptsFocus() && FindFocus() != this )
725 {
726 SetFocus() ;
727 }
728 if ( control && UMAIsControlActive( control ) )
729 {
730 {
731 if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
732 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
733 else
734 controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
735 wxTheApp->s_lastMouseDown = 0 ;
736 if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
737 && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
738 {
739 MacHandleControlClick( control , controlpart ) ;
740 }
741 }
742 }
743 }
744 }
745 }
746
747 bool wxControl::MacCanFocus() const
748 {
749 { if ( m_macControl == NULL )
750 return true ;
751 else
752 return false ;
753 }
754 }
755
756 void wxControl::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
757 {
758 wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
759 }
760