-}
-
-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 ) ;
- Refresh() ;
-}
-
-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( MacGetRootWindow() ) ) ;
- 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()->MacWindowToRootWindow( & mac_x , & mac_y ) ;
-
- WindowRef rootwindow = MacGetRootWindow() ;
- wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
-
- wxMacDrawingHelper focus( wxrootwindow ) ;
-
- if ( mac_x + m_macHorizontalBorder != former_mac_x ||
- mac_y + m_macVerticalBorder != 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 ) ;
- }
- }
- }
-
- wxWindow::MacSuperChangedPosition() ;
-}
-
-void wxControl::MacSuperEnabled( bool enabled )
-{
- Refresh(FALSE) ;
- wxWindow::MacSuperEnabled( enabled ) ;
-}
-
-void wxControl::MacSuperShown( bool show )
-{
- if ( m_macControl )
- {
- if ( !show )
- {
- if ( m_macControlIsShown )
- {
- ::UMAHideControl( m_macControl ) ;
- m_macControlIsShown = false ;
- }
- }
- else
- {
- if ( MacIsReallyShown() && !m_macControlIsShown )
- {
- ::UMAShowControl( m_macControl ) ;
- m_macControlIsShown = true ;
- }
- }
- }
-
- wxWindow::MacSuperShown( show ) ;
-}
-
-void wxControl::DoSetSize(int x, int y,
- int width, int height,
- int sizeFlags )
-{
- if ( m_macControl == NULL )
- {
- wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
- return ;
- }