X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39a7aa0467fcaeca022d981fc0d025979423adb3..01299d5694fdccdbec96588ea2fb81a7d597da07:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 6475e3f25d..9d09716b24 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -53,9 +53,11 @@ #include #endif +#if TARGET_API_MAC_OSX #ifndef __HIVIEW__ #include #endif +#endif #if wxUSE_DRAG_AND_DROP #include "wx/dnd.h" @@ -106,6 +108,7 @@ static const EventTypeSpec eventList[] = { kEventClassControl , kEventControlDraw } , // { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only // { kEventClassControl , kEventControlBoundsChanged } , +// kEventControlEnabledStateChanged , kEventControlVisibilityChanged , kEventControlHiliteChanged #else {} #endif @@ -673,8 +676,18 @@ void wxWindowMac::MacUpdateControlFont() fontStyle.size = m_font.MacGetFontSize() ; fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask ; } + + fontStyle.just = teJustLeft ; + fontStyle.flags |= kControlUseJustMask ; + if ( ( GetWindowStyle() & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL ) + fontStyle.just = teJustCenter ; + else if ( ( GetWindowStyle() & wxALIGN_MASK ) & wxALIGN_RIGHT ) + fontStyle.just = teJustRight ; + + fontStyle.foreColor = MAC_WXCOLORREF(GetForegroundColour().GetPixel() ) ; fontStyle.flags |= kControlUseForeColorMask ; + ::SetControlFontStyle( (ControlRef) m_macControl , &fontStyle ); Refresh() ; } @@ -1335,6 +1348,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) wxSize wxWindowMac::DoGetBestSize() const { + /* Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; int bestWidth, bestHeight ; @@ -1366,6 +1380,8 @@ wxSize wxWindowMac::DoGetBestSize() const bestHeight = 13 ; return wxSize(bestWidth, bestHeight); + */ + return wxWindowBase::DoGetBestSize() ; } @@ -1487,6 +1503,41 @@ wxString wxWindowMac::GetTitle() const return m_label ; } +bool wxWindowMac::Show(bool show) +{ + if ( !wxWindowBase::Show(show) ) + return FALSE; + + // TODO use visibilityChanged Carbon Event for OSX + bool former = MacIsReallyShown() ; + + SetControlVisibility( (ControlRef) m_macControl , show , true ) ; + if ( former != MacIsReallyShown() ) + MacPropagateVisibilityChanged() ; + return TRUE; +} + +bool wxWindowMac::Enable(bool enable) +{ + wxASSERT( m_macControl != NULL ) ; + if ( !wxWindowBase::Enable(enable) ) + return FALSE; + + bool former = MacIsReallyEnabled() ; + if ( enable ) + EnableControl( (ControlRef) m_macControl ) ; + else + DisableControl( (ControlRef) m_macControl ) ; + + if ( former != MacIsReallyEnabled() ) + MacPropagateEnabledStateChanged() ; + return TRUE; +} + +// +// status change propagations (will be not necessary for OSX later ) +// + void wxWindowMac::MacPropagateVisibilityChanged() { MacVisibilityChanged() ; @@ -1501,20 +1552,54 @@ void wxWindowMac::MacPropagateVisibilityChanged() } } -bool wxWindowMac::Show(bool show) +void wxWindowMac::MacPropagateEnabledStateChanged( ) { - if ( !wxWindowBase::Show(show) ) - return FALSE; + MacEnabledStateChanged() ; - // TODO use visibilityChanged Carbon Event for OSX - bool former = MacIsReallyShown() ; + wxWindowListNode *node = GetChildren().GetFirst(); + while ( node ) + { + wxWindowMac *child = node->GetData(); + if ( child->IsEnabled() ) + child->MacPropagateEnabledStateChanged() ; + node = node->GetNext(); + } +} + +void wxWindowMac::MacPropagateHiliteChanged( ) +{ + MacHiliteChanged() ; - SetControlVisibility( (ControlRef) m_macControl , show , true ) ; - if ( former != MacIsReallyShown() ) - MacPropagateVisibilityChanged() ; - return TRUE; + wxWindowListNode *node = GetChildren().GetFirst(); + while ( node ) + { + wxWindowMac *child = node->GetData(); + // if ( child->IsEnabled() ) + child->MacPropagateHiliteChanged() ; + node = node->GetNext(); + } +} + +// +// status change notifications +// + +void wxWindowMac::MacVisibilityChanged() +{ +} + +void wxWindowMac::MacHiliteChanged() +{ } +void wxWindowMac::MacEnabledStateChanged() +{ +} + +// +// status queries on the inherited window's state +// + bool wxWindowMac::MacIsReallyShown() { // only under OSX the visibility of the TLW is taken into account @@ -1536,50 +1621,20 @@ bool wxWindowMac::MacIsReallyShown() #endif } -void wxWindowMac::MacVisibilityChanged() -{ -} - -void wxWindowMac::MacPropagateEnabledStateChanged( ) -{ - MacEnabledStateChanged() ; - - wxWindowListNode *node = GetChildren().GetFirst(); - while ( node ) - { - wxWindowMac *child = node->GetData(); - if ( child->IsEnabled() ) - child->MacPropagateEnabledStateChanged() ; - node = node->GetNext(); - } -} - -bool wxWindowMac::Enable(bool enable) -{ - wxASSERT( m_macControl != NULL ) ; - if ( !wxWindowBase::Enable(enable) ) - return FALSE; - - bool former = MacIsReallyEnabled() ; - if ( enable ) - UMAActivateControl( (ControlRef) m_macControl ) ; - else - UMADeactivateControl( (ControlRef) m_macControl ) ; - - if ( former != MacIsReallyEnabled() ) - MacPropagateEnabledStateChanged() ; - return TRUE; -} - bool wxWindowMac::MacIsReallyEnabled() { return IsControlEnabled( (ControlRef) m_macControl ) ; } -void wxWindowMac::MacEnabledStateChanged() +bool wxWindowMac::MacIsReallyHilited() { + return IsControlActive( (ControlRef) m_macControl ) ; } +// +// +// + int wxWindowMac::GetCharHeight() const { wxClientDC dc ( (wxWindowMac*)this ) ; @@ -1709,15 +1764,12 @@ void wxWindowMac::WarpPointer (int x_pos, int y_pos) void wxWindowMac::OnEraseBackground(wxEraseEvent& event) { - event.Skip() ; -/* if ( m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) { event.Skip() ; } else event.GetDC()->Clear() ; -*/ } void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )