support for freeze and thaw under cocoa

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2012-11-08 15:46:23 +00:00
parent 346634a0d3
commit 2ab3802522
5 changed files with 32 additions and 8 deletions

View File

@@ -89,6 +89,8 @@ public :
virtual void SetNeedsDisplay( const wxRect* where = NULL ); virtual void SetNeedsDisplay( const wxRect* where = NULL );
virtual bool GetNeedsDisplay() const; virtual bool GetNeedsDisplay() const;
virtual void SetDrawingEnabled(bool enabled);
virtual bool CanFocus() const; virtual bool CanFocus() const;
// return true if successful // return true if successful
virtual bool SetFocus(); virtual bool SetFocus();

View File

@@ -282,6 +282,8 @@ public :
virtual bool NeedsFrame() const; virtual bool NeedsFrame() const;
virtual void SetNeedsFrame( bool needs ); virtual void SetNeedsFrame( bool needs );
virtual void SetDrawingEnabled(bool enabled);
virtual bool CanFocus() const = 0; virtual bool CanFocus() const = 0;
// return true if successful // return true if successful

View File

@@ -1404,7 +1404,15 @@ void wxMacControl::Enable( bool enable )
void wxMacControl::SetDrawingEnabled( 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 ) void wxMacControl::GetRectInWindowCoords( Rect *r )

View File

@@ -2586,6 +2586,18 @@ void wxWidgetCocoaImpl::SetFlipped(bool flipped)
m_isFlipped = 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 // Factory methods
// //

View File

@@ -1362,27 +1362,23 @@ void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
if ( !IsShownOnScreen() ) if ( !IsShownOnScreen() )
return ; return ;
if ( IsFrozen() )
return;
GetPeer()->SetNeedsDisplay( rect ) ; GetPeer()->SetNeedsDisplay( rect ) ;
} }
void wxWindowMac::DoFreeze() void wxWindowMac::DoFreeze()
{ {
#if wxOSX_USE_CARBON
if ( GetPeer() && GetPeer()->IsOk() ) if ( GetPeer() && GetPeer()->IsOk() )
GetPeer()->SetDrawingEnabled( false ) ; GetPeer()->SetDrawingEnabled( false ) ;
#endif
} }
void wxWindowMac::DoThaw() void wxWindowMac::DoThaw()
{ {
#if wxOSX_USE_CARBON
if ( GetPeer() && GetPeer()->IsOk() ) if ( GetPeer() && GetPeer()->IsOk() )
{
GetPeer()->SetDrawingEnabled( true ) ; GetPeer()->SetDrawingEnabled( true ) ;
GetPeer()->InvalidateWithChildren() ;
}
#endif
} }
wxWindow *wxGetActiveWindow() wxWindow *wxGetActiveWindow()
@@ -2854,3 +2850,7 @@ bool wxWidgetImpl::NeedsFrame() const
{ {
return m_needsFrame; return m_needsFrame;
} }
void wxWidgetImpl::SetDrawingEnabled(bool WXUNUSED(enabled))
{
}