1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
8 // Copyright: (c) AUTHOR
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_CHAR( wxControl::OnKeyDown )
40 EVT_PAINT( wxControl::OnPaint
)
44 #include "wx/mac/uma.h"
45 #include "wx/mac/private.h"
49 ControlActionUPP wxMacLiveScrollbarActionUPP
= NULL
;
51 pascal void wxMacLiveScrollbarActionProc( ControlHandle control
, ControlPartCode partCode
) ;
52 pascal void wxMacLiveScrollbarActionProc( ControlHandle control
, ControlPartCode partCode
)
56 wxControl
* wx
= (wxControl
*) GetControlReference( control
) ;
59 wx
->MacHandleControlClick( control
, partCode
) ;
64 ControlColorUPP wxMacSetupControlBackgroundUPP
= NULL
;
66 pascal OSStatus
wxMacSetupControlBackground( ControlRef iControl
, SInt16 iMessage
, SInt16 iDepth
, Boolean iIsColor
)
68 OSStatus status
= noErr
;
71 case kControlMsgSetUpBackground
:
73 wxControl
* wx
= (wxControl
*) GetControlReference( iControl
) ;
74 if ( wx
!= NULL
&& wx
->IsKindOf( CLASSINFO( wxControl
) ) )
76 wxDC::MacSetupBackgroundForCurrentPort( wx
->MacGetBackgroundBrush() ) ;
77 // SetThemeBackground( iDepth , iIsColor ) ;
92 wxControl::wxControl()
95 m_macHorizontalBorder
= 0 ; // additional pixels around the real control
96 m_macVerticalBorder
= 0 ;
97 m_backgroundColour
= *wxWHITE
;
98 m_foregroundColour
= *wxBLACK
;
99 #if WXWIN_COMPATIBILITY
101 #endif // WXWIN_COMPATIBILITY
103 if ( wxMacLiveScrollbarActionUPP
== NULL
)
105 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
106 wxMacLiveScrollbarActionUPP
= NewControlActionUPP( wxMacLiveScrollbarActionProc
);
108 wxMacLiveScrollbarActionUPP
= NewControlActionProc( wxMacLiveScrollbarActionProc
) ;
113 bool wxControl::Create(wxWindow
*parent
, wxWindowID id
,
115 const wxSize
& size
, long style
,
116 const wxValidator
& validator
,
117 const wxString
& name
)
119 m_macControl
= NULL
;
120 m_macHorizontalBorder
= 0 ; // additional pixels around the real control
121 m_macVerticalBorder
= 0 ;
123 bool rval
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
126 m_backgroundColour
= parent
->GetBackgroundColour() ;
127 m_foregroundColour
= parent
->GetForegroundColour() ;
131 SetValidator(validator
);
137 wxControl::~wxControl()
139 m_isBeingDeleted
= TRUE
;
140 // If we delete an item, we should initialize the parent panel,
141 // because it could now be invalid.
142 wxWindow
*parent
= GetParent() ;
145 if (parent
->GetDefaultItem() == (wxButton
*) this)
146 parent
->SetDefaultItem(NULL
);
148 if ( (ControlHandle
) m_macControl
)
150 ::DisposeControl( (ControlHandle
) m_macControl
) ;
151 m_macControl
= NULL
;
155 void wxControl::SetLabel(const wxString
& title
)
157 m_label
= wxStripMenuCodes(title
) ;
159 if ( (ControlHandle
) m_macControl
)
164 if( wxApp::s_macDefaultEncodingIsPC
)
165 label
= wxMacMakeMacStringFromPC( m_label
) ;
170 c2pstrcpy( (StringPtr
) maclabel
, label
) ;
172 strcpy( (char *) maclabel
, label
) ;
173 c2pstr( (char *) maclabel
) ;
175 ::SetControlTitle( (ControlHandle
) m_macControl
, maclabel
) ;
180 wxSize
wxControl::DoGetBestSize() const
182 Rect bestsize
= { 0 , 0 , 0 , 0 } ;
183 short baselineoffset
;
184 int bestWidth
, bestHeight
;
185 ::GetBestControlRect( (ControlHandle
) m_macControl
, &bestsize
, &baselineoffset
) ;
187 if ( EmptyRect( &bestsize
) )
190 bestsize
.left
= bestsize
.top
= 0 ;
191 bestsize
.right
= 16 ;
192 bestsize
.bottom
= 16 ;
193 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
195 bestsize
.bottom
= 16 ;
197 else if ( IsKindOf( CLASSINFO( wxSpinButton
) ) )
199 bestsize
.bottom
= 24 ;
203 if ( IsKindOf( CLASSINFO( wxButton
) ) )
205 bestWidth
= m_label
.Length() * 8 + 12 ;
206 if ( bestWidth
< 70 )
209 else if ( IsKindOf( CLASSINFO( wxStaticText
) ) )
211 bestWidth
= m_label
.Length() * 8 ;
214 bestWidth
= bestsize
.right
- bestsize
.left
;
216 bestWidth
+= 2 * m_macHorizontalBorder
;
218 bestHeight
= bestsize
.bottom
- bestsize
.top
;
219 if ( bestHeight
< 10 )
222 bestHeight
+= 2 * m_macVerticalBorder
;
225 return wxSize(bestWidth
, bestHeight
);
228 bool wxControl::ProcessCommand (wxCommandEvent
& event
)
231 // 1) A callback function (to become obsolete)
232 // 2) OnCommand, starting at this window and working up parent hierarchy
233 // 3) OnCommand then calls ProcessEvent to search the event tables.
234 #if WXWIN_COMPATIBILITY
237 (void)(*m_callback
)(this, event
);
242 #endif // WXWIN_COMPATIBILITY
244 return GetEventHandler()->ProcessEvent(event
);
248 // ------------------------
249 wxList
*wxWinMacControlList
= NULL
;
250 wxControl
*wxFindControlFromMacControl(ControlHandle inControl
)
252 wxNode
*node
= wxWinMacControlList
->Find((long)inControl
);
255 return (wxControl
*)node
->Data();
258 void wxAssociateControlWithMacControl(ControlHandle inControl
, wxControl
*control
)
260 // adding NULL WindowRef is (first) surely a result of an error and
261 // (secondly) breaks menu command processing
262 wxCHECK_RET( inControl
!= (ControlHandle
) NULL
, "attempt to add a NULL WindowRef to window list" );
264 if ( !wxWinMacControlList
->Find((long)inControl
) )
265 wxWinMacControlList
->Append((long)inControl
, control
);
268 void wxRemoveMacControlAssociation(wxControl
*control
)
270 wxWinMacControlList
->DeleteObject(control
);
273 void wxControl::MacPreControlCreate( wxWindow
*parent
, wxWindowID id
, wxString label
,
275 const wxSize
& size
, long style
,
276 const wxValidator
& validator
,
277 const wxString
& name
, WXRECTPTR outBounds
, unsigned char* maclabel
)
282 SetValidator(validator
);
284 m_windowStyle
= style
;
285 parent
->AddChild(this);
287 m_backgroundColour
= parent
->GetBackgroundColour() ;
288 m_foregroundColour
= parent
->GetForegroundColour() ;
291 m_windowId
= NewControlId();
295 // These sizes will be adjusted in MacPostControlCreate
302 ((Rect
*)outBounds
)->top
= -10;
303 ((Rect
*)outBounds
)->left
= -10;
304 ((Rect
*)outBounds
)->bottom
= 0;
305 ((Rect
*)outBounds
)->right
= 0;
308 strcpy( c_text
, label
) ;
309 if( wxApp::s_macDefaultEncodingIsPC
)
311 wxMacConvertFromPCForControls( c_text
) ;
315 c2pstrcpy( (StringPtr
) maclabel
, c_text
) ;
317 strcpy( (char *) maclabel
, c_text
) ;
318 c2pstr( (char *) maclabel
) ;
322 void wxControl::MacPostControlCreate()
324 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, "No valid mac control" ) ;
326 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
330 else if ( !UMAHasAquaLayout() && (IsKindOf( CLASSINFO( wxStaticBox
) ) || IsKindOf( CLASSINFO( wxRadioBox
) ) || IsKindOf( CLASSINFO( wxButton
) ) ) )
332 ControlFontStyleRec controlstyle
;
333 controlstyle
.flags
= kControlUseFontMask
;
334 controlstyle
.font
= kControlFontSmallBoldSystemFont
;
336 ::SetControlFontStyle( (ControlHandle
) m_macControl
, &controlstyle
) ;
340 ControlFontStyleRec controlstyle
;
341 controlstyle
.flags
= kControlUseFontMask
;
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 ) ;
353 if ( wxMacSetupControlBackgroundUPP
== NULL
)
355 wxMacSetupControlBackgroundUPP
= NewControlColorUPP( wxMacSetupControlBackground
) ;
357 SetControlColorProc( (ControlHandle
) m_macControl
, wxMacSetupControlBackgroundUPP
) ;
359 // Adjust the controls size and position
360 wxPoint
pos(m_x
, m_y
);
361 wxSize
best_size( DoGetBestSize() );
362 wxSize
new_size( m_width
, m_height
);
364 m_x
= m_y
= m_width
= m_height
= -1; // Forces SetSize to move/size the control
366 if (new_size
.x
== -1) {
367 new_size
.x
= best_size
.x
;
369 if (new_size
.y
== -1) {
370 new_size
.y
= best_size
.y
;
373 SetSize(pos
.x
, pos
.y
, new_size
.x
, new_size
.y
);
375 UMAShowControl( (ControlHandle
) m_macControl
) ;
379 void wxControl::MacAdjustControlRect()
381 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, wxT("No valid mac control") ) ;
382 if ( m_width
== -1 || m_height
== -1 )
384 Rect bestsize
= { 0 , 0 , 0 , 0 } ;
385 short baselineoffset
;
387 ::GetBestControlRect( (ControlHandle
) m_macControl
, &bestsize
, &baselineoffset
) ;
389 if ( EmptyRect( &bestsize
) )
392 bestsize
.left
= bestsize
.top
= 0 ;
393 bestsize
.right
= 16 ;
394 bestsize
.bottom
= 16 ;
395 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
397 bestsize
.bottom
= 16 ;
399 else if ( IsKindOf( CLASSINFO( wxSpinButton
) ) )
401 bestsize
.bottom
= 24 ;
407 if ( IsKindOf( CLASSINFO( wxButton
) ) )
409 m_width
= m_label
.Length() * 8 + 12 ;
413 else if ( IsKindOf( CLASSINFO( wxStaticText
) ) )
415 m_width
= m_label
.Length() * 8 ;
418 m_width
= bestsize
.right
- bestsize
.left
;
420 m_width
+= 2 * m_macHorizontalBorder
+ MacGetLeftBorderSize() + MacGetRightBorderSize() ;
422 if ( m_height
== -1 )
424 m_height
= bestsize
.bottom
- bestsize
.top
;
428 m_height
+= 2 * m_macVerticalBorder
+ MacGetTopBorderSize() + MacGetBottomBorderSize() ;
430 MacUpdateDimensions() ;
431 // UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
435 WXWidget
wxControl::MacGetContainerForEmbedding()
438 return m_macControl
;
440 return wxWindow::MacGetContainerForEmbedding() ;
443 void wxControl::MacUpdateDimensions()
445 // actually in the current systems this should never be possible, but later reparenting
446 // may become a reality
448 if ( (ControlHandle
) m_macControl
== NULL
)
451 if ( GetParent() == NULL
)
454 WindowRef rootwindow
= (WindowRef
) MacGetRootWindow() ;
455 if ( rootwindow
== NULL
)
459 GetControlBounds( (ControlHandle
) m_macControl
, &oldBounds
) ;
461 int new_x
= m_x
+ MacGetLeftBorderSize() + m_macHorizontalBorder
;
462 int new_y
= m_y
+ MacGetTopBorderSize() + m_macVerticalBorder
;
463 int new_width
= m_width
- MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder
;
464 int new_height
= m_height
- MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder
;
466 GetParent()->MacWindowToRootWindow( & new_x
, & new_y
) ;
467 bool doMove
= new_x
!= oldBounds
.left
|| new_y
!= oldBounds
.top
;
468 bool doResize
= ( oldBounds
.right
- oldBounds
.left
) != new_width
|| (oldBounds
.bottom
- oldBounds
.top
) != new_height
;
469 if ( doMove
|| doResize
)
471 InvalWindowRect( rootwindow
, &oldBounds
) ;
474 UMAMoveControl( (ControlHandle
) m_macControl
, new_x
, new_y
) ;
478 UMASizeControl( (ControlHandle
) m_macControl
, new_width
, new_height
) ;
483 void wxControl::MacSuperChangedPosition()
485 MacUpdateDimensions() ;
486 wxWindow::MacSuperChangedPosition() ;
489 void wxControl::MacSuperEnabled( bool enabled
)
492 wxWindow::MacSuperEnabled( enabled
) ;
495 void wxControl::MacSuperShown( bool show
)
497 if ( (ControlHandle
) m_macControl
)
501 if ( m_macControlIsShown
)
503 ::UMAHideControl( (ControlHandle
) m_macControl
) ;
504 m_macControlIsShown
= false ;
509 if ( MacIsReallyShown() && !m_macControlIsShown
)
511 ::UMAShowControl( (ControlHandle
) m_macControl
) ;
512 m_macControlIsShown
= true ;
517 wxWindow::MacSuperShown( show
) ;
520 void wxControl::DoSetSize(int x
, int y
,
521 int width
, int height
,
524 wxWindow::DoSetSize( x
, y
,width
, height
,sizeFlags
) ;
528 if ( (ControlHandle) m_macControl == NULL )
530 wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
535 int new_x, new_y, new_width, new_height;
541 new_height = m_height;
543 if (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)
552 if (x != -1) new_x = x;
553 if (y != -1) new_y = y;
554 if (width != -1) new_width = width;
555 if (height != -1) new_height = height;
558 if(sizeFlags & wxSIZE_AUTO)
560 wxSize size = GetBestSize();
561 if (sizeFlags & wxSIZE_AUTO_WIDTH)
563 if (width == -1) new_width = size.x;
565 if (sizeFlags & wxSIZE_AUTO_HEIGHT)
567 if (height == -1) new_height = size.y;
570 AdjustForParentClientOrigin(new_x, new_y, sizeFlags);
575 GetParent()->MacWindowToRootWindow(&mac_x, &mac_y);
577 GetControlBounds( (ControlHandle) m_macControl, &oldbounds);
578 oldbounds.right = oldbounds.left + m_width;
579 oldbounds.bottom = oldbounds.top + m_height;
582 bool doResize = false;
584 if ( mac_x != (oldbounds.left - m_macHorizontalBorder) ||
585 mac_y != (oldbounds.top - m_macVerticalBorder) )
589 if ( new_width != oldbounds.right - oldbounds.left - 2 * m_macHorizontalBorder ||
590 new_height != oldbounds.bottom - oldbounds.top - 2 * m_macVerticalBorder)
595 if ( doMove || doResize )
599 // Ensure resize is within constraints
600 if ((m_minWidth != -1) && (new_width < m_minWidth)) {
601 new_width = m_minWidth;
603 if ((m_minHeight != -1) && (new_height < m_minHeight)) {
604 new_height = m_minHeight;
606 if ((m_maxWidth != -1) && (new_width > m_maxWidth)) {
607 new_width = m_maxWidth;
609 if ((m_maxHeight != -1) && (new_height > m_maxHeight)) {
610 new_height = m_maxHeight;
618 UMAMoveControl( (ControlHandle) m_macControl,
619 mac_x + m_macHorizontalBorder, mac_y + m_macVerticalBorder);
621 wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
622 event.SetEventObject(this);
623 GetEventHandler()->ProcessEvent(event) ;
628 m_height = new_height;
630 UMASizeControl( (ControlHandle) m_macControl,
631 m_width - 2 * m_macHorizontalBorder,
632 m_height - 2 * m_macVerticalBorder ) ;
635 wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
636 event.SetEventObject(this);
637 GetEventHandler()->ProcessEvent(event);
645 bool wxControl::Show(bool show
)
647 if ( !wxWindow::Show( show
) )
650 if ( (ControlHandle
) m_macControl
)
654 if ( m_macControlIsShown
)
656 ::UMAHideControl( (ControlHandle
) m_macControl
) ;
657 m_macControlIsShown
= false ;
662 if ( MacIsReallyShown() && !m_macControlIsShown
)
664 ::UMAShowControl( (ControlHandle
) m_macControl
) ;
665 m_macControlIsShown
= true ;
672 bool wxControl::Enable(bool enable
)
674 if ( !wxWindow::Enable(enable
) )
677 if ( (ControlHandle
) m_macControl
)
680 UMAActivateControl( (ControlHandle
) m_macControl
) ;
682 UMADeactivateControl( (ControlHandle
) m_macControl
) ;
687 void wxControl::Refresh(bool eraseBack
, const wxRect
*rect
)
689 wxWindow::Refresh( eraseBack
, rect
) ;
692 void wxControl::MacRedrawControl()
694 if ( (ControlHandle
) m_macControl
&& MacGetRootWindow() )
696 wxClientDC
dc(this) ;
697 wxMacPortSetter
helper(&dc
) ;
699 Rect r = { 0 , 0 , 32000 , 32000 } ;
703 wxWindow
*parent
= GetParent() ;
704 parent
->MacWindowToRootWindow( &x
,&y
) ;
705 RgnHandle clrgn
= NewRgn() ;
706 RgnHandle insidergn
= NewRgn() ;
707 wxSize size
= parent
->GetSize() ;
708 SetRectRgn( insidergn
, parent
->MacGetLeftBorderSize() , parent
->MacGetTopBorderSize() ,
709 size
.x
- parent
->MacGetLeftBorderSize() - parent
->MacGetRightBorderSize(),
710 size
.y
- parent
->MacGetTopBorderSize() - parent
->MacGetBottomBorderSize()) ;
712 CopyRgn( (RgnHandle
) parent
->MacGetVisibleRegion(false).GetWXHRGN() , clrgn
) ;
713 SectRgn( clrgn
, insidergn
, clrgn
) ;
714 OffsetRgn( clrgn
, x
, y
) ;
716 DisposeRgn( clrgn
) ;
717 DisposeRgn( insidergn
) ;
719 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
720 UMADrawControl( (ControlHandle
) m_macControl
) ;
724 void wxControl::OnPaint(wxPaintEvent
& event
)
726 if ( (ControlHandle
) m_macControl
)
729 wxMacPortSetter
helper(&dc
) ;
731 Rect r = { 0 , 0 , 32000 , 32000 } ;
736 wxWindow
*parent
= GetParent() ;
737 parent
->MacWindowToRootWindow( &x
,&y
) ;
738 RgnHandle clrgn
= NewRgn() ;
739 RgnHandle insidergn
= NewRgn() ;
740 wxSize size
= parent
->GetSize() ;
741 SetRectRgn( insidergn
, parent
->MacGetLeftBorderSize() , parent
->MacGetTopBorderSize() ,
742 size
.x
- parent
->MacGetLeftBorderSize() - parent
->MacGetRightBorderSize(),
743 size
.y
- parent
->MacGetTopBorderSize() - parent
->MacGetBottomBorderSize()) ;
745 CopyRgn( (RgnHandle
) parent
->MacGetVisibleRegion(false).GetWXHRGN() , clrgn
) ;
746 SectRgn( clrgn
, insidergn
, clrgn
) ;
747 OffsetRgn( clrgn
, x
, y
) ;
749 DisposeRgn( clrgn
) ;
750 DisposeRgn( insidergn
) ;
752 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
753 UMADrawControl( (ControlHandle
) m_macControl
) ;
760 void wxControl::OnEraseBackground(wxEraseEvent
& event
)
762 wxWindow::OnEraseBackground( event
) ;
766 void wxControl::OnKeyDown( wxKeyEvent
&event
)
768 if ( (ControlHandle
) m_macControl
== NULL
)
771 EventRecord
*ev
= (EventRecord
*) wxTheApp
->MacGetCurrentEvent() ;
774 keychar
= short(ev
->message
& charCodeMask
);
775 keycode
= short(ev
->message
& keyCodeMask
) >> 8 ;
777 ::HandleControlKey( (ControlHandle
) m_macControl
, keycode
, keychar
, ev
->modifiers
) ;
780 void wxControl::OnMouseEvent( wxMouseEvent
&event
)
782 if ( (ControlHandle
) m_macControl
== NULL
)
788 if (event
.GetEventType() == wxEVT_LEFT_DOWN
|| event
.GetEventType() == wxEVT_LEFT_DCLICK
)
794 MacClientToRootWindow( &x
, &y
) ;
796 ControlHandle control
;
799 WindowRef window
= (WindowRef
) MacGetRootWindow() ;
806 if ( !event
.m_leftDown
&& !event
.m_rightDown
)
807 modifiers
|= btnState
;
809 if ( event
.m_shiftDown
)
810 modifiers
|= shiftKey
;
812 if ( event
.m_controlDown
)
813 modifiers
|= controlKey
;
815 if ( event
.m_altDown
)
816 modifiers
|= optionKey
;
818 if ( event
.m_metaDown
)
819 modifiers
|= cmdKey
;
822 control = FindControlUnderMouse( localwhere , window , &controlpart ) ;
824 controlpart = FindControl( localwhere , window , &control ) ;
829 if ( AcceptsFocus() && FindFocus() != this )
834 control
= (ControlHandle
) m_macControl
;
835 if ( control
&& ::IsControlActive( control
) )
838 controlpart
= ::HandleControlClick( control
, localwhere
, modifiers
, (ControlActionUPP
) -1 ) ;
839 wxTheApp
->s_lastMouseDown
= 0 ;
840 if ( control
&& controlpart
!= kControlNoPart
&&
841 ! IsKindOf( CLASSINFO( wxScrollBar
) )
842 ) // otherwise we will get the event twice for scrollbar
844 MacHandleControlClick( control
, controlpart
) ;
852 bool wxControl::MacCanFocus() const
854 { if ( (ControlHandle
) m_macControl
== NULL
)
861 void wxControl::MacHandleControlClick( WXWidget control
, wxInt16 controlpart
)
863 wxASSERT_MSG( (ControlHandle
) m_macControl
!= NULL
, "No valid mac control" ) ;