added adjustOrigin parameter to bounds calculation, added Freeze and Thaw implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,6 +79,8 @@ public:
|
|||||||
|
|
||||||
virtual void Refresh( bool eraseBackground = TRUE,
|
virtual void Refresh( bool eraseBackground = TRUE,
|
||||||
const wxRect *rect = (const wxRect *) NULL );
|
const wxRect *rect = (const wxRect *) NULL );
|
||||||
|
virtual void Freeze() ;
|
||||||
|
virtual void Thaw() ;
|
||||||
|
|
||||||
virtual bool SetCursor( const wxCursor &cursor );
|
virtual bool SetCursor( const wxCursor &cursor );
|
||||||
virtual bool SetFont( const wxFont &font ) ;
|
virtual bool SetFont( const wxFont &font ) ;
|
||||||
@@ -224,13 +226,15 @@ public:
|
|||||||
bool MacGetBoundsForControl(const wxPoint& pos,
|
bool MacGetBoundsForControl(const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int& x, int& y,
|
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
|
// calculates the real window position and size from the native control
|
||||||
void MacGetPositionAndSizeFromControl(int& x, int& y,
|
void MacGetPositionAndSizeFromControl(int& x, int& y,
|
||||||
int& w, int& h) const ;
|
int& w, int& h) const ;
|
||||||
protected:
|
protected:
|
||||||
// For controls like radiobuttons which are really composite
|
// For controls like radiobuttons which are really composite
|
||||||
wxList m_subControls;
|
wxList m_subControls;
|
||||||
|
// number of calls to Freeze() minus number of calls to Thaw()
|
||||||
|
unsigned int m_frozenness;
|
||||||
|
|
||||||
WXWidget m_macControl ;
|
WXWidget m_macControl ;
|
||||||
bool m_macIsUserPane ;
|
bool m_macIsUserPane ;
|
||||||
|
@@ -425,6 +425,7 @@ pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode p
|
|||||||
|
|
||||||
void wxWindowMac::Init()
|
void wxWindowMac::Init()
|
||||||
{
|
{
|
||||||
|
m_frozenness = 0 ;
|
||||||
m_backgroundTransparent = FALSE;
|
m_backgroundTransparent = FALSE;
|
||||||
|
|
||||||
// as all windows are created with WS_VISIBLE style...
|
// as all windows are created with WS_VISIBLE style...
|
||||||
@@ -920,7 +921,7 @@ void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
|
|||||||
bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
|
bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int& x, int& y,
|
int& x, int& y,
|
||||||
int& w, int& h) const
|
int& w, int& h , bool adjustOrigin ) const
|
||||||
{
|
{
|
||||||
x = (int)pos.x;
|
x = (int)pos.x;
|
||||||
y = (int)pos.y;
|
y = (int)pos.y;
|
||||||
@@ -930,7 +931,8 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
|
|||||||
#if !TARGET_API_MAC_OSX
|
#if !TARGET_API_MAC_OSX
|
||||||
GetParent()->MacWindowToRootWindow( &x , &y ) ;
|
GetParent()->MacWindowToRootWindow( &x , &y ) ;
|
||||||
#endif
|
#endif
|
||||||
|
if ( adjustOrigin )
|
||||||
|
AdjustForParentClientOrigin( x , y ) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1360,7 +1362,8 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
if ( doMove || doResize )
|
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 ) ;
|
bool vis = IsControlVisible( (ControlRef) m_macControl ) ;
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
|
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
|
||||||
@@ -1811,6 +1814,29 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
#endif
|
#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()
|
void wxWindowMac::MacRedrawControl()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -2755,11 +2781,11 @@ void wxWindowMac::MacHandleControlClick( WXWidget control , wxInt16 controlpart
|
|||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
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 ;
|
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 };
|
Rect bounds = { y , x , y+h , x+w };
|
||||||
return bounds ;
|
return bounds ;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user