-
- event.m_timeStamp = ev->when;
- event.SetEventObject(this);
- if ( wxTheApp->s_captureWindow )
- {
- int x = event.m_x ;
- int y = event.m_y ;
- wxTheApp->s_captureWindow->ScreenToClient( &x , &y ) ;
- event.m_x = x ;
- event.m_y = y ;
- wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
- if ( ev->what == mouseUp )
- {
- wxTheApp->s_captureWindow = NULL ;
- if ( wxBusyCursorCount == 0 )
- {
- m_cursor.MacInstall() ;
- }
- }
- }
- else
- {
- MacDispatchMouseEvent( event ) ;
- }
-}
-
-void wxWindow::MacMouseDown( EventRecord *ev , short part)
-{
- MacFireMouseEvent( ev ) ;
-}
-
-void wxWindow::MacMouseUp( EventRecord *ev , short part)
-{
- WindowPtr frontWindow ;
- switch (part)
- {
- case inContent:
- {
- MacFireMouseEvent( ev ) ;
- }
- break ;
- }
-}
-
-void wxWindow::MacMouseMoved( EventRecord *ev , short part)
-{
- WindowPtr frontWindow ;
- switch (part)
- {
- case inContent:
- {
- MacFireMouseEvent( ev ) ;
- }
- break ;
- }
-}
-void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating )
-{
- wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating);
- event.m_timeStamp = ev->when ;
- event.SetEventObject(this);
-
- GetEventHandler()->ProcessEvent(event);
-
- UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
-}
-
-void wxWindow::MacRedraw( RgnHandle updatergn , long time)
-{
- // updatergn is always already clipped to our boundaries
- WindowRef window = GetMacRootWindow() ;
- wxWindow* win = wxFindWinFromMacWindow( window ) ;
- {
- wxMacDrawingHelper focus( this ) ; // was client
- if ( focus.Ok() )
- {
- WindowRef window = GetMacRootWindow() ;
- bool eraseBackground = false ;
- if ( m_macWindowData )
- eraseBackground = true ;
- if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
- {
- UMASetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ;
- }
- else if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
- {
- // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
- // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
- // either a non gray background color or a non control window
-
-
- wxWindow* parent = GetParent() ;
- while( parent )
- {
- if ( parent->GetMacRootWindow() != window )
- {
- // we are in a different window on the mac system
- parent = NULL ;
- break ;
- }
-
- if( parent->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)parent)->GetMacControl() )
- {
- if ( parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
- {
- // if we have any other colours in the hierarchy
- RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
- break ;
- }
- // if we have the normal colours in the hierarchy but another control etc. -> use it's background
- if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
- {
- Rect box ;
- GetRegionBounds( updatergn , &box) ;
- UMAApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true);
- break ;
- }
- }
- else
- {
- parent = NULL ;
- break ;
- }
- parent = parent->GetParent() ;
- }
- if ( !parent )
- {
- // if there is nothing special -> use default
- UMASetThemeWindowBackground( window , kThemeBrushDialogBackgroundActive , false ) ;
- }
- }
- else
- {
- RGBBackColor( &m_backgroundColour.GetPixel()) ;
- }
- if ( GetParent() && m_backgroundColour != GetParent()->GetBackgroundColour() )
- eraseBackground = true ;
- SetClip( updatergn ) ;
- if ( eraseBackground )
- {
- EraseRgn( updatergn ) ;
- }
- }
-
- m_macUpdateRgn = updatergn ;
- {
- RgnHandle newupdate = NewRgn() ;
- wxSize point = GetClientSize() ;
- wxPoint origin = GetClientAreaOrigin() ;
-
- SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
- SectRgn( newupdate , m_macUpdateRgn , newupdate ) ;
- OffsetRgn( newupdate , -origin.x , -origin.y ) ;
- m_updateRegion = newupdate ;
- DisposeRgn( newupdate ) ;
- }
-
- MacPaintBorders() ;
- wxPaintEvent event;
- event.m_timeStamp = time ;
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
- }
-
-
- RgnHandle childupdate = NewRgn() ;
-
- for (wxNode *node = GetChildren().First(); node; node = node->Next())
- {
- wxWindow *child = (wxWindow*)node->Data();
- SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
- SectRgn( childupdate , m_macUpdateRgn , childupdate ) ;
- OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
- if ( child->GetMacRootWindow() == window && child->IsShown() && !EmptyRgn( childupdate ) )
- {
- // because dialogs may also be children
- child->MacRedraw( childupdate , time ) ;
- }
- }
- DisposeRgn( childupdate ) ;
- // eventually a draw grow box here
-}
-
-void wxWindow::MacUpdateImmediately()
-{
- WindowRef window = GetMacRootWindow() ;
- if ( window )
- {
- wxWindow* win = wxFindWinFromMacWindow( window ) ;
- #if TARGET_CARBON
- AGAPortHelper help( GetWindowPort(window) ) ;
- #else
- AGAPortHelper help( (window) ) ;
- #endif
- SetOrigin( 0 , 0 ) ;
- BeginUpdate( window ) ;
- if ( win )
- {
- RgnHandle region = NewRgn();
-
- if ( region )
- {
- GetPortVisibleRegion( GetWindowPort( window ), region );
-
- // if windowshade gives incompatibility , take the follwing out
- if ( !EmptyRgn( region ) )
- {
- win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
- }
- DisposeRgn( region );
- }
- }
- EndUpdate( window ) ;
- }
-}
-
-void wxWindow::MacUpdate( EventRecord *ev )
-{
- WindowRef window = (WindowRef) ev->message ;
- wxWindow * win = wxFindWinFromMacWindow( window ) ;
- #if TARGET_CARBON
- AGAPortHelper help( GetWindowPort(window) ) ;
- #else
- AGAPortHelper help( (window) ) ;
- #endif
- SetOrigin( 0 , 0 ) ;
- BeginUpdate( window ) ;
- if ( win )
- {
- RgnHandle region = NewRgn();
-
- if ( region )
- {
+
+ event.m_timeStamp = ev->when;
+ event.SetEventObject(this);
+ if ( wxTheApp->s_captureWindow )
+ {
+ int x = event.m_x ;
+ int y = event.m_y ;
+ wxTheApp->s_captureWindow->ScreenToClient( &x , &y ) ;
+ event.m_x = x ;
+ event.m_y = y ;
+ wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
+ if ( ev->what == mouseUp )
+ {
+ wxTheApp->s_captureWindow = NULL ;
+ if ( wxBusyCursorCount == 0 )
+ {
+ m_cursor.MacInstall() ;
+ }
+ }
+ }
+ else
+ {
+ MacDispatchMouseEvent( event ) ;
+ }
+}
+
+void wxWindowMac::MacMouseDown( EventRecord *ev , short part)
+{
+ MacFireMouseEvent( ev ) ;
+}
+
+void wxWindowMac::MacMouseUp( EventRecord *ev , short part)
+{
+ switch (part)
+ {
+ case inContent:
+ {
+ MacFireMouseEvent( ev ) ;
+ }
+ break ;
+ }
+}
+
+void wxWindowMac::MacMouseMoved( EventRecord *ev , short part)
+{
+ switch (part)
+ {
+ case inContent:
+ {
+ MacFireMouseEvent( ev ) ;
+ }
+ break ;
+ }
+}
+void wxWindowMac::MacActivate( EventRecord *ev , bool inIsActivating )
+{
+ if ( !m_macWindowData->m_macHasReceivedFirstActivate )
+ m_macWindowData->m_macHasReceivedFirstActivate = true ;
+
+ wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
+ event.m_timeStamp = ev->when ;
+ event.SetEventObject(this);
+
+ GetEventHandler()->ProcessEvent(event);
+
+ Refresh(false) ;
+ UMAHighlightAndActivateWindow( m_macWindowData->m_macWindow , inIsActivating ) ;
+// MacUpdateImmediately() ;
+}
+
+void wxWindowMac::MacRedraw( RgnHandle updatergn , long time)
+{
+ // updatergn is always already clipped to our boundaries
+ WindowRef window = GetMacRootWindow() ;
+ // ownUpdateRgn is the area that this window has to invalidate i.e. its own area without its children
+ RgnHandle ownUpdateRgn = NewRgn() ;
+ CopyRgn( updatergn , ownUpdateRgn ) ;
+
+ {
+ wxMacDrawingHelper focus( this ) ; // was client
+ if ( focus.Ok() )
+ {
+ WindowRef window = GetMacRootWindow() ;
+ bool eraseBackground = false ;
+ if ( m_macWindowData )
+ eraseBackground = true ;
+ if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
+ {
+ ::SetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ;
+ }
+ else if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
+ {
+ // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
+ // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
+ // either a non gray background color or a non control window
+
+
+ wxWindowMac* parent = GetParent() ;
+ while( parent )
+ {
+ if ( parent->GetMacRootWindow() != window )
+ {
+ // we are in a different window on the mac system
+ parent = NULL ;
+ break ;
+ }
+
+ if( parent->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)parent)->GetMacControl() )
+ {
+ if ( parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
+ {
+ // if we have any other colours in the hierarchy
+ RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
+ break ;
+ }
+ // if we have the normal colours in the hierarchy but another control etc. -> use it's background
+ if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+ {
+ Rect box ;
+ GetRegionBounds( updatergn , &box) ;
+ ::ApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true);
+ break ;
+ }
+ }
+ else
+ {
+ parent = NULL ;
+ break ;
+ }
+ parent = parent->GetParent() ;
+ }
+ if ( !parent )
+ {
+ // if there is nothing special -> use default
+ ::SetThemeWindowBackground( window , kThemeBrushDialogBackgroundActive , false ) ;
+ }
+ }
+ else
+ {
+ RGBBackColor( &m_backgroundColour.GetPixel()) ;
+ }
+ // subtract all non transparent children from updatergn
+
+ RgnHandle childarea = NewRgn() ;
+ for (wxNode *node = GetChildren().First(); node; node = node->Next())
+ {
+ wxWindowMac *child = (wxWindowMac*)node->Data();
+ // eventually test for transparent windows
+ if ( child->GetMacRootWindow() == window && child->IsShown() )
+ {
+ if ( child->GetBackgroundColour() != m_backgroundColour && !child->IsKindOf( CLASSINFO( wxControl ) ) && ((wxControl*)child)->GetMacControl() )
+ {
+ SetRectRgn( childarea , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
+ DiffRgn( ownUpdateRgn , childarea , ownUpdateRgn ) ;
+ }
+ }
+ }
+ DisposeRgn( childarea ) ;
+
+ if ( GetParent() && m_backgroundColour != GetParent()->GetBackgroundColour() )
+ eraseBackground = true ;
+ SetClip( ownUpdateRgn ) ;
+ if ( m_macEraseOnRedraw ) {
+ if ( eraseBackground )
+ {
+ EraseRgn( ownUpdateRgn ) ;
+ }
+ }
+ else {
+ m_macEraseOnRedraw = true ;
+ }
+ }
+
+ {
+ RgnHandle newupdate = NewRgn() ;
+ wxSize point = GetClientSize() ;
+ wxPoint origin = GetClientAreaOrigin() ;
+
+ SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
+ SectRgn( newupdate , ownUpdateRgn , newupdate ) ;
+ OffsetRgn( newupdate , -origin.x , -origin.y ) ;
+ m_updateRegion = newupdate ;
+ DisposeRgn( newupdate ) ;
+ }
+
+ MacPaintBorders() ;
+ wxPaintEvent event;
+ event.m_timeStamp = time ;
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+ }
+
+
+ RgnHandle childupdate = NewRgn() ;
+
+ for (wxNode *node = GetChildren().First(); node; node = node->Next())
+ {
+ wxWindowMac *child = (wxWindowMac*)node->Data();
+ SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
+ SectRgn( childupdate , updatergn , childupdate ) ;
+ OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
+ if ( child->GetMacRootWindow() == window && child->IsShown() && !EmptyRgn( childupdate ) )
+ {
+ // because dialogs may also be children
+ child->MacRedraw( childupdate , time ) ;
+ }
+ }
+ DisposeRgn( childupdate ) ;
+ // eventually a draw grow box here
+}
+
+void wxWindowMac::MacUpdateImmediately()
+{
+ WindowRef window = GetMacRootWindow() ;
+ if ( window )
+ {
+ wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
+ #if TARGET_CARBON
+ AGAPortHelper help( GetWindowPort(window) ) ;
+ #else
+ AGAPortHelper help( (window) ) ;
+ #endif
+ SetOrigin( 0 , 0 ) ;
+ BeginUpdate( window ) ;
+ if ( win )
+ {
+ RgnHandle region = NewRgn();
+
+ if ( region )
+ {
+ GetPortVisibleRegion( GetWindowPort( window ), region );
+
+ // if windowshade gives incompatibility , take the follwing out
+ if ( !EmptyRgn( region ) && win->m_macWindowData->m_macHasReceivedFirstActivate )
+ {
+ win->MacRedraw( region , wxTheApp->sm_lastMessageTime ) ;
+ }
+ DisposeRgn( region );
+ }
+ }
+ EndUpdate( window ) ;
+ }
+}
+
+void wxWindowMac::MacUpdate( EventRecord *ev )
+{
+ WindowRef window = (WindowRef) ev->message ;
+ wxWindowMac * win = wxFindWinFromMacWindow( window ) ;
+ #if TARGET_CARBON
+ AGAPortHelper help( GetWindowPort(window) ) ;
+ #else
+ AGAPortHelper help( (window) ) ;
+ #endif
+ SetOrigin( 0 , 0 ) ;
+ BeginUpdate( window ) ;
+ if ( win )
+ {
+ RgnHandle region = NewRgn();
+
+ if ( region )
+ {