// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "window.h"
#endif
-#include "wx/setup.h"
+#include "wx/wxprec.h"
+
#include "wx/menu.h"
#include "wx/window.h"
#include "wx/dc.h"
#if 0
// in case we would need a coregraphics compliant background erase first
// now usable to track redraws
- CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
if ( thisWindow->MacIsUserPane() )
{
+ CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
static float color = 0.5 ;
static channel = 0 ;
HIRect bounds;
channel = 0 ;
}
}
+#endif
+#if wxMAC_USE_CORE_GRAPHICS
+ CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
+ thisWindow->MacSetCGContextRef( cgContext ) ;
#endif
if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
result = noErr ;
+#if wxMAC_USE_CORE_GRAPHICS
+ thisWindow->MacSetCGContextRef( NULL ) ;
+#endif
if ( allocatedRgn )
DisposeRgn( allocatedRgn ) ;
}
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacWindowEventHandler )
+#if !TARGET_API_MAC_OSX
+
// ---------------------------------------------------------------------------
// UserPane events for non OSX builds
// ---------------------------------------------------------------------------
ControlUserPaneFocusUPP gControlUserPaneFocusUPP = NULL ;
ControlUserPaneBackgroundUPP gControlUserPaneBackgroundUPP = NULL ;
+#endif
+
// ===========================================================================
// implementation
// ===========================================================================
m_macBackgroundBrush = wxNullBrush ;
m_macIsUserPane = TRUE;
-
+#if wxMAC_USE_CORE_GRAPHICS
+ m_cgContextRef = NULL ;
+#endif
// make sure all proc ptrs are available
+#if !TARGET_API_MAC_OSX
if ( gControlUserPaneDrawUPP == NULL )
{
gControlUserPaneDrawUPP = NewControlUserPaneDrawUPP( wxMacControlUserPaneDrawProc ) ;
gControlUserPaneFocusUPP = NewControlUserPaneFocusUPP( wxMacControlUserPaneFocusProc ) ;
gControlUserPaneBackgroundUPP = NewControlUserPaneBackgroundUPP( wxMacControlUserPaneBackgroundProc ) ;
}
+#endif
if ( wxMacLiveScrollbarActionUPP == NULL )
{
wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
#endif
}
-void wxWindowMac::MacRedrawControl()
-{
-/*
- if ( *m_peer && MacGetTopLevelWindowRef() && m_peer->IsVisible())
- {
-#if TARGET_API_MAC_CARBON
- Update() ;
-#else
- wxClientDC dc(this) ;
- wxMacPortSetter helper(&dc) ;
- wxMacWindowClipper clipper(this) ;
- wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
- UMADrawControl( *m_peer ) ;
-#endif
- }
-*/
-}
-
/* TODO
void wxWindowMac::OnPaint(wxPaintEvent& event)
{
SectRect( &scrollrect , &r , &scrollrect ) ;
}
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
+
+ // now scroll the former update region as well and add the new update region
+
+ WindowRef rootWindow = (WindowRef) MacGetTopLevelWindowRef() ;
+ RgnHandle formerUpdateRgn = NewRgn() ;
+ RgnHandle scrollRgn = NewRgn() ;
+ RectRgn( scrollRgn , &scrollrect ) ;
+ GetWindowUpdateRgn( rootWindow , formerUpdateRgn ) ;
+ Point pt = {0,0} ;
+ LocalToGlobal( &pt ) ;
+ OffsetRgn( formerUpdateRgn , -pt.h , -pt.v ) ;
+ SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ;
+ if ( !EmptyRgn( formerUpdateRgn ) )
+ {
+ MacOffsetRgn( formerUpdateRgn , dx , dy ) ;
+ SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ;
+ InvalWindowRgn(rootWindow , formerUpdateRgn ) ;
+ }
+ InvalWindowRgn(rootWindow , updateRgn ) ;
+ DisposeRgn( updateRgn ) ;
+ DisposeRgn( formerUpdateRgn ) ;
+ DisposeRgn( scrollRgn ) ;
}
- // ScrollWindowRect( (WindowRef) MacGetTopLevelWindowRef() , &scrollrect , dx , dy , kScrollWindowInvalidate, updateRgn ) ;
#endif
}
bool handled = false ;
Rect updatebounds ;
GetRegionBounds( updatergn , &updatebounds ) ;
+
// wxLogDebug("update for %s bounds %d , %d , %d , %d",typeid(*this).name() , updatebounds.left , updatebounds.top , updatebounds.right , updatebounds.bottom ) ;
if ( !EmptyRgn(updatergn) )
{
{
if ( RectInRgn( &childRect , updatergn ) )
{
+#if wxMAC_USE_CORE_GRAPHICS
+#else
// paint custom borders
wxNcPaintEvent eventNc( child->GetId() );
eventNc.SetEventObject( child );
wxMacPortSetter helper(&dc) ;
child->MacPaintBorders( dc.m_macLocalOrigin.x + childRect.left , dc.m_macLocalOrigin.y + childRect.top) ;
}
+#endif
}
}
if ( child->m_peer->NeedsFocusRect() && child->m_peer->HasFocus() )
{
+#if wxMAC_USE_CORE_GRAPHICS
+#else
wxWindowDC dc(this) ;
dc.SetClippingRegion(wxRegion(updatergn));
wxMacPortSetter helper(&dc) ;
Rect r = childRect ;
OffsetRect( &r , dc.m_macLocalOrigin.x , dc.m_macLocalOrigin.y ) ;
DrawThemeFocusRect( &r , true ) ;
+#endif
}
}
}
return handled ;
}
-void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
-{
- RgnHandle updatergn = (RgnHandle) updatergnr ;
- // updatergn is always already clipped to our boundaries
- // if we are in compositing mode then it is in relative to the upper left of the control
- // if we are in non-compositing, then it is relatvie to the uppder left of the content area
- // of the toplevel window
- // it is in window coordinates, not in client coordinates
-
- // ownUpdateRgn is the area that this window has to repaint, it is in window coordinates
- RgnHandle ownUpdateRgn = NewRgn() ;
- CopyRgn( updatergn , ownUpdateRgn ) ;
-
- if ( MacGetTopLevelWindow()->MacUsesCompositing() == false )
- {
- Rect bounds;
- m_peer->GetRectInWindowCoords( &bounds );
- RgnHandle controlRgn = NewRgn();
- RectRgn( controlRgn, &bounds );
- //KO: This sets the ownUpdateRgn to the area of this control that is inside
- // the window update region
- SectRgn( ownUpdateRgn, controlRgn, ownUpdateRgn );
- DisposeRgn( controlRgn );
-
- //KO: convert ownUpdateRgn to local coordinates
- OffsetRgn( ownUpdateRgn, -bounds.left, -bounds.top );
- }
-
- MacDoRedraw( ownUpdateRgn , time ) ;
- DisposeRgn( ownUpdateRgn ) ;
-
-}
WXWindow wxWindowMac::MacGetTopLevelWindowRef() const
{