X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6239ee05567eac71754f56c2a154222d10b57ff1..2078e2f129c323dd1b01aeef5061f787f8475386:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 92fd22dcb0..e4d51d52a0 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -153,17 +153,6 @@ void wxMacWindowToNative( const wxWindow* window , Rect *rect ) // Carbon Events // --------------------------------------------------------------------------- -#if TARGET_API_MAC_OSX - -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 -enum -{ - kEventControlVisibilityChanged = 157 -}; -#endif - -#endif - static const EventTypeSpec eventList[] = { { kEventClassCommand, kEventProcessCommand } , @@ -259,7 +248,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl #endif { -#if wxMAC_USE_CORE_GRAPHICS bool created = false ; CGContextRef cgContext = NULL ; OSStatus err = cEvent.GetParameter(kEventParamCGContextRef, &cgContext) ; @@ -289,18 +277,14 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl CGContextClearRect( cgContext, bounds ); } - -#endif if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) ) result = noErr ; -#if wxMAC_USE_CORE_GRAPHICS thisWindow->MacSetCGContextRef( NULL ) ; } if ( created ) CGContextRelease( cgContext ) ; -#endif } if ( allocatedRgn ) @@ -340,11 +324,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl Boolean focusEverything = false ; ControlPartCode controlPart = cEvent.GetParameter(kEventParamControlPart , typeControlPartCode ); -#ifdef __WXMAC_OSX__ if ( cEvent.GetParameter(kEventParamControlFocusEverything , &focusEverything ) == noErr ) { } -#endif if ( thisWindow->MacIsUserPane() ) result = noErr ; @@ -932,10 +914,7 @@ void wxWindowMac::Init() m_peer = NULL ; m_frozenness = 0 ; m_macAlpha = 255 ; - -#if wxMAC_USE_CORE_GRAPHICS m_cgContextRef = NULL ; -#endif // as all windows are created with WS_VISIBLE style... m_isShown = true; @@ -945,8 +924,6 @@ void wxWindowMac::Init() m_hScrollBarAlwaysShown = false; m_vScrollBarAlwaysShown = false; - m_macBackgroundBrush = wxNullBrush ; - m_macIsUserPane = true; m_clipChildren = false ; m_cachedClippedRectValid = false ; @@ -1167,17 +1144,9 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) break ; case wxWINDOW_VARIANT_MINI : - if (UMAGetSystemVersion() >= 0x1030 ) - { - // not always defined in the headers - size = 3 ; - themeFont = 109 ; - } - else - { - size = kControlSizeSmall; - themeFont = kThemeSmallSystemFont ; - } + // not always defined in the headers + size = 3 ; + themeFont = 109 ; break ; case wxWINDOW_VARIANT_LARGE : @@ -1229,28 +1198,11 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col ) if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol ) return false ; - wxBrush brush ; - wxColour newCol(GetBackgroundColour()); - - if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ) - brush.MacSetTheme( kThemeBrushDocumentWindowBackground ) ; - else if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) ) - brush.MacSetTheme( kThemeBrushDialogBackgroundActive ) ; - else - brush.SetColour( newCol ) ; - - MacSetBackgroundBrush( brush ) ; - MacUpdateControlFont() ; + m_peer->SetBackgroundColour( col ) ; return true ; } -void wxWindowMac::MacSetBackgroundBrush( const wxBrush &brush ) -{ - m_macBackgroundBrush = brush ; - m_peer->SetBackground( brush ) ; -} - bool wxWindowMac::MacCanFocus() const { // TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so @@ -1741,7 +1693,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) GetMouse( &pt ) ; #endif - control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ; + control = FindControlUnderMouse( pt , window , &part ) ; if ( control ) mouseWin = wxFindControlFromMacControl( control ) ; @@ -1853,13 +1805,7 @@ void wxWindowMac::MacInvalidateBorders() RectRgn( updateOuter, &rect ) ; DiffRgn( updateOuter, updateInner , updateOuter ) ; -#ifdef __WXMAC_OSX__ GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ; -#else - WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ; - if ( tlw ) - InvalWindowRgn( tlw , updateOuter ) ; -#endif DisposeRgn( updateOuter ) ; DisposeRgn( updateInner ) ; @@ -2350,8 +2296,7 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event) return ; #if TARGET_API_MAC_OSX - if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT - || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) + if ( !m_backgroundColour.Ok() || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) { event.Skip() ; } @@ -2462,7 +2407,6 @@ void wxWindowMac::MacPaintGrowBox() if ( IsTopLevel() ) return ; -#if wxMAC_USE_CORE_GRAPHICS if ( MacHasScrollBarCorner() ) { Rect rect ; @@ -2477,10 +2421,9 @@ void wxWindowMac::MacPaintGrowBox() CGPoint cgpoint = CGPointMake( rect.right - size , rect.bottom - size ) ; CGContextSaveGState( cgContext ); - if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT ) + if ( m_backgroundColour.Ok() ) { - wxMacCoreGraphicsColour bkgnd( m_macBackgroundBrush ) ; - bkgnd.Apply( cgContext ); + CGContextSetFillColorWithColor( cgContext, m_backgroundColour.GetCGColor() ); } else { @@ -2489,7 +2432,6 @@ void wxWindowMac::MacPaintGrowBox() CGContextFillRect( cgContext, cgrect ); CGContextRestoreGState( cgContext ); } -#endif } void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(rightOrigin) ) @@ -2504,7 +2446,6 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right m_peer->GetRect( &rect ) ; InsetRect( &rect, -1 , -1 ) ; -#if wxMAC_USE_CORE_GRAPHICS { CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left , rect.bottom - rect.top ) ; @@ -2554,33 +2495,6 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right } #endif } - #else - { - wxTopLevelWindowMac* top = MacGetTopLevelWindow(); - if ( top ) - { - wxPoint pt(0, 0) ; - wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ; - OffsetRect( &rect , pt.x , pt.y ) ; - } - - if ( HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) - DrawThemeEditTextFrame( &rect, IsEnabled() ? kThemeStateActive : kThemeStateInactive ) ; - else if ( HasFlag(wxSIMPLE_BORDER) ) - DrawThemeListBoxFrame( &rect, IsEnabled() ? kThemeStateActive : kThemeStateInactive ) ; - - if ( hasFocus ) - DrawThemeFocusRect( &rect , true ) ; - // TODO REMOVE - /* - if ( hasBothScrollbars ) // hasBothScrollbars is not declared - { - // GetThemeStandaloneGrowBoxBounds - // DrawThemeStandaloneNoGrowBox - } - */ - } -#endif } void wxWindowMac::RemoveChild( wxWindowBase *child ) @@ -2667,13 +2581,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) m_peer->SetNeedsDisplay() ; #else // this would be the preferred version for fast drawing controls - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) - HIViewRender(m_peer->GetControlRef()) ; - else -#endif - Update() ; + HIViewRender(m_peer->GetControlRef()) ; #endif } @@ -2769,9 +2677,7 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event ) if ( MacGetTopLevelWindow() && m_peer->NeedsFocusRect() ) { -#if wxMAC_USE_CORE_GRAPHICS GetParent()->Refresh() ; -#else wxMacWindowStateSaver sv( this ) ; Rect rect ; @@ -2799,7 +2705,6 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event ) // we have to invalidate things, we cannot simple redraw MacInvalidateBorders() ; } -#endif } event.Skip(); @@ -3119,16 +3024,7 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) eventNc.SetEventObject( child ); if ( !child->GetEventHandler()->ProcessEvent( eventNc ) ) { -#if wxMAC_USE_CORE_GRAPHICS child->MacPaintBorders(0, 0) ; -#else - { - wxWindowDC dc(this) ; - dc.SetClippingRegion(wxRegion(updatergn)); - wxMacPortSetter helper(&dc) ; - child->MacPaintBorders(0, 0) ; - } -#endif } } } @@ -3518,7 +3414,6 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase) bool wxWindowMac::SetTransparent(wxByte alpha) { -#if wxMAC_USE_CORE_GRAPHICS SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); if ( alpha != m_macAlpha ) @@ -3527,19 +3422,12 @@ bool wxWindowMac::SetTransparent(wxByte alpha) Refresh() ; } return true ; -#else - return false ; -#endif } bool wxWindowMac::CanSetTransparent() { -#if wxMAC_USE_CORE_GRAPHICS return true ; -#else - return false ; -#endif } wxByte wxWindowMac::GetTransparent() const