reintroducing non-composited functionality due to DataBrowser Bugs under 10.2
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3a9929405b
commit
9b89f11ad8
@ -411,26 +411,12 @@ Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxS
|
|||||||
class wxMacControl
|
class wxMacControl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxMacControl(wxWindow* peer)
|
wxMacControl( wxWindow* peer) ;
|
||||||
{
|
wxMacControl( wxWindow* peer , ControlRef control ) ;
|
||||||
m_peer = peer ;
|
wxMacControl( wxWindow* peer , WXWidget control ) ;
|
||||||
m_controlRef = NULL ;
|
virtual ~wxMacControl() ;
|
||||||
}
|
|
||||||
|
|
||||||
wxMacControl( wxWindow* peer , ControlRef control )
|
void Init() ;
|
||||||
{
|
|
||||||
m_peer = peer ;
|
|
||||||
m_controlRef = control ;
|
|
||||||
}
|
|
||||||
wxMacControl( wxWindow* peer , WXWidget control )
|
|
||||||
{
|
|
||||||
m_peer = peer ;
|
|
||||||
m_controlRef = (ControlRef) control ;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~wxMacControl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Dispose() ;
|
virtual void Dispose() ;
|
||||||
|
|
||||||
@ -469,6 +455,7 @@ public :
|
|||||||
virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
|
virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
|
||||||
virtual bool HasFocus() const ;
|
virtual bool HasFocus() const ;
|
||||||
virtual bool NeedsFocusRect() const ;
|
virtual bool NeedsFocusRect() const ;
|
||||||
|
virtual void SetNeedsFocusRect( bool needs ) ;
|
||||||
|
|
||||||
// templated helpers
|
// templated helpers
|
||||||
|
|
||||||
@ -570,11 +557,14 @@ public :
|
|||||||
// to be moved into a tab control class
|
// to be moved into a tab control class
|
||||||
|
|
||||||
virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ) ;
|
virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ) ;
|
||||||
|
bool IsCompositing() { return m_isCompositing ; }
|
||||||
protected :
|
protected :
|
||||||
ControlRef m_controlRef ;
|
ControlRef m_controlRef ;
|
||||||
wxFont m_font ;
|
wxFont m_font ;
|
||||||
long m_windowStyle ;
|
long m_windowStyle ;
|
||||||
wxWindow* m_peer ;
|
wxWindow* m_peer ;
|
||||||
|
bool m_needsFocusRect ;
|
||||||
|
bool m_isCompositing ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
@ -750,7 +740,7 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ;
|
|||||||
|
|
||||||
// toplevel.cpp
|
// toplevel.cpp
|
||||||
|
|
||||||
ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) ;
|
ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow, Point location , WindowRef window , ControlPartCode *outPart ) ;
|
||||||
|
|
||||||
// filefn.cpp
|
// filefn.cpp
|
||||||
|
|
||||||
|
@ -784,6 +784,41 @@ OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType in
|
|||||||
// Control Access Support
|
// Control Access Support
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxMacControl::wxMacControl(wxWindow* peer)
|
||||||
|
{
|
||||||
|
Init() ;
|
||||||
|
m_peer = peer ;
|
||||||
|
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacControl::wxMacControl( wxWindow* peer , ControlRef control )
|
||||||
|
{
|
||||||
|
Init() ;
|
||||||
|
m_peer = peer ;
|
||||||
|
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing() ;
|
||||||
|
m_controlRef = control ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacControl::wxMacControl( wxWindow* peer , WXWidget control )
|
||||||
|
{
|
||||||
|
Init() ;
|
||||||
|
m_peer = peer ;
|
||||||
|
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing() ;
|
||||||
|
m_controlRef = (ControlRef) control ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacControl::~wxMacControl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacControl::Init()
|
||||||
|
{
|
||||||
|
m_peer = NULL ;
|
||||||
|
m_controlRef = NULL ;
|
||||||
|
m_needsFocusRect = false ;
|
||||||
|
m_isCompositing = false ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxMacControl::Dispose()
|
void wxMacControl::Dispose()
|
||||||
{
|
{
|
||||||
::DisposeControl( m_controlRef ) ;
|
::DisposeControl( m_controlRef ) ;
|
||||||
@ -894,9 +929,14 @@ bool wxMacControl::HasFocus() const
|
|||||||
return control == m_controlRef ;
|
return control == m_controlRef ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMacControl::SetNeedsFocusRect( bool needs )
|
||||||
|
{
|
||||||
|
m_needsFocusRect = needs ;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxMacControl::NeedsFocusRect() const
|
bool wxMacControl::NeedsFocusRect() const
|
||||||
{
|
{
|
||||||
return false ;
|
return m_needsFocusRect ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::VisibilityChanged(bool shown)
|
void wxMacControl::VisibilityChanged(bool shown)
|
||||||
@ -1052,46 +1092,64 @@ void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where )
|
|||||||
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
HIPoint hiPoint ;
|
if ( from->m_peer->MacGetTopLevelWindow()->MacUsesCompositing() )
|
||||||
hiPoint.x = pt->x ;
|
{
|
||||||
hiPoint.y = pt->y ;
|
HIPoint hiPoint ;
|
||||||
HIViewConvertPoint( &hiPoint , from->m_controlRef , to->m_controlRef ) ;
|
hiPoint.x = pt->x ;
|
||||||
pt->x = (int)hiPoint.x ;
|
hiPoint.y = pt->y ;
|
||||||
pt->y = (int)hiPoint.y ;
|
HIViewConvertPoint( &hiPoint , from->m_controlRef , to->m_controlRef ) ;
|
||||||
#else
|
pt->x = (int)hiPoint.x ;
|
||||||
Rect fromRect ;
|
pt->y = (int)hiPoint.y ;
|
||||||
Rect toRect ;
|
}
|
||||||
from->GetRect( &fromRect ) ;
|
else
|
||||||
to->GetRect( &toRect ) ;
|
|
||||||
|
|
||||||
// correct the case of the root control
|
|
||||||
if ( fromRect.left == -32768 && fromRect.top == -32768 && fromRect.bottom == 32767 && fromRect.right == 32767)
|
|
||||||
fromRect.left = fromRect.top = 0 ;
|
|
||||||
|
|
||||||
if ( toRect.left == -32768 && toRect.top == -32768 && toRect.bottom == 32767 && toRect.right == 32767 )
|
|
||||||
toRect.left = toRect.top = 0 ;
|
|
||||||
|
|
||||||
pt->x = pt->x + fromRect.left - toRect.left ;
|
|
||||||
pt->y = pt->y + fromRect.top - toRect.top ;
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
Rect fromRect ;
|
||||||
|
Rect toRect ;
|
||||||
|
from->GetRect( &fromRect ) ;
|
||||||
|
to->GetRect( &toRect ) ;
|
||||||
|
|
||||||
|
pt->x = pt->x + fromRect.left - toRect.left ;
|
||||||
|
pt->y = pt->y + fromRect.top - toRect.top ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetRect( Rect *r )
|
void wxMacControl::SetRect( Rect *r )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
//A HIRect is actually a CGRect on OSX - which consists of two structures -
|
if ( m_isCompositing )
|
||||||
//CGPoint and CGSize, which have two floats each
|
{
|
||||||
HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } } ;
|
//A HIRect is actually a CGRect on OSX - which consists of two structures -
|
||||||
HIViewSetFrame ( m_controlRef , &hir ) ;
|
//CGPoint and CGSize, which have two floats each
|
||||||
#else
|
HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } } ;
|
||||||
SetControlBounds( m_controlRef , r ) ;
|
HIViewSetFrame ( m_controlRef , &hir ) ;
|
||||||
|
// eventuall we might have to do a SetVisibility( false , true ) ;
|
||||||
|
// before and a SetVisibility( true , true ) ; after
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
Rect former ;
|
||||||
|
GetControlBounds( m_controlRef , &former ) ;
|
||||||
|
InvalWindowRect( GetControlOwner( m_controlRef ) , &former ) ;
|
||||||
|
SetControlBounds( m_controlRef , r ) ;
|
||||||
|
InvalWindowRect( GetControlOwner( m_controlRef ) , r ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::GetRect( Rect *r )
|
void wxMacControl::GetRect( Rect *r )
|
||||||
{
|
{
|
||||||
GetControlBounds( m_controlRef , r ) ;
|
GetControlBounds( m_controlRef , r ) ;
|
||||||
|
// correct the case of the root control
|
||||||
|
if ( r->left == -32768 && r->top == -32768 && r->bottom == 32767 && r->right == 32767)
|
||||||
|
{
|
||||||
|
WindowRef wr = GetControlOwner( m_controlRef ) ;
|
||||||
|
GetWindowBounds( wr , kWindowContentRgn , r ) ;
|
||||||
|
r->right -= r->left ;
|
||||||
|
r->bottom -= r->top ;
|
||||||
|
r->left = 0 ;
|
||||||
|
r->top = 0 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
||||||
|
Loading…
Reference in New Issue
Block a user