// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// constructors and such
// ----------------------------------------------------------------------------
+wxWindowMac::wxWindowMac()
+{
+ Init();
+}
+
+wxWindowMac::wxWindowMac(wxWindowMac *parent,
+ wxWindowID id,
+ const wxPoint& pos ,
+ const wxSize& size ,
+ long style ,
+ const wxString& name )
+{
+ Init();
+ Create(parent, id, pos, size, style, name);
+}
+
void wxWindowMac::Init()
{
m_frozenness = 0 ;
if ( tlw )
{
Point tlworigin = { 0 , 0 } ;
- GrafPtr port ;
- bool swapped = QDSwapPort( UMAGetWindowPort( (WindowRef) tlw->MacGetWindowRef() ) , &port ) ;
- ::LocalToGlobal( &tlworigin ) ;
- if ( swapped )
- ::SetPort( port ) ;
+ QDLocalToGlobalPoint( UMAGetWindowPort( (WindowRef) tlw->MacGetWindowRef() ) , &tlworigin ) ;
x = tlworigin.h ;
y = tlworigin.v ;
}
if(x) localwhere.h = * x ;
if(y) localwhere.v = * y ;
- wxMacPortSaver s((GrafPtr)GetWindowPort( window )) ;
- ::GlobalToLocal( &localwhere ) ;
+ QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ;
if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ;
Point localwhere = { 0,0 };
if(x) localwhere.h = * x ;
if(y) localwhere.v = * y ;
-
- wxMacPortSaver s((GrafPtr)GetWindowPort( window )) ;
- ::LocalToGlobal( &localwhere ) ;
+ QDLocalToGlobalPoint( GetWindowPort( window ) , &localwhere ) ;
if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ;
}
return IsControlActive( (ControlRef) m_macControl ) ;
}
+void wxWindowMac::MacFlashInvalidAreas()
+{
+#if TARGET_API_MAC_OSX
+ HIViewFlashDirtyArea( (WindowRef) MacGetTopLevelWindowRef() ) ;
+#endif
+}
+
//
//
//
{
+
int width , height ;
GetClientSize( &width , &height ) ;
+#if TARGET_API_MAC_OSX
+ // note there currently is a bug in OSX which makes inefficient refreshes in case an entire control
+ // area is scrolled, this does not occur if width and height are 2 pixels less,
+ // TODO write optimal workaround
+ HIRect scrollrect = CGRectMake( MacGetLeftBorderSize() , MacGetTopBorderSize() , width , height ) ;
+ if ( rect )
+ {
+ HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ;
+ scrollrect = CGRectIntersection( scrollrect , scrollarea ) ;
+ }
+ if ( HIViewGetNeedsDisplay( (ControlRef) m_macControl ) )
+ {
+ // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
+ // either immediate redraw or full invalidate
+#if 1
+ // is the better overall solution, as it does not slow down scrolling
+ HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+#else
+ // this would be the preferred version for fast drawing controls
+ if( UMAGetSystemVersion() < 0x1030 )
+ Update() ;
+ else
+ HIViewRender((ControlRef) m_macControl) ;
+#endif
+ }
+ HIViewScrollRect ( (ControlRef) m_macControl , &scrollrect , dx ,dy ) ;
+#else
wxPoint pos;
pos.x = pos.y = 0;
Rect scrollrect;
RgnHandle updateRgn = NewRgn() ;
- {
+ {
wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ;
GetControlBounds( (ControlRef) m_macControl, &scrollrect);
-#if TARGET_API_MAC_OSX
- GetParent()->MacWindowToRootWindow( &scrollrect.left , &scrollrect.top ) ;
-#endif
scrollrect.top += MacGetTopBorderSize() ;
scrollrect.left += MacGetLeftBorderSize() ;
scrollrect.bottom = scrollrect.top + height ;
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
}
// ScrollWindowRect( (WindowRef) MacGetTopLevelWindowRef() , &scrollrect , dx , dy , kScrollWindowInvalidate, updateRgn ) ;
-#if TARGET_API_MAC_OSX
- Rect before,after ;
- GetRegionBounds( updateRgn , &before ) ;
- HIViewConvertRegion( updateRgn , (ControlRef) MacGetTopLevelWindow()->GetHandle() , (ControlRef) m_macControl ) ;
- GetRegionBounds( updateRgn , &after ) ;
- HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , updateRgn , true ) ;
-#else
- // TODO TEST
#endif
}
child->SetSize( x+dx, y+dy, w, h );
}
}
-
-// TODO remove, was moved higher up Update() ;
-
}
void wxWindowMac::MacOnScroll(wxScrollEvent &event )
void wxWindowMac::Update()
{
#if TARGET_API_MAC_OSX
- HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
WindowRef window = (WindowRef)MacGetTopLevelWindowRef() ;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
// for composited windows this also triggers a redraw of all
OSStatus status = noErr ;
status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
}
+ else
+ HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
}
#else
::Draw1Control( (ControlRef) m_macControl ) ;