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