X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/82f8ea8547dca786d909485596215b7542931288..fc684792c6b050fbfeabbea92e302bc3469d7489:/src/osx/window_osx.cpp diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 89afdc7171..ec1375142e 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: window.cpp 54981 2008-08-05 17:52:02Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -100,7 +100,7 @@ class WXDLLIMPEXP_CORE wxBlindPlateWindow : public wxWindow { public: wxBlindPlateWindow() { Init(); } - + // Old-style constructor (no default values for coordinates to avoid // ambiguity with the new one) wxBlindPlateWindow(wxWindow *parent, @@ -109,10 +109,10 @@ public: const wxString& name = wxPanelNameStr) { Init(); - + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); } - + // Constructor wxBlindPlateWindow(wxWindow *parent, wxWindowID winid = wxID_ANY, @@ -122,10 +122,10 @@ public: const wxString& name = wxPanelNameStr) { Init(); - + Create(parent, winid, pos, size, style, name); } - + // Pseudo ctor bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, @@ -136,24 +136,25 @@ public: { if ( !wxWindow::Create(parent, winid, pos, size, style, name) ) return false; - + // so that non-solid background renders correctly under GTK+: SetThemeEnabled(true); + return true; } - + virtual ~wxBlindPlateWindow(); - + virtual bool AcceptsFocus() const { return false; } - + protected: // common part of all ctors void Init() { } - + DECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow) DECLARE_EVENT_TABLE() }; @@ -206,6 +207,7 @@ void wxWindowMac::Init() m_macIsUserPane = true; m_clipChildren = false ; m_cachedClippedRectValid = false ; + m_isNativeWindowWrapper = false; } wxWindowMac::~wxWindowMac() @@ -255,11 +257,7 @@ wxWindowMac::~wxWindowMac() // delete our drop target if we've got one #if wxUSE_DRAG_AND_DROP - if ( m_dropTarget != NULL ) - { - delete m_dropTarget; - m_dropTarget = NULL; - } + wxDELETE(m_dropTarget); #endif delete m_peer ; @@ -413,7 +411,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) m_peer->SetData(kControlEntireControl, kControlSizeTag, &size ) ; #endif - + switch ( variant ) { case wxWINDOW_VARIANT_NORMAL : @@ -471,6 +469,16 @@ bool wxWindowMac::SetForegroundColour(const wxColour& col ) return retval; } +bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style) +{ + if ( !wxWindowBase::SetBackgroundStyle(style) ) + return false; + + if ( m_peer ) + m_peer->SetBackgroundStyle(style); + return true; +} + bool wxWindowMac::SetBackgroundColour(const wxColour& col ) { if (m_growBox) @@ -797,7 +805,6 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) { #ifndef __WXUNIVERSAL__ - menu->SetInvokingWindow((wxWindow*)this); menu->UpdateUI(); if ( x == wxDefaultCoord && y == wxDefaultCoord ) @@ -811,7 +818,6 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) ClientToScreen( &x , &y ) ; } menu->GetPeer()->PopUp(this, x, y); - menu->SetInvokingWindow( NULL ); return true; #else // actually this shouldn't be called, because universal is having its own implementation @@ -832,7 +838,7 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip) if ( m_tooltip ) m_tooltip->SetWindow(this); - + if (m_peer) m_peer->SetToolTip(tooltip); } @@ -1142,16 +1148,16 @@ bool wxWindowMac::Show(bool show) m_peer->SetVisibility( show ) ; #ifdef __WXOSX_IPHONE__ - // only when there's no native event support + // only when there's no native event support if ( !IsTopLevel() ) #endif { wxShowEvent eventShow(GetId(), show); eventShow.SetEventObject(this); - + HandleWindowEvent(eventShow); } - + return true; } @@ -1579,6 +1585,12 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumb, int range, bool refresh) { #if wxUSE_SCROLLBAR + // Updating scrollbars when window is being deleted is useless and + // currently results in asserts in client-to-screen coordinates conversion + // code which is used by DoUpdateScrollbarVisibility() so just skip it. + if ( m_isBeingDeleted ) + return; + if ( orient == wxHORIZONTAL && m_hScrollBar ) m_hScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh); else if ( orient == wxVERTICAL && m_vScrollBar ) @@ -1617,7 +1629,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) if (child->IsTopLevel()) continue; - + if ( !IsClientAreaChild(child) ) continue; @@ -2251,7 +2263,7 @@ void wxWindowMac::MacTopLevelWindowChangedPosition() } } -long wxWindowMac::MacGetLeftBorderSize() const +long wxWindowMac::MacGetWXBorderSize() const { if ( IsTopLevel() ) return 0 ; @@ -2285,22 +2297,65 @@ long wxWindowMac::MacGetLeftBorderSize() const return border ; } +long wxWindowMac::MacGetLeftBorderSize() const +{ + // the wx borders are all symmetric in mac themes + long border = MacGetWXBorderSize() ; + + if ( m_peer ) + { + int left, top, right, bottom; + m_peer->GetLayoutInset( left, top, right, bottom ); + border -= left; + } + + return border; +} + + long wxWindowMac::MacGetRightBorderSize() const { - // they are all symmetric in mac themes - return MacGetLeftBorderSize() ; + // the wx borders are all symmetric in mac themes + long border = MacGetWXBorderSize() ; + + if ( m_peer ) + { + int left, top, right, bottom; + m_peer->GetLayoutInset( left, top, right, bottom ); + border -= right; + } + + return border; } long wxWindowMac::MacGetTopBorderSize() const { - // they are all symmetric in mac themes - return MacGetLeftBorderSize() ; + // the wx borders are all symmetric in mac themes + long border = MacGetWXBorderSize() ; + + if ( m_peer ) + { + int left, top, right, bottom; + m_peer->GetLayoutInset( left, top, right, bottom ); + border -= top; + } + + return border; } long wxWindowMac::MacGetBottomBorderSize() const { - // they are all symmetric in mac themes - return MacGetLeftBorderSize() ; + // the wx borders are all symmetric in mac themes + long border = MacGetWXBorderSize() ; + + if ( m_peer ) + { + int left, top, right, bottom; + m_peer->GetLayoutInset( left, top, right, bottom ); + border -= bottom; + } + + return border; } long wxWindowMac::MacRemoveBordersFromStyle( long style )