-}
-
-void wxControl::MacPostControlCreate()
-{
- wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
-
- if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
- {
- // no font
- }
- else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) )
- {
- ControlFontStyleRec controlstyle ;
- controlstyle.flags = kControlUseFontMask ;
- controlstyle.font = kControlFontSmallBoldSystemFont ;
-
- ::SetControlFontStyle( m_macControl , &controlstyle ) ;
- }
- else
- {
- ControlFontStyleRec controlstyle ;
- controlstyle.flags = kControlUseFontMask ;
- controlstyle.font = kControlFontSmallSystemFont ;
-
- ::SetControlFontStyle( m_macControl , &controlstyle ) ;
- }
- ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
- wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
- ::EmbedControl( m_macControl , container ) ;
- m_macControlIsShown = true ;
-
- wxAssociateControlWithMacControl( m_macControl , this ) ;
-
-
- // Adjust the controls size and position
- wxPoint pos(m_x, m_y);
- wxSize best_size( DoGetBestSize() );
- wxSize new_size( m_width, m_height );
-
- m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
-
- if (new_size.x == -1) {
- new_size.x = best_size.x;
- }
- if (new_size.y == -1) {
- new_size.y = best_size.y;
- }
-
- SetSize(pos.x, pos.y, new_size.x, new_size.y);
-
- UMAShowControl( m_macControl ) ;
-}
-
-void wxControl::MacAdjustControlRect()
-{
- wxASSERT_MSG( m_macControl != NULL , wxT("No valid mac control") ) ;
- if ( m_width == -1 || m_height == -1 )
- {
- Rect bestsize = { 0 , 0 , 0 , 0 } ;
- short baselineoffset ;
-
- ::GetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
-
- if ( EmptyRect( &bestsize ) )
- {
- baselineoffset = 0;
- bestsize.left = bestsize.top = 0 ;
- bestsize.right = 16 ;
- bestsize.bottom = 16 ;
- if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
- {
- bestsize.bottom = 16 ;
- }
- else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
- {
- bestsize.bottom = 24 ;
- }
- }
-
- if ( m_width == -1 )
- {
- if ( IsKindOf( CLASSINFO( wxButton ) ) )
- {
- m_width = m_label.Length() * 8 + 12 ;
- if ( m_width < 70 )
- m_width = 70 ;
- }
- else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
- {
- m_width = m_label.Length() * 8 ;
- }
- else
- m_width = bestsize.right - bestsize.left ;
-
- m_width += 2 * m_macHorizontalBorder ;
- }
- if ( m_height == -1 )
- {
- m_height = bestsize.bottom - bestsize.top ;
- if ( m_height < 10 )
- m_height = 13 ;
-
- m_height += 2 * m_macVerticalBorder;
- }
-
- wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
- if ( helper.Ok() )
- {
- UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
- }
- }
-}
-ControlHandle wxControl::MacGetContainerForEmbedding()
-{
- if ( m_macControl )
- return m_macControl ;
-
- return wxWindow::MacGetContainerForEmbedding() ;
-}
-
-void wxControl::MacSuperChangedPosition()
-{
- if ( m_macControl )
- {
- Rect contrlRect ;
- GetControlBounds( m_macControl , &contrlRect ) ;
- int former_mac_x = contrlRect.left ;
- int former_mac_y = contrlRect.top ;
- int mac_x = m_x ;
- int mac_y = m_y ;
- GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
-
- WindowRef rootwindow = GetMacRootWindow() ;
- wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
- ::SetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
- wxMacDrawingHelper focus( wxrootwindow ) ;
-
- if ( mac_x != former_mac_x || mac_y != former_mac_y )
- {
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
- UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
- }
- if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
- {
- }
- else
- {
- ::SetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
- }
- }
-
- wxWindow::MacSuperChangedPosition() ;
-}
-
-void wxControl::MacSuperEnabled( bool enabled )
-{
-/*
- if ( m_macControl )
- {
- if ( UMAHasAppearance() )
- {
- if ( !enabled )
- {
- ::DeactivateControl( m_macControl ) ;
- }
- else
- {
- if ( m_macEnabled )
- ::ActivateControl( m_macControl ) ;
- }
- }
- else
- {
- if ( !enabled )
- {
- ::HiliteControl( m_macControl , 255 ) ;
- }
- else
- {
- if ( m_macEnabled )
- ::HiliteControl( m_macControl , 0 ) ;
- }
- }
- }
- wxWindow::MacSuperEnabled( enabled ) ;
-*/
-}