X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/954fc50b6edca29cfc1b042c1227c91023580131..00c813596e3eefdd028365acf9542355937e5531:/src/mac/window.cpp diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 32f583f2ec..97326af879 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -45,7 +45,7 @@ #define wxWINDOW_VSCROLL 5997 #define MAC_SCROLLBAR_SIZE 16 -#include +#include "wx/mac/uma.h" #if wxUSE_DRAG_AND_DROP #include "wx/dnd.h" @@ -264,11 +264,9 @@ void wxWindowMac::SetFocus() } #endif // wxUSE_CARET // panel wants to track the window which was the last to have focus in it - wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); - if ( panel ) - { - panel->SetLastFocus((wxWindow*)this); - } + wxChildFocusEvent eventFocus(this); + (void)GetEventHandler()->ProcessEvent(eventFocus); + #ifndef __WXUNIVERSAL__ wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ; if ( control && control->GetMacControl() ) @@ -619,6 +617,8 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) frame->PositionStatusBar(); frame->PositionToolBar(); } + if ( doMove ) + wxWindowMac::MacTopLevelWindowChangedPosition() ; // like this only children will be notified } else { @@ -776,8 +776,8 @@ bool wxWindowMac::Show(bool show) { if (show) { - UMAShowWindow( m_macWindowData->m_macWindow ) ; - UMASelectWindow( m_macWindowData->m_macWindow ) ; + ::ShowWindow( m_macWindowData->m_macWindow ) ; + ::SelectWindow( m_macWindowData->m_macWindow ) ; // no need to generate events here, they will get them triggered by macos // actually they should be , but apparently they are not wxSize size(m_width, m_height); @@ -787,7 +787,7 @@ bool wxWindowMac::Show(bool show) } else { - UMAHideWindow( m_macWindowData->m_macWindow ) ; + ::HideWindow( m_macWindowData->m_macWindow ) ; } } MacSuperShown( show ) ; @@ -1181,7 +1181,7 @@ void wxWindowMac::MacCreateRealWindow( const wxString& title, attr |= kWindowCloseBoxAttribute ; } - UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ; + ::CreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ; wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ; wxString label ; if( wxApp::s_macDefaultEncodingIsPC ) @@ -1189,7 +1189,7 @@ void wxWindowMac::MacCreateRealWindow( const wxString& title, else label = title ; UMASetWTitleC( m_macWindowData->m_macWindow , label ) ; - UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; + ::CreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; m_macWindowData->m_macFocus = NULL ; m_macWindowData->m_macHasReceivedFirstActivate = true ; @@ -1482,18 +1482,10 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) // 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 - wxWindowMac *win = this; - while ( win ) - { - wxWindowMac *parent = win->GetParent(); - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if ( panel ) - { - panel->SetLastFocus(win); - } - - win = parent; - } + + // CS:don't know if this is still needed: + //wxChildFocusEvent eventFocus(this); + //(void)GetEventHandler()->ProcessEvent(eventFocus); event.Skip(); } @@ -1506,7 +1498,7 @@ void wxWindowMac::Clear() int w ,h ; wxPoint origin = GetClientAreaOrigin() ; GetClientSize( &w , &h ) ; - UMASetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ; + ::SetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ; Rect r = { origin.y , origin.x, origin.y+h , origin.x+w } ; EraseRect( &r ) ; } @@ -1553,7 +1545,7 @@ void wxWindowMac::Raise() { if ( m_macWindowData ) { - UMABringToFront( m_macWindowData->m_macWindow ) ; + ::BringToFront( m_macWindowData->m_macWindow ) ; } } @@ -1562,7 +1554,7 @@ void wxWindowMac::Lower() { if ( m_macWindowData ) { - UMASendBehind( m_macWindowData->m_macWindow , NULL ) ; + ::SendBehind( m_macWindowData->m_macWindow , NULL ) ; } } @@ -1858,7 +1850,7 @@ void wxWindowMac::MacRedraw( RgnHandle updatergn , long time) eraseBackground = true ; if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) ) { - UMASetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ; + ::SetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ; } else if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) ) { @@ -1890,7 +1882,7 @@ void wxWindowMac::MacRedraw( RgnHandle updatergn , long time) { Rect box ; GetRegionBounds( updatergn , &box) ; - UMAApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true); + ::ApplyThemeBackground(kThemeBackgroundTabPane, &box , kThemeStateActive,8,true); break ; } } @@ -1904,7 +1896,7 @@ void wxWindowMac::MacRedraw( RgnHandle updatergn , long time) if ( !parent ) { // if there is nothing special -> use default - UMASetThemeWindowBackground( window , kThemeBrushDialogBackgroundActive , false ) ; + ::SetThemeWindowBackground( window , kThemeBrushDialogBackgroundActive , false ) ; } } else @@ -2204,6 +2196,19 @@ void wxWindowMac::MacSuperChangedPosition() } } +void wxWindowMac::MacTopLevelWindowChangedPosition() +{ + // only screen-absolute structures have to be moved i.e. glcanvas + + wxNode *node = GetChildren().First(); + while ( node ) + { + wxWindowMac *child = (wxWindowMac *)node->Data(); + child->MacTopLevelWindowChangedPosition() ; + node = node->Next(); + } +} + bool wxWindowMac::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win ) { if ( window == NULL ) @@ -2243,7 +2248,7 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect Pattern whiteColor ; ::BackPat( GetQDGlobalsWhite( &whiteColor) ) ; - ::UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ; + ::SetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ; return true; }