moving compositing knowledge into utility classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1140,7 +1140,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
|||||||
|
|
||||||
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
|
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
|
||||||
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
|
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
|
||||||
m_peer = new wxMacControl(this) ;
|
m_peer = new wxMacControl(this , true /*isRootControl*/) ;
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
|
|
||||||
if ( m_macUsesCompositing )
|
if ( m_macUsesCompositing )
|
||||||
|
@@ -765,6 +765,38 @@ void wxMacWakeUp()
|
|||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Native Struct Conversions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void wxMacRectToNative( const wxRect *wx , Rect *n )
|
||||||
|
{
|
||||||
|
n->left = wx->x ;
|
||||||
|
n->top = wx->y ;
|
||||||
|
n->right = wx->x + wx->width ;
|
||||||
|
n->bottom = wx->y + wx->height ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacNativeToRect( const Rect *n , wxRect* wx )
|
||||||
|
{
|
||||||
|
wx->x = n->left ;
|
||||||
|
wx->y = n->top ;
|
||||||
|
wx->width = n->right - n->left ;
|
||||||
|
wx->height = n->bottom - n->top ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacPointToNative( const wxPoint* wx , Point *n )
|
||||||
|
{
|
||||||
|
n->h = wx->x ;
|
||||||
|
n->v = wx->y ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacNativeToPoint( const Point *n , wxPoint* wx )
|
||||||
|
{
|
||||||
|
wx->x = n->h ;
|
||||||
|
wx->y = n->v ;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Carbon Event Support
|
// Carbon Event Support
|
||||||
@@ -785,10 +817,11 @@ OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType in
|
|||||||
// Control Access Support
|
// Control Access Support
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMacControl::wxMacControl(wxWindow* peer)
|
wxMacControl::wxMacControl(wxWindow* peer , bool isRootControl )
|
||||||
{
|
{
|
||||||
Init() ;
|
Init() ;
|
||||||
m_peer = peer ;
|
m_peer = peer ;
|
||||||
|
m_isRootControl = isRootControl ;
|
||||||
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing() ;
|
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,6 +851,7 @@ void wxMacControl::Init()
|
|||||||
m_controlRef = NULL ;
|
m_controlRef = NULL ;
|
||||||
m_needsFocusRect = false ;
|
m_needsFocusRect = false ;
|
||||||
m_isCompositing = false ;
|
m_isCompositing = false ;
|
||||||
|
m_isRootControl = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::Dispose()
|
void wxMacControl::Dispose()
|
||||||
@@ -1078,17 +1112,62 @@ bool wxMacControl::GetNeedsDisplay() const
|
|||||||
return false ;
|
return false ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where )
|
void wxMacControl::SetNeedsDisplay( RgnHandle where )
|
||||||
{
|
{
|
||||||
|
if ( !IsVisible() )
|
||||||
|
return ;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
if ( where != NULL )
|
if ( m_isCompositing )
|
||||||
HIViewSetNeedsDisplayInRegion( m_controlRef , where , needsDisplay ) ;
|
{
|
||||||
|
HIViewSetNeedsDisplayInRegion( m_controlRef , where , true ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
HIViewSetNeedsDisplay( m_controlRef , needsDisplay ) ;
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
Rect controlBounds ;
|
||||||
|
GetControlBounds( m_controlRef, &controlBounds ) ;
|
||||||
|
RgnHandle update = NewRgn() ;
|
||||||
|
CopyRgn( where , update ) ;
|
||||||
|
OffsetRgn( update , controlBounds.left , controlBounds.top ) ;
|
||||||
|
InvalWindowRgn( GetControlOwner( m_controlRef) , update ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMacControl::SetNeedsDisplay( Rect* where )
|
||||||
|
{
|
||||||
|
if ( !IsVisible() )
|
||||||
|
return ;
|
||||||
|
|
||||||
|
#if TARGET_API_MAC_OSX
|
||||||
|
if ( m_isCompositing )
|
||||||
|
{
|
||||||
|
if ( where != NULL )
|
||||||
|
{
|
||||||
|
RgnHandle update = NewRgn() ;
|
||||||
|
RectRgn( update , where ) ;
|
||||||
|
HIViewSetNeedsDisplayInRegion( m_controlRef , update , true ) ;
|
||||||
|
DisposeRgn( update ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HIViewSetNeedsDisplay( m_controlRef , true ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
Rect controlBounds ;
|
||||||
|
GetControlBounds( m_controlRef, &controlBounds ) ;
|
||||||
|
if ( where )
|
||||||
|
{
|
||||||
|
Rect whereLocal = *where ;
|
||||||
|
OffsetRect( &whereLocal , controlBounds.left , controlBounds.top ) ;
|
||||||
|
SectRect( &controlBounds , &whereLocal, &controlBounds ) ;
|
||||||
|
}
|
||||||
|
InvalWindowRect( GetControlOwner( m_controlRef) , &controlBounds ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
||||||
{
|
{
|
||||||
@@ -1107,8 +1186,12 @@ void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to
|
|||||||
{
|
{
|
||||||
Rect fromRect ;
|
Rect fromRect ;
|
||||||
Rect toRect ;
|
Rect toRect ;
|
||||||
from->GetRect( &fromRect ) ;
|
GetControlBounds( from->m_controlRef , &fromRect ) ;
|
||||||
to->GetRect( &toRect ) ;
|
GetControlBounds( to->m_controlRef , &toRect ) ;
|
||||||
|
if ( from->m_isRootControl )
|
||||||
|
fromRect.left = fromRect.top = 0 ;
|
||||||
|
if ( to->m_isRootControl )
|
||||||
|
toRect.left = toRect.top = 0 ;
|
||||||
|
|
||||||
pt->x = pt->x + fromRect.left - toRect.left ;
|
pt->x = pt->x + fromRect.left - toRect.left ;
|
||||||
pt->y = pt->y + fromRect.top - toRect.top ;
|
pt->y = pt->y + fromRect.top - toRect.top ;
|
||||||
@@ -1130,26 +1213,57 @@ void wxMacControl::SetRect( Rect *r )
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Rect former ;
|
bool vis = IsVisible() ;
|
||||||
GetControlBounds( m_controlRef , &former ) ;
|
if ( vis )
|
||||||
InvalWindowRect( GetControlOwner( m_controlRef ) , &former ) ;
|
{
|
||||||
SetControlBounds( m_controlRef , r ) ;
|
Rect former ;
|
||||||
InvalWindowRect( GetControlOwner( m_controlRef ) , r ) ;
|
GetControlBounds( m_controlRef , &former ) ;
|
||||||
|
InvalWindowRect( GetControlOwner( m_controlRef ) , &former ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect controlBounds = *r ;
|
||||||
|
|
||||||
|
wxMacControl* parent = m_peer->GetParent()->GetPeer() ;
|
||||||
|
if( parent->m_isRootControl == false )
|
||||||
|
{
|
||||||
|
Rect superRect ;
|
||||||
|
GetControlBounds( parent->m_controlRef , &superRect ) ;
|
||||||
|
OffsetRect( &controlBounds , superRect.left , superRect.top ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetControlBounds( m_controlRef , &controlBounds ) ;
|
||||||
|
if ( vis )
|
||||||
|
{
|
||||||
|
InvalWindowRect( GetControlOwner( m_controlRef ) , &controlBounds ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ( m_isCompositing == false )
|
||||||
if ( r->left == -32768 && r->top == -32768 && r->bottom == 32767 && r->right == 32767)
|
|
||||||
{
|
{
|
||||||
WindowRef wr = GetControlOwner( m_controlRef ) ;
|
// correct the case of the root control
|
||||||
GetWindowBounds( wr , kWindowContentRgn , r ) ;
|
if ( m_isRootControl )
|
||||||
r->right -= r->left ;
|
{
|
||||||
r->bottom -= r->top ;
|
WindowRef wr = GetControlOwner( m_controlRef ) ;
|
||||||
r->left = 0 ;
|
GetWindowBounds( wr , kWindowContentRgn , r ) ;
|
||||||
r->top = 0 ;
|
r->right -= r->left ;
|
||||||
|
r->bottom -= r->top ;
|
||||||
|
r->left = 0 ;
|
||||||
|
r->top = 0 ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxMacControl* parent = m_peer->GetParent()->GetPeer() ;
|
||||||
|
if( parent->m_isRootControl == false )
|
||||||
|
{
|
||||||
|
Rect superRect ;
|
||||||
|
GetControlBounds( parent->m_controlRef , &superRect ) ;
|
||||||
|
OffsetRect( r , -superRect.left , -superRect.top ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1183,7 +1297,18 @@ void wxMacControl::GetFeatures( UInt32 * features )
|
|||||||
|
|
||||||
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
|
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
|
||||||
{
|
{
|
||||||
return GetControlRegion( m_controlRef , partCode , region ) ;
|
OSStatus err = GetControlRegion( m_controlRef , partCode , region ) ;
|
||||||
|
if ( m_isCompositing == false )
|
||||||
|
{
|
||||||
|
if ( !m_isRootControl )
|
||||||
|
{
|
||||||
|
Rect r ;
|
||||||
|
GetControlBounds(m_controlRef, &r ) ;
|
||||||
|
if ( !EmptyRgn( region ) )
|
||||||
|
OffsetRgn( region , -r.left , -r.top ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus wxMacControl::SetZOrder( bool above , wxMacControl* other )
|
OSStatus wxMacControl::SetZOrder( bool above , wxMacControl* other )
|
||||||
|
@@ -209,6 +209,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
{
|
{
|
||||||
if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 )
|
if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 )
|
||||||
{
|
{
|
||||||
|
// as this update region is in native window locals we must adapt it to wx window local
|
||||||
allocatedRgn = NewRgn() ;
|
allocatedRgn = NewRgn() ;
|
||||||
CopyRgn( updateRgn , allocatedRgn ) ;
|
CopyRgn( updateRgn , allocatedRgn ) ;
|
||||||
// hide the given region by the new region that must be shifted
|
// hide the given region by the new region that must be shifted
|
||||||
@@ -217,9 +218,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if wxMAC_DEBUG_REDRAW
|
||||||
// in case we would need a coregraphics compliant background erase first
|
|
||||||
// now usable to track redraws
|
|
||||||
if ( thisWindow->MacIsUserPane() )
|
if ( thisWindow->MacIsUserPane() )
|
||||||
{
|
{
|
||||||
CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
|
CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
|
||||||
@@ -433,6 +432,7 @@ static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
|
|||||||
if ( win )
|
if ( win )
|
||||||
win->MacControlUserPaneDrawProc(part) ;
|
win->MacControlUserPaneDrawProc(part) ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneDrawUPP , wxMacControlUserPaneDrawProc ) ;
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where)
|
static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where)
|
||||||
{
|
{
|
||||||
@@ -442,6 +442,7 @@ static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control
|
|||||||
else
|
else
|
||||||
return kControlNoPart ;
|
return kControlNoPart ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneHitTestUPP , wxMacControlUserPaneHitTestProc ) ;
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc)
|
static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc)
|
||||||
{
|
{
|
||||||
@@ -451,6 +452,7 @@ static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef contro
|
|||||||
else
|
else
|
||||||
return kControlNoPart ;
|
return kControlNoPart ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneTrackingUPP , wxMacControlUserPaneTrackingProc ) ;
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
|
static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
|
||||||
{
|
{
|
||||||
@@ -458,6 +460,7 @@ static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
|
|||||||
if ( win )
|
if ( win )
|
||||||
win->MacControlUserPaneIdleProc() ;
|
win->MacControlUserPaneIdleProc() ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneIdleUPP , wxMacControlUserPaneIdleProc ) ;
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
|
static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
|
||||||
{
|
{
|
||||||
@@ -467,6 +470,7 @@ static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control
|
|||||||
else
|
else
|
||||||
return kControlNoPart ;
|
return kControlNoPart ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneKeyDownUPP , wxMacControlUserPaneKeyDownProc ) ;
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating)
|
static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating)
|
||||||
{
|
{
|
||||||
@@ -474,6 +478,7 @@ static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean
|
|||||||
if ( win )
|
if ( win )
|
||||||
win->MacControlUserPaneActivateProc(activating) ;
|
win->MacControlUserPaneActivateProc(activating) ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneActivateUPP , wxMacControlUserPaneActivateProc ) ;
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action)
|
static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action)
|
||||||
{
|
{
|
||||||
@@ -483,6 +488,7 @@ static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control,
|
|||||||
else
|
else
|
||||||
return kControlNoPart ;
|
return kControlNoPart ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneFocusUPP , wxMacControlUserPaneFocusProc ) ;
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
|
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
|
||||||
{
|
{
|
||||||
@@ -490,6 +496,7 @@ static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, Contro
|
|||||||
if ( win )
|
if ( win )
|
||||||
win->MacControlUserPaneBackgroundProc(info) ;
|
win->MacControlUserPaneBackgroundProc(info) ;
|
||||||
}
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlUserPaneBackgroundUPP , wxMacControlUserPaneBackgroundProc ) ;
|
||||||
|
|
||||||
void wxWindowMac::MacControlUserPaneDrawProc(wxInt16 part)
|
void wxWindowMac::MacControlUserPaneDrawProc(wxInt16 part)
|
||||||
{
|
{
|
||||||
@@ -533,17 +540,26 @@ void wxWindowMac::MacControlUserPaneBackgroundProc(void* info)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlUserPaneDrawUPP gControlUserPaneDrawUPP = NULL ;
|
|
||||||
ControlUserPaneHitTestUPP gControlUserPaneHitTestUPP = NULL ;
|
|
||||||
ControlUserPaneTrackingUPP gControlUserPaneTrackingUPP = NULL ;
|
|
||||||
ControlUserPaneIdleUPP gControlUserPaneIdleUPP = NULL ;
|
|
||||||
ControlUserPaneKeyDownUPP gControlUserPaneKeyDownUPP = NULL ;
|
|
||||||
ControlUserPaneActivateUPP gControlUserPaneActivateUPP = NULL ;
|
|
||||||
ControlUserPaneFocusUPP gControlUserPaneFocusUPP = NULL ;
|
|
||||||
ControlUserPaneBackgroundUPP gControlUserPaneBackgroundUPP = NULL ;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Scrollbar Tracking for all
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode ) ;
|
||||||
|
pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode )
|
||||||
|
{
|
||||||
|
if ( partCode != 0)
|
||||||
|
{
|
||||||
|
wxWindow* wx = wxFindControlFromMacControl( control ) ;
|
||||||
|
if ( wx )
|
||||||
|
{
|
||||||
|
wx->MacHandleControlClick( (WXWidget) control , partCode , true /* stillDown */ ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -610,77 +626,6 @@ void wxRemoveMacControlAssociation(wxWindow *control)
|
|||||||
}
|
}
|
||||||
#endif // deprecated wxList
|
#endif // deprecated wxList
|
||||||
|
|
||||||
// UPP functions
|
|
||||||
ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
|
|
||||||
|
|
||||||
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
|
|
||||||
|
|
||||||
// we have to setup the brush in the current port and return noErr
|
|
||||||
// or return an error code so that the control manager walks further up the
|
|
||||||
// hierarchy to find a correct background
|
|
||||||
|
|
||||||
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
|
|
||||||
{
|
|
||||||
OSStatus status = paramErr ;
|
|
||||||
switch( iMessage )
|
|
||||||
{
|
|
||||||
case kControlMsgApplyTextColor :
|
|
||||||
break ;
|
|
||||||
case kControlMsgSetUpBackground :
|
|
||||||
{
|
|
||||||
wxWindow* wx = (wxWindow*) wxFindControlFromMacControl( iControl ) ;
|
|
||||||
if ( wx != NULL )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
const wxBrush &brush = wx->MacGetBackgroundBrush() ;
|
|
||||||
if ( brush.Ok() )
|
|
||||||
{
|
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( brush ) ;
|
|
||||||
*/
|
|
||||||
// this clipping is only needed for non HIView
|
|
||||||
|
|
||||||
RgnHandle clip = NewRgn() ;
|
|
||||||
int x = 0 , y = 0;
|
|
||||||
|
|
||||||
wx->MacWindowToRootWindow( &x,&y ) ;
|
|
||||||
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion().GetWXHRGN() , clip ) ;
|
|
||||||
OffsetRgn( clip , x , y ) ;
|
|
||||||
SetClip( clip ) ;
|
|
||||||
DisposeRgn( clip ) ;
|
|
||||||
|
|
||||||
status = noErr ;
|
|
||||||
/*
|
|
||||||
}
|
|
||||||
else if ( wx->MacIsUserPane() )
|
|
||||||
{
|
|
||||||
// if we don't have a valid brush for such a control, we have to call the
|
|
||||||
// setup of our parent ourselves
|
|
||||||
status = SetUpControlBackground( (ControlRef) wx->GetParent()->GetHandle() , iDepth , iIsColor ) ;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
default :
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
return status ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode ) ;
|
|
||||||
pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode )
|
|
||||||
{
|
|
||||||
if ( partCode != 0)
|
|
||||||
{
|
|
||||||
wxWindow* wx = wxFindControlFromMacControl( control ) ;
|
|
||||||
if ( wx )
|
|
||||||
{
|
|
||||||
wx->MacHandleControlClick( (WXWidget) control , partCode , true /* stillDown */ ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constructors and such
|
// constructors and such
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -720,31 +665,6 @@ void wxWindowMac::Init()
|
|||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
m_cgContextRef = NULL ;
|
m_cgContextRef = NULL ;
|
||||||
#endif
|
#endif
|
||||||
// make sure all proc ptrs are available
|
|
||||||
|
|
||||||
#if !TARGET_API_MAC_OSX
|
|
||||||
if ( gControlUserPaneDrawUPP == NULL )
|
|
||||||
{
|
|
||||||
gControlUserPaneDrawUPP = NewControlUserPaneDrawUPP( wxMacControlUserPaneDrawProc ) ;
|
|
||||||
gControlUserPaneHitTestUPP = NewControlUserPaneHitTestUPP( wxMacControlUserPaneHitTestProc ) ;
|
|
||||||
gControlUserPaneTrackingUPP = NewControlUserPaneTrackingUPP( wxMacControlUserPaneTrackingProc ) ;
|
|
||||||
gControlUserPaneIdleUPP = NewControlUserPaneIdleUPP( wxMacControlUserPaneIdleProc ) ;
|
|
||||||
gControlUserPaneKeyDownUPP = NewControlUserPaneKeyDownUPP( wxMacControlUserPaneKeyDownProc ) ;
|
|
||||||
gControlUserPaneActivateUPP = NewControlUserPaneActivateUPP( wxMacControlUserPaneActivateProc ) ;
|
|
||||||
gControlUserPaneFocusUPP = NewControlUserPaneFocusUPP( wxMacControlUserPaneFocusProc ) ;
|
|
||||||
gControlUserPaneBackgroundUPP = NewControlUserPaneBackgroundUPP( wxMacControlUserPaneBackgroundProc ) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if ( wxMacLiveScrollbarActionUPP == NULL )
|
|
||||||
{
|
|
||||||
wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( wxMacSetupControlBackgroundUPP == NULL )
|
|
||||||
{
|
|
||||||
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need a valid font for the encodings
|
// we need a valid font for the encodings
|
||||||
wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||||
}
|
}
|
||||||
@@ -833,14 +753,14 @@ void wxWindowMac::MacInstallEventHandler( WXWidget control )
|
|||||||
#if !TARGET_API_MAC_OSX
|
#if !TARGET_API_MAC_OSX
|
||||||
if ( (ControlRef) control == m_peer->GetControlRef() )
|
if ( (ControlRef) control == m_peer->GetControlRef() )
|
||||||
{
|
{
|
||||||
m_peer->SetData<ControlUserPaneDrawUPP>(kControlEntireControl,kControlUserPaneDrawProcTag,&gControlUserPaneDrawUPP) ;
|
m_peer->SetData<ControlUserPaneDrawUPP>(kControlEntireControl,kControlUserPaneDrawProcTag,GetwxMacControlUserPaneDrawProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneHitTestUPP>(kControlEntireControl,kControlUserPaneHitTestProcTag,&gControlUserPaneHitTestUPP) ;
|
m_peer->SetData<ControlUserPaneHitTestUPP>(kControlEntireControl,kControlUserPaneHitTestProcTag,GetwxMacControlUserPaneHitTestProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneTrackingUPP>(kControlEntireControl,kControlUserPaneTrackingProcTag,&gControlUserPaneTrackingUPP) ;
|
m_peer->SetData<ControlUserPaneTrackingUPP>(kControlEntireControl,kControlUserPaneTrackingProcTag,GetwxMacControlUserPaneTrackingProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneIdleUPP>(kControlEntireControl,kControlUserPaneIdleProcTag,&gControlUserPaneIdleUPP) ;
|
m_peer->SetData<ControlUserPaneIdleUPP>(kControlEntireControl,kControlUserPaneIdleProcTag,GetwxMacControlUserPaneIdleProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneKeyDownUPP>(kControlEntireControl,kControlUserPaneKeyDownProcTag,&gControlUserPaneKeyDownUPP) ;
|
m_peer->SetData<ControlUserPaneKeyDownUPP>(kControlEntireControl,kControlUserPaneKeyDownProcTag,GetwxMacControlUserPaneKeyDownProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneActivateUPP>(kControlEntireControl,kControlUserPaneActivateProcTag,&gControlUserPaneActivateUPP) ;
|
m_peer->SetData<ControlUserPaneActivateUPP>(kControlEntireControl,kControlUserPaneActivateProcTag,GetwxMacControlUserPaneActivateProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneFocusUPP>(kControlEntireControl,kControlUserPaneFocusProcTag,&gControlUserPaneFocusUPP) ;
|
m_peer->SetData<ControlUserPaneFocusUPP>(kControlEntireControl,kControlUserPaneFocusProcTag,GetwxMacControlUserPaneFocusProc()) ;
|
||||||
m_peer->SetData<ControlUserPaneBackgroundUPP>(kControlEntireControl,kControlUserPaneBackgroundProcTag,&gControlUserPaneBackgroundUPP) ;
|
m_peer->SetData<ControlUserPaneBackgroundUPP>(kControlEntireControl,kControlUserPaneBackgroundProcTag,GetwxMacControlUserPaneBackgroundProc()) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -866,13 +786,14 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
|
|||||||
|
|
||||||
UInt32 features = 0
|
UInt32 features = 0
|
||||||
| kControlSupportsEmbedding
|
| kControlSupportsEmbedding
|
||||||
// | kControlSupportsLiveFeedback
|
| kControlSupportsLiveFeedback
|
||||||
|
| kControlGetsFocusOnClick
|
||||||
// | kControlHasSpecialBackground
|
// | kControlHasSpecialBackground
|
||||||
// | kControlSupportsCalcBestRect
|
// | kControlSupportsCalcBestRect
|
||||||
// | kControlHandlesTracking
|
| kControlHandlesTracking
|
||||||
| kControlSupportsFocus
|
| kControlSupportsFocus
|
||||||
// | kControlWantsActivate
|
| kControlWantsActivate
|
||||||
// | kControlWantsIdle
|
| kControlWantsIdle
|
||||||
;
|
;
|
||||||
|
|
||||||
m_peer = new wxMacControl(this) ;
|
m_peer = new wxMacControl(this) ;
|
||||||
@@ -926,11 +847,6 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
|
|||||||
// adjust font, controlsize etc
|
// adjust font, controlsize etc
|
||||||
DoSetWindowVariant( m_windowVariant ) ;
|
DoSetWindowVariant( m_windowVariant ) ;
|
||||||
|
|
||||||
#if !TARGET_API_MAC_OSX
|
|
||||||
// eventually we can fix some clipping issues be reactivating this hook
|
|
||||||
//if ( m_macIsUserPane )
|
|
||||||
// SetControlColorProc( m_peer->GetControlRef() , wxMacSetupControlBackgroundUPP ) ;
|
|
||||||
#endif
|
|
||||||
m_peer->SetTitle( wxStripMenuCodes(m_label) ) ;
|
m_peer->SetTitle( wxStripMenuCodes(m_label) ) ;
|
||||||
|
|
||||||
if (!m_macIsUserPane)
|
if (!m_macIsUserPane)
|
||||||
@@ -1158,14 +1074,7 @@ void wxWindowMac::DragAcceptFiles(bool accept)
|
|||||||
void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
|
void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
|
||||||
int& w, int& h) const
|
int& w, int& h) const
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
wxFAIL_MSG( wxT("Not supported anymore") ) ;
|
||||||
m_peer->GetRect( &bounds ) ;
|
|
||||||
|
|
||||||
|
|
||||||
x = bounds.left ;
|
|
||||||
y = bounds.top ;
|
|
||||||
w = bounds.right - bounds.left ;
|
|
||||||
h = bounds.bottom - bounds.top ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// From a wx position / size calculate the appropriate size of the native control
|
// From a wx position / size calculate the appropriate size of the native control
|
||||||
@@ -1209,36 +1118,21 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
|
|||||||
// Get window size (not client size)
|
// Get window size (not client size)
|
||||||
void wxWindowMac::DoGetSize(int *x, int *y) const
|
void wxWindowMac::DoGetSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
// take the size of the control and add the borders that have to be drawn outside
|
Rect bounds ;
|
||||||
int x1 , y1 , w1 , h1 ;
|
m_peer->GetRect( &bounds ) ;
|
||||||
|
|
||||||
MacGetPositionAndSizeFromControl( x1 , y1, w1 ,h1 ) ;
|
if(x) *x = bounds.right - bounds.left + MacGetLeftBorderSize() + MacGetRightBorderSize() ;
|
||||||
|
if(y) *y = bounds.bottom - bounds.top + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
|
||||||
w1 += MacGetLeftBorderSize() + MacGetRightBorderSize() ;
|
|
||||||
h1 += MacGetTopBorderSize() + MacGetBottomBorderSize() ;
|
|
||||||
|
|
||||||
if(x) *x = w1 ;
|
|
||||||
if(y) *y = h1 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the position of the bounds of this window in client coordinates of its parent
|
// get the position of the bounds of this window in client coordinates of its parent
|
||||||
void wxWindowMac::DoGetPosition(int *x, int *y) const
|
void wxWindowMac::DoGetPosition(int *x, int *y) const
|
||||||
{
|
{
|
||||||
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
|
Rect bounds ;
|
||||||
|
m_peer->GetRect( &bounds ) ;
|
||||||
|
|
||||||
int x1 , y1 , w1 ,h1 ;
|
int x1 = bounds.left ;
|
||||||
MacGetPositionAndSizeFromControl( x1 , y1, w1 ,h1 ) ;
|
int y1 = bounds.top ;
|
||||||
x1 -= MacGetLeftBorderSize() ;
|
|
||||||
y1 -= MacGetTopBorderSize() ;
|
|
||||||
// to non-client
|
|
||||||
|
|
||||||
if ( !isCompositing && !GetParent()->IsTopLevel() )
|
|
||||||
{
|
|
||||||
Rect bounds ;
|
|
||||||
GetControlBounds( (ControlRef) GetParent()->GetHandle() , &bounds ) ;
|
|
||||||
x1 -= bounds.left ;
|
|
||||||
y1 -= bounds.top ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !IsTopLevel() )
|
if ( !IsTopLevel() )
|
||||||
{
|
{
|
||||||
@@ -1384,54 +1278,45 @@ void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , in
|
|||||||
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
|
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
|
||||||
|
|
||||||
RgnHandle rgn = NewRgn() ;
|
RgnHandle rgn = NewRgn() ;
|
||||||
Rect content ;
|
|
||||||
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
|
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
|
||||||
{
|
{
|
||||||
|
Rect structure ;
|
||||||
|
Rect content ;
|
||||||
GetRegionBounds( rgn , &content ) ;
|
GetRegionBounds( rgn , &content ) ;
|
||||||
|
m_peer->GetRect( &structure ) ;
|
||||||
|
OffsetRect( &structure, -structure.left , -structure.top ) ;
|
||||||
|
|
||||||
|
left = content.left - structure.left ;
|
||||||
|
top = content.top - structure.top ;
|
||||||
|
right = structure.right - content.right ;
|
||||||
|
bottom = structure.bottom - content.bottom ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_peer->GetRect( &content ) ;
|
left = top = right = bottom = 0 ;
|
||||||
}
|
}
|
||||||
DisposeRgn( rgn ) ;
|
DisposeRgn( rgn ) ;
|
||||||
Rect structure ;
|
|
||||||
m_peer->GetRect( &structure ) ;
|
|
||||||
|
|
||||||
if ( !isCompositing )
|
|
||||||
OffsetRect( &content , -structure.left , -structure.top ) ;
|
|
||||||
|
|
||||||
left = content.left - structure.left ;
|
|
||||||
top = content.top - structure.top ;
|
|
||||||
right = structure.right - content.right ;
|
|
||||||
bottom = structure.bottom - content.bottom ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
|
wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
|
||||||
{
|
{
|
||||||
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
|
|
||||||
wxSize sizeTotal = size;
|
wxSize sizeTotal = size;
|
||||||
|
|
||||||
RgnHandle rgn = NewRgn() ;
|
RgnHandle rgn = NewRgn() ;
|
||||||
|
|
||||||
Rect content ;
|
|
||||||
|
|
||||||
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
|
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
|
||||||
{
|
{
|
||||||
|
Rect content ;
|
||||||
|
Rect structure ;
|
||||||
GetRegionBounds( rgn , &content ) ;
|
GetRegionBounds( rgn , &content ) ;
|
||||||
}
|
|
||||||
else
|
m_peer->GetRect( &structure ) ;
|
||||||
{
|
// structure is in parent coordinates, but we only need width and height, so it's ok
|
||||||
m_peer->GetRect( &content ) ;
|
|
||||||
|
sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ;
|
||||||
|
sizeTotal.y += (structure.bottom - structure.top) - (content.bottom - content.top ) ;
|
||||||
}
|
}
|
||||||
DisposeRgn( rgn ) ;
|
DisposeRgn( rgn ) ;
|
||||||
Rect structure ;
|
|
||||||
m_peer->GetRect( &structure ) ;
|
|
||||||
|
|
||||||
if ( !isCompositing )
|
|
||||||
OffsetRect( &content , -structure.left , -structure.top ) ;
|
|
||||||
|
|
||||||
sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ;
|
|
||||||
sizeTotal.y += (structure.bottom - structure.top) - (content.bottom - content.top ) ;
|
|
||||||
|
|
||||||
sizeTotal.x += MacGetLeftBorderSize( ) + MacGetRightBorderSize( ) ;
|
sizeTotal.x += MacGetLeftBorderSize( ) + MacGetRightBorderSize( ) ;
|
||||||
sizeTotal.y += MacGetTopBorderSize( ) + MacGetBottomBorderSize( ) ;
|
sizeTotal.y += MacGetTopBorderSize( ) + MacGetBottomBorderSize( ) ;
|
||||||
@@ -1458,62 +1343,9 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
|
|||||||
}
|
}
|
||||||
DisposeRgn( rgn ) ;
|
DisposeRgn( rgn ) ;
|
||||||
|
|
||||||
if ( !isCompositing )
|
|
||||||
{
|
|
||||||
Rect structure ;
|
|
||||||
m_peer->GetRect( &structure ) ;
|
|
||||||
OffsetRect( &content , -structure.left , -structure.top ) ;
|
|
||||||
}
|
|
||||||
ww = content.right - content.left ;
|
ww = content.right - content.left ;
|
||||||
hh = content.bottom - content.top ;
|
hh = content.bottom - content.top ;
|
||||||
/*
|
|
||||||
ww -= MacGetLeftBorderSize( ) + MacGetRightBorderSize( ) ;
|
|
||||||
hh -= MacGetTopBorderSize( ) + MacGetBottomBorderSize( );
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar && m_hScrollBar->IsShown()) )
|
|
||||||
{
|
|
||||||
int x1 = 0 ;
|
|
||||||
int y1 = 0 ;
|
|
||||||
int w ;
|
|
||||||
int h ;
|
|
||||||
GetSize( &w , &h ) ;
|
|
||||||
|
|
||||||
MacClientToRootWindow( &x1 , &y1 ) ;
|
|
||||||
MacClientToRootWindow( &w , &h ) ;
|
|
||||||
|
|
||||||
wxWindowMac *iter = (wxWindowMac*)this ;
|
|
||||||
|
|
||||||
int totW = 10000 , totH = 10000;
|
|
||||||
while( iter )
|
|
||||||
{
|
|
||||||
if ( iter->IsTopLevel() )
|
|
||||||
{
|
|
||||||
iter->GetSize( &totW , &totH ) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
iter = iter->GetParent() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_hScrollBar && m_hScrollBar->IsShown() )
|
|
||||||
{
|
|
||||||
hh -= m_hScrollBar->GetSize().y ; // MAC_SCROLLBAR_SIZE ;
|
|
||||||
if ( h-y1 >= totH )
|
|
||||||
{
|
|
||||||
hh += 1 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_vScrollBar && m_vScrollBar->IsShown() )
|
|
||||||
{
|
|
||||||
ww -= m_vScrollBar->GetSize().x ; // MAC_SCROLLBAR_SIZE;
|
|
||||||
if ( w-x1 >= totW )
|
|
||||||
{
|
|
||||||
ww += 1 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (m_hScrollBar && m_hScrollBar->IsShown() )
|
if (m_hScrollBar && m_hScrollBar->IsShown() )
|
||||||
{
|
{
|
||||||
hh -= m_hScrollBar->GetSize().y ; // MAC_SCROLLBAR_SIZE ;
|
hh -= m_hScrollBar->GetSize().y ; // MAC_SCROLLBAR_SIZE ;
|
||||||
@@ -1662,7 +1494,7 @@ void wxWindowMac::MacInvalidateBorders()
|
|||||||
RectRgn( updateOuter , &rect ) ;
|
RectRgn( updateOuter , &rect ) ;
|
||||||
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
|
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
GetParent()->m_peer->SetNeedsDisplay( true , updateOuter ) ;
|
GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
|
||||||
#else
|
#else
|
||||||
WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
|
WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
|
||||||
if ( tlw )
|
if ( tlw )
|
||||||
@@ -1756,7 +1588,7 @@ void wxWindowMac::MacInvalidateBorders()
|
|||||||
*/
|
*/
|
||||||
UnionRgn( updateOuter , updateTotal , updateTotal ) ;
|
UnionRgn( updateOuter , updateTotal , updateTotal ) ;
|
||||||
|
|
||||||
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
|
GetParent()->m_peer->SetNeedsDisplay( updateTotal ) ;
|
||||||
DisposeRgn(updateOuter) ;
|
DisposeRgn(updateOuter) ;
|
||||||
DisposeRgn(updateInner) ;
|
DisposeRgn(updateInner) ;
|
||||||
DisposeRgn(updateTotal) ;
|
DisposeRgn(updateTotal) ;
|
||||||
@@ -1809,8 +1641,19 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
if ( doMove || doResize )
|
if ( doMove || doResize )
|
||||||
{
|
{
|
||||||
// we don't adjust twice for the origin
|
// as the borders are drawn outside the native control, we adjust now
|
||||||
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
|
|
||||||
|
wxRect bounds( wxPoint( actualX + MacGetLeftBorderSize() ,actualY + MacGetTopBorderSize() ),
|
||||||
|
wxSize( actualWidth - (MacGetLeftBorderSize() + MacGetRightBorderSize()) ,
|
||||||
|
actualHeight - (MacGetTopBorderSize() + MacGetBottomBorderSize()) ) ) ;
|
||||||
|
|
||||||
|
Rect r ;
|
||||||
|
wxMacRectToNative( &bounds , &r ) ;
|
||||||
|
|
||||||
|
if ( !GetParent()->IsTopLevel() )
|
||||||
|
{
|
||||||
|
wxMacWindowToNative( GetParent() , &r ) ;
|
||||||
|
}
|
||||||
|
|
||||||
MacInvalidateBorders() ;
|
MacInvalidateBorders() ;
|
||||||
|
|
||||||
@@ -1959,19 +1802,6 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
|
|||||||
m_peer->GetRegion( kControlContentMetaPart , rgn ) ;
|
m_peer->GetRegion( kControlContentMetaPart , rgn ) ;
|
||||||
GetRegionBounds( rgn , &content ) ;
|
GetRegionBounds( rgn , &content ) ;
|
||||||
DisposeRgn( rgn ) ;
|
DisposeRgn( rgn ) ;
|
||||||
|
|
||||||
if ( !isCompositing )
|
|
||||||
{
|
|
||||||
// if the content rgn is empty / not supported
|
|
||||||
// don't attempt to correct the coordinates to wxWindow relative ones
|
|
||||||
if (!::EmptyRect( &content ) )
|
|
||||||
{
|
|
||||||
Rect structure ;
|
|
||||||
m_peer->GetRect( &structure ) ;
|
|
||||||
OffsetRect( &content , -structure.left , -structure.top ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxPoint( content.left + MacGetLeftBorderSize( ) , content.top + MacGetTopBorderSize( ) );
|
return wxPoint( content.left + MacGetLeftBorderSize( ) , content.top + MacGetTopBorderSize( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2195,63 +2025,18 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
if ( m_peer == NULL )
|
if ( m_peer == NULL )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
if ( !MacIsReallyShown() )
|
||||||
|
return ;
|
||||||
|
|
||||||
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
|
if ( rect )
|
||||||
// if ( isCompositing )
|
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC_OSX__
|
Rect r ;
|
||||||
if ( rect == NULL && isCompositing )
|
wxMacRectToNative( rect , &r ) ;
|
||||||
m_peer->SetNeedsDisplay( true ) ;
|
m_peer->SetNeedsDisplay( &r ) ;
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
Rect controlBounds ;
|
|
||||||
m_peer->GetRect( &controlBounds ) ;
|
|
||||||
InvalWindowRect( (WindowRef) MacGetTopLevelWindowRef() , &controlBounds ) ;
|
|
||||||
/*
|
|
||||||
RgnHandle update = NewRgn() ;
|
|
||||||
if ( rect == NULL )
|
|
||||||
{
|
|
||||||
CopyRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update ) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
|
|
||||||
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
OffsetRgn( update, origin.x , origin.y ) ;
|
|
||||||
// right now this is wx' window coordinates, as our native peer does not have borders, this is
|
|
||||||
// inset
|
|
||||||
if ( isCompositing )
|
|
||||||
{
|
|
||||||
OffsetRgn( update , -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
|
|
||||||
m_peer->SetNeedsDisplay( true , update) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int x = 0 ;
|
|
||||||
int y = 0 ;
|
|
||||||
MacWindowToRootWindow( &x , &y ) ;
|
|
||||||
OffsetRgn( update , x , y ) ;
|
|
||||||
InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , update ) ;
|
|
||||||
}
|
|
||||||
DisposeRgn( update ) ;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ( 0 )
|
|
||||||
{
|
{
|
||||||
if ( MacIsReallyShown() )
|
m_peer->SetNeedsDisplay() ;
|
||||||
{
|
|
||||||
/*
|
|
||||||
m_peer->SetVisibility( false , false ) ;
|
|
||||||
m_peer->SetVisibility( true , true ) ;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2459,16 +2244,12 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// as the non OSX Version is already working in window relative coordinates, it's not needed
|
|
||||||
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
||||||
if (top && top->MacUsesCompositing())
|
if (top )
|
||||||
{
|
{
|
||||||
wxPoint pt(0,0) ;
|
wxPoint pt(0,0) ;
|
||||||
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
|
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
|
||||||
rect.left += pt.x ;
|
OffsetRect( &rect , pt.x , pt.y ) ;
|
||||||
rect.right += pt.x ;
|
|
||||||
rect.top += pt.y ;
|
|
||||||
rect.bottom += pt.y ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
||||||
@@ -2578,7 +2359,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
|||||||
// either immediate redraw or full invalidate
|
// either immediate redraw or full invalidate
|
||||||
#if 1
|
#if 1
|
||||||
// is the better overall solution, as it does not slow down scrolling
|
// is the better overall solution, as it does not slow down scrolling
|
||||||
m_peer->SetNeedsDisplay( true ) ;
|
m_peer->SetNeedsDisplay() ;
|
||||||
#else
|
#else
|
||||||
// this would be the preferred version for fast drawing controls
|
// this would be the preferred version for fast drawing controls
|
||||||
if( UMAGetSystemVersion() < 0x1030 )
|
if( UMAGetSystemVersion() < 0x1030 )
|
||||||
@@ -2723,10 +2504,9 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
|
|||||||
Rect rect ;
|
Rect rect ;
|
||||||
m_peer->GetRect( &rect ) ;
|
m_peer->GetRect( &rect ) ;
|
||||||
InsetRect( &rect, -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
|
InsetRect( &rect, -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
// as the non OSX Version is already working in window relative coordinates, it's not needed
|
|
||||||
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
||||||
if (top && top->MacUsesCompositing() )
|
if (top )
|
||||||
{
|
{
|
||||||
wxPoint pt(0,0) ;
|
wxPoint pt(0,0) ;
|
||||||
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
|
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
|
||||||
@@ -2735,7 +2515,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
|
|||||||
rect.top += pt.y ;
|
rect.top += pt.y ;
|
||||||
rect.bottom += pt.y ;
|
rect.bottom += pt.y ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
||||||
DrawThemeFocusRect( &rect , true ) ;
|
DrawThemeFocusRect( &rect , true ) ;
|
||||||
@@ -2870,7 +2649,7 @@ void wxWindowMac::Update()
|
|||||||
status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
|
status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_peer->SetNeedsDisplay( true ) ;
|
m_peer->SetNeedsDisplay() ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
::Draw1Control( m_peer->GetControlRef() ) ;
|
::Draw1Control( m_peer->GetControlRef() ) ;
|
||||||
@@ -2905,18 +2684,11 @@ wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures )
|
|||||||
r.bottom += MacGetBottomBorderSize() ;
|
r.bottom += MacGetBottomBorderSize() ;
|
||||||
r.right += MacGetRightBorderSize() ;
|
r.right += MacGetRightBorderSize() ;
|
||||||
|
|
||||||
if (! MacGetTopLevelWindow()->MacUsesCompositing() )
|
r.right -= r.left ;
|
||||||
{
|
r.bottom -= r.top ;
|
||||||
MacRootWindowToWindow( &r.left , & r.top ) ;
|
r.left = 0 ;
|
||||||
MacRootWindowToWindow( &r.right , & r.bottom ) ;
|
r.top = 0 ;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
r.right -= r.left ;
|
|
||||||
r.bottom -= r.top ;
|
|
||||||
r.left = 0 ;
|
|
||||||
r.top = 0 ;
|
|
||||||
}
|
|
||||||
if ( includeOuterStructures )
|
if ( includeOuterStructures )
|
||||||
InsetRect( &r , -4 , -4 ) ;
|
InsetRect( &r , -4 , -4 ) ;
|
||||||
RectRgn( visRgn , &r ) ;
|
RectRgn( visRgn , &r ) ;
|
||||||
|
Reference in New Issue
Block a user