X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d497dca47560bb375902c2a261d819e7470a92b3..050c9e3c90c58b05d5b3f7384d1556ca9669f13e:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 40f2f2a960..6c1095f8d3 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -421,8 +421,8 @@ void wxWindowMac::MacClientToRootWindow( int *x , int *y ) const { if ( m_macWindowData == NULL) { - if(x) *x += m_x ; - if(y) *y += m_y ; + if(x) *x += m_x + MacGetLeftBorderSize(); + if(y) *y += m_y + MacGetTopBorderSize(); GetParent()->MacClientToRootWindow( x , y ) ; } } @@ -431,8 +431,8 @@ void wxWindowMac::MacRootWindowToClient( int *x , int *y ) const { if ( m_macWindowData == NULL) { - if(x) *x -= m_x ; - if(y) *y -= m_y ; + if(x) *x -= m_x + MacGetLeftBorderSize(); + if(y) *y -= m_y + MacGetTopBorderSize(); GetParent()->MacRootWindowToClient( x , y ) ; } } @@ -617,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 { @@ -774,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); @@ -785,7 +787,7 @@ bool wxWindowMac::Show(bool show) } else { - UMAHideWindow( m_macWindowData->m_macWindow ) ; + ::HideWindow( m_macWindowData->m_macWindow ) ; } } MacSuperShown( show ) ; @@ -1179,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 ) @@ -1187,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 ; @@ -1211,33 +1213,34 @@ void wxWindowMac::MacPaintBorders( ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) { bool sunken = HasFlag( wxSUNKEN_BORDER ) ; - RGBColor pen1 = sunken ? white : black ; - RGBColor pen2 = sunken ? shadow : face ; - RGBColor pen3 = sunken ? face : shadow ; - RGBColor pen4 = sunken ? black : white ; - - RGBForeColor( &pen1 ) ; - { - Rect rect = { 0 , 0 , m_height , m_width } ; - FrameRect( &rect ) ; - } - RGBForeColor( &pen2 ) ; - { - Rect rect = { 1 , 1 , m_height -1 , m_width -1} ; - FrameRect( &rect ) ; - } - RGBForeColor( &pen3 ) ; - { - Rect rect = { 0 , 0 , m_height -2 , m_width -2} ; - FrameRect( &rect ) ; - } - RGBForeColor( &pen4 ) ; - { - MoveTo( 0 , 0 ) ; - LineTo( m_width - 3 , 0 ) ; - MoveTo( 0 , 0 ) ; - LineTo( 0 , m_height - 3 ) ; - } + RGBForeColor( &face ); + MoveTo( 0 , m_height - 2 ); + LineTo( 0 , 0 ); + LineTo( m_width - 2 , 0 ); + + MoveTo( 2 , m_height - 3 ); + LineTo( m_width - 3 , m_height - 3 ); + LineTo( m_width - 3 , 2 ); + + RGBForeColor( sunken ? &face : &black ); + MoveTo( 0 , m_height - 1 ); + LineTo( m_width - 1 , m_height - 1 ); + LineTo( m_width - 1 , 0 ); + + RGBForeColor( sunken ? &shadow : &white ); + MoveTo( 1 , m_height - 3 ); + LineTo( 1, 1 ); + LineTo( m_width - 3 , 1 ); + + RGBForeColor( sunken ? &white : &shadow ); + MoveTo( 1 , m_height - 2 ); + LineTo( m_width - 2 , m_height - 2 ); + LineTo( m_width - 2 , 1 ); + + RGBForeColor( sunken ? &black : &face ); + MoveTo( 2 , m_height - 4 ); + LineTo( 2 , 2 ); + LineTo( m_width - 4 , 2 ); } else if (HasFlag(wxSIMPLE_BORDER)) { @@ -1245,69 +1248,6 @@ void wxWindowMac::MacPaintBorders( ) RGBForeColor( &black ) ; FrameRect( &rect ) ; } -/* - if ( this->GetParent() ) - { - wxPaintDC dc(GetParent()); - GetParent()->PrepareDC(dc); - - if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) ) - { - bool sunken = HasFlag( wxSUNKEN_BORDER ) ; - - wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ; - wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ; - - wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN; - wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow; - wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow; - wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN; - - dc.SetPen(wxPen1); - dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button - - dc.SetPen(wxPen2); - dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top - - dc.SetPen(wxPen3); - dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button - - dc.SetPen(wxPen4); - dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top - dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3); - } - else if (HasFlag(wxDOUBLE_BORDER)) - { - bool sunken = HasFlag( wxSUNKEN_BORDER ) ; - - wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ; - wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ; - - wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN; - wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow; - wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow; - wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN; - - dc.SetPen(wxPen1); - dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button - - dc.SetPen(wxPen2); - dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top - - dc.SetPen(wxPen3); - dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button - - dc.SetPen(wxPen4); - dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top - dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3); - } - else if (HasFlag(wxSIMPLE_BORDER)) - { - dc.SetPen(*wxBLACK_PEN); - dc.DrawRectangle(m_x, m_y, m_width, m_height); - } - } - */ } // New function that will replace some of the above. @@ -1496,7 +1436,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 ) ; } @@ -1543,7 +1483,7 @@ void wxWindowMac::Raise() { if ( m_macWindowData ) { - UMABringToFront( m_macWindowData->m_macWindow ) ; + ::BringToFront( m_macWindowData->m_macWindow ) ; } } @@ -1552,7 +1492,7 @@ void wxWindowMac::Lower() { if ( m_macWindowData ) { - UMASendBehind( m_macWindowData->m_macWindow , NULL ) ; + ::SendBehind( m_macWindowData->m_macWindow , NULL ) ; } } @@ -1848,7 +1788,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 ) ) { @@ -1880,7 +1820,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 ; } } @@ -1894,7 +1834,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 @@ -2194,6 +2134,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 ) @@ -2233,7 +2186,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; } @@ -2330,11 +2283,11 @@ long wxWindowMac::MacGetLeftBorderSize( ) const if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) { - return 2 ; + return 3 ; } else if ( m_windowStyle &wxDOUBLE_BORDER) { - return 2 ; + return 3 ; } else if (m_windowStyle &wxSIMPLE_BORDER) { @@ -2358,7 +2311,7 @@ long wxWindowMac::MacGetRightBorderSize( ) const } else if (m_windowStyle &wxSIMPLE_BORDER) { - return 3 ; + return 1 ; } return 0 ; } @@ -2370,11 +2323,11 @@ long wxWindowMac::MacGetTopBorderSize( ) const if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) { - return 2 ; + return 3 ; } else if ( m_windowStyle &wxDOUBLE_BORDER) { - return 2 ; + return 3 ; } else if (m_windowStyle &wxSIMPLE_BORDER) { @@ -2398,7 +2351,7 @@ long wxWindowMac::MacGetBottomBorderSize( ) const } else if (m_windowStyle &wxSIMPLE_BORDER) { - return 3 ; + return 1 ; } return 0 ; }