+ if ( m_tooltip )
+ {
+ return m_tooltip->GetTip() ;
+ }
+ return wxEmptyString ;
+}
+
+void wxWindowMac::Update()
+{
+#if TARGET_API_MAC_OSX
+ 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
+ // invalid views in the window
+ if( UMAGetSystemVersion() >= 0x1030 )
+ HIWindowFlush(window) ;
+ else
+#endif
+ {
+ // the only way to trigger the redrawing on earlier systems is to call
+ // ReceiveNextEvent
+
+ EventRef currentEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
+ UInt32 currentEventClass = 0 ;
+ UInt32 currentEventKind = 0 ;
+ if ( currentEvent != NULL )
+ {
+ currentEventClass = ::GetEventClass( currentEvent ) ;
+ currentEventKind = ::GetEventKind( currentEvent ) ;
+ }
+ if ( currentEventClass != kEventClassMenu )
+ {
+ // when tracking a menu, strange redraw errors occur if we flush now, so leave..
+
+ EventRef theEvent;
+ OSStatus status = noErr ;
+ status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
+ }
+ else
+ HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+ }
+#else
+ ::Draw1Control( (ControlRef) m_macControl ) ;
+#endif
+}
+
+wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
+{
+ wxTopLevelWindowMac* win = NULL ;
+ WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
+ if ( window )
+ {
+ win = wxFindWinFromMacWindow( window ) ;
+ }
+ return win ;
+}
+wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures )
+{
+
+ Rect r ;
+ RgnHandle visRgn = NewRgn() ;
+ RgnHandle tempRgn = NewRgn() ;
+ if ( IsControlVisible( (ControlRef) m_macControl ) )
+ {
+ GetControlBounds( (ControlRef) m_macControl , &r ) ;
+ if (! MacGetTopLevelWindow()->MacUsesCompositing() )
+ {
+ MacRootWindowToWindow( &r.left , & r.top ) ;
+ MacRootWindowToWindow( &r.right , & r.bottom ) ;
+ }
+ else
+ {
+ r.right -= r.left ;
+ r.bottom -= r.top ;
+ r.left = 0 ;
+ r.top = 0 ;
+ }
+ if ( includeOuterStructures )
+ InsetRect( &r , -3 , -3 ) ;
+ RectRgn( visRgn , &r ) ;
+ if ( !IsTopLevel() )
+ {
+ wxWindow* child = this ;
+ wxWindow* parent = child->GetParent() ;
+ while( parent )
+ {
+ int x , y ;
+ wxSize size ;
+ // we have to find a better clipping algorithm here, in order not to clip things
+ // positioned like status and toolbar
+ if ( 1 /* parent->IsTopLevel() && child->IsKindOf( CLASSINFO( wxToolBar ) ) */ )
+ {
+ size = parent->GetSize() ;
+ x = y = 0 ;
+ }
+ else
+ {
+ size = parent->GetClientSize() ;
+ wxPoint origin = parent->GetClientAreaOrigin() ;
+ x = origin.x ;
+ y = origin.y ;
+ }
+ parent->MacWindowToRootWindow( &x, &y ) ;
+ MacRootWindowToWindow( &x , &y ) ;
+
+ SetRectRgn( tempRgn ,
+ x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
+ x + size.x - parent->MacGetRightBorderSize(),
+ y + size.y - parent->MacGetBottomBorderSize()) ;
+
+ SectRgn( visRgn , tempRgn , visRgn ) ;
+ if ( parent->IsTopLevel() )
+ break ;
+ child = parent ;
+ parent = child->GetParent() ;
+ }
+ }
+ }
+
+ wxRegion vis = visRgn ;
+ DisposeRgn( visRgn ) ;
+ DisposeRgn( tempRgn ) ;
+ return vis ;