From 2ab38025228005fd3d5b43b641c825806ac9abbc Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 8 Nov 2012 15:46:23 +0000 Subject: [PATCH] support for freeze and thaw under cocoa git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/cocoa/private.h | 2 ++ include/wx/osx/core/private.h | 2 ++ src/osx/carbon/window.cpp | 10 +++++++++- src/osx/cocoa/window.mm | 12 ++++++++++++ src/osx/window_osx.cpp | 14 +++++++------- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index d24e39a1ed..b8e0f19ddc 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -89,6 +89,8 @@ public : virtual void SetNeedsDisplay( const wxRect* where = NULL ); virtual bool GetNeedsDisplay() const; + virtual void SetDrawingEnabled(bool enabled); + virtual bool CanFocus() const; // return true if successful virtual bool SetFocus(); diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 9961aaab05..517ddf61e6 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -282,6 +282,8 @@ public : virtual bool NeedsFrame() const; virtual void SetNeedsFrame( bool needs ); + + virtual void SetDrawingEnabled(bool enabled); virtual bool CanFocus() const = 0; // return true if successful diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 2b9bb62a73..94c95ef5cf 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -1404,7 +1404,15 @@ void wxMacControl::Enable( bool enable ) void wxMacControl::SetDrawingEnabled( bool enable ) { - HIViewSetDrawingEnabled( m_controlRef , enable ); + if ( enable ) + { + HIViewSetDrawingEnabled( m_controlRef , true ); + HIViewSetNeedsDisplay( m_controlRef, true); + } + else + { + HIViewSetDrawingEnabled( m_controlRef , false ); + } } void wxMacControl::GetRectInWindowCoords( Rect *r ) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 7b30bf644f..3cf01f4de0 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -2586,6 +2586,18 @@ void wxWidgetCocoaImpl::SetFlipped(bool flipped) m_isFlipped = flipped; } +void wxWidgetCocoaImpl::SetDrawingEnabled(bool enabled) +{ + if ( enabled ) + { + [[m_osxView window] enableFlushWindow]; + [m_osxView setNeedsDisplay:YES]; + } + else + { + [[m_osxView window] disableFlushWindow]; + } +} // // Factory methods // diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index bb67d1afb3..6fe7e14929 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1362,27 +1362,23 @@ void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect) if ( !IsShownOnScreen() ) return ; + + if ( IsFrozen() ) + return; GetPeer()->SetNeedsDisplay( rect ) ; } void wxWindowMac::DoFreeze() { -#if wxOSX_USE_CARBON if ( GetPeer() && GetPeer()->IsOk() ) GetPeer()->SetDrawingEnabled( false ) ; -#endif } void wxWindowMac::DoThaw() { -#if wxOSX_USE_CARBON if ( GetPeer() && GetPeer()->IsOk() ) - { GetPeer()->SetDrawingEnabled( true ) ; - GetPeer()->InvalidateWithChildren() ; - } -#endif } wxWindow *wxGetActiveWindow() @@ -2854,3 +2850,7 @@ bool wxWidgetImpl::NeedsFrame() const { return m_needsFrame; } + +void wxWidgetImpl::SetDrawingEnabled(bool WXUNUSED(enabled)) +{ +} \ No newline at end of file -- 2.45.2