virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL );
+ virtual void Freeze() ;
+ virtual void Thaw() ;
virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont( const wxFont &font ) ;
bool MacGetBoundsForControl(const wxPoint& pos,
const wxSize& size,
int& x, int& y,
- int& w, int& h) const ;
+ int& w, int& h , bool adjustForOrigin ) const ;
// calculates the real window position and size from the native control
void MacGetPositionAndSizeFromControl(int& x, int& y,
int& w, int& h) const ;
protected:
// For controls like radiobuttons which are really composite
wxList m_subControls;
-
+ // number of calls to Freeze() minus number of calls to Thaw()
+ unsigned int m_frozenness;
+
WXWidget m_macControl ;
bool m_macIsUserPane ;
wxBrush m_macBackgroundBrush ;
void wxWindowMac::Init()
{
+ m_frozenness = 0 ;
m_backgroundTransparent = FALSE;
// as all windows are created with WS_VISIBLE style...
bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
const wxSize& size,
int& x, int& y,
- int& w, int& h) const
+ int& w, int& h , bool adjustOrigin ) const
{
x = (int)pos.x;
y = (int)pos.y;
#if !TARGET_API_MAC_OSX
GetParent()->MacWindowToRootWindow( &x , &y ) ;
#endif
-
+ if ( adjustOrigin )
+ AdjustForParentClientOrigin( x , y ) ;
return true ;
}
if ( doMove || doResize )
{
- Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) ) ;
+ // we don't adjust twice for the origin
+ Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
bool vis = IsControlVisible( (ControlRef) m_macControl ) ;
#if TARGET_API_MAC_OSX
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
#endif
}
+void wxWindowMac::Freeze()
+{
+#if TARGET_API_MAC_OSX
+ if ( !m_frozenness++ )
+ {
+ HIViewSetDrawingEnabled( (HIViewRef) m_macControl , false ) ;
+ }
+#endif
+}
+
+void wxWindowMac::Thaw()
+{
+#if TARGET_API_MAC_OSX
+ wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
+
+ if ( !--m_frozenness )
+ {
+ HIViewSetDrawingEnabled( (HIViewRef) m_macControl , true ) ;
+ HIViewSetNeedsDisplay( (HIViewRef) m_macControl , true ) ;
+ }
+#endif
+}
+
void wxWindowMac::MacRedrawControl()
{
/*
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
}
-Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size )
+Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin )
{
int x ,y , w ,h ;
- window->MacGetBoundsForControl( pos , size , x , y, w, h ) ;
+ window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin) ;
Rect bounds = { y , x , y+h , x+w };
return bounds ;
}