+ if( dx == 0 && dy ==0 )
+ return ;
+
+
+ {
+ wxClientDC dc(this) ;
+ wxMacPortSetter helper(&dc) ;
+
+ int width , height ;
+ GetClientSize( &width , &height ) ;
+
+ Rect scrollrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , dc.YLOG2DEVMAC(height) , dc.XLOG2DEVMAC(width) } ;
+ RgnHandle updateRgn = NewRgn() ;
+ ClipRect( &scrollrect ) ;
+ if ( rect )
+ {
+ Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
+ dc.XLOG2DEVMAC(rect->x + rect->width) } ;
+ SectRect( &scrollrect , &r , &scrollrect ) ;
+ }
+ ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
+ // we also have to scroll the update rgn in this rectangle
+ // in order not to loose updates
+ WindowRef rootWindow = (WindowRef) MacGetRootWindow() ;
+ 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 ) ;
+ }
+
+ for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
+ {
+ wxWindowMac *child = node->GetData();
+ if (child == m_vScrollBar) continue;
+ if (child == m_hScrollBar) continue;
+ if (child->IsTopLevel()) continue;
+
+ int x,y;
+ child->GetPosition( &x, &y );
+ int w,h;
+ child->GetSize( &w, &h );
+ child->SetSize( x+dx, y+dy, w, h );
+ }
+
+ Update() ;
+
+}
+
+void wxWindowMac::MacOnScroll(wxScrollEvent &event )
+{
+ if ( event.m_eventObject == m_vScrollBar || event.m_eventObject == m_hScrollBar )
+ {
+ wxScrollWinEvent wevent;
+ wevent.SetPosition(event.GetPosition());
+ wevent.SetOrientation(event.GetOrientation());
+ wevent.m_eventObject = this;
+
+ if (event.m_eventType == wxEVT_SCROLL_TOP)
+ wevent.m_eventType = wxEVT_SCROLLWIN_TOP;
+ else if (event.m_eventType == wxEVT_SCROLL_BOTTOM)
+ wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM;
+ else if (event.m_eventType == wxEVT_SCROLL_LINEUP)
+ wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+ else if (event.m_eventType == wxEVT_SCROLL_LINEDOWN)
+ wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+ else if (event.m_eventType == wxEVT_SCROLL_PAGEUP)
+ wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+ else if (event.m_eventType == wxEVT_SCROLL_PAGEDOWN)
+ wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+ else if (event.m_eventType == wxEVT_SCROLL_THUMBTRACK)
+ wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
+ else if (event.m_eventType == wxEVT_SCROLL_THUMBRELEASE)
+ wevent.m_eventType = wxEVT_SCROLLWIN_THUMBRELEASE;
+
+ GetEventHandler()->ProcessEvent(wevent);
+ }
+}
+
+// Get the window with the focus
+wxWindowMac *wxWindowBase::FindFocus()
+{
+ return gFocusWindow ;
+}
+
+void wxWindowMac::OnSetFocus(wxFocusEvent& event)
+{
+ // panel wants to track the window which was the last to have focus in it,
+ // so we want to set ourselves as the window which last had focus
+ //
+ // notice that it's also important to do it upwards the tree becaus
+ // otherwise when the top level panel gets focus, it won't set it back to
+ // us, but to some other sibling
+
+ // CS:don't know if this is still needed:
+ //wxChildFocusEvent eventFocus(this);
+ //(void)GetEventHandler()->ProcessEvent(eventFocus);
+
+ event.Skip();