From d15694e8cad1d44087323bd568ca33ff5b354f2c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 19 Mar 2011 08:36:23 +0000 Subject: [PATCH] going private with userpane info git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/window.h | 19 ++- src/html/htmlctrl/webkit/webkit.mm | 16 +- src/osx/bmpbuttn_osx.cpp | 4 +- src/osx/button_osx.cpp | 8 +- src/osx/carbon/combobxc.cpp | 2 +- src/osx/carbon/frame.cpp | 1 - src/osx/carbon/listctrl_mac.cpp | 4 +- src/osx/carbon/stattext.cpp | 1 + src/osx/carbon/window.cpp | 2 +- src/osx/checkbox_osx.cpp | 6 +- src/osx/checklst_osx.cpp | 5 +- src/osx/choice_osx.cpp | 6 +- src/osx/cocoa/glcanvas.mm | 4 +- src/osx/cocoa/window.mm | 8 +- src/osx/combobox_osx.cpp | 6 +- src/osx/dataview_osx.cpp | 2 +- src/osx/gauge_osx.cpp | 6 +- src/osx/iphone/glcanvas.mm | 2 +- src/osx/iphone/toolbar.mm | 2 +- src/osx/iphone/window.mm | 2 +- src/osx/listbox_osx.cpp | 3 +- src/osx/notebook_osx.cpp | 6 +- src/osx/radiobox_osx.cpp | 19 ++- src/osx/radiobut_osx.cpp | 6 +- src/osx/scrolbar_osx.cpp | 6 +- src/osx/slider_osx.cpp | 6 +- src/osx/spinbutt_osx.cpp | 5 +- src/osx/spinctrl_osx.cpp | 3 +- src/osx/srchctrl_osx.cpp | 2 +- src/osx/statbox_osx.cpp | 6 +- src/osx/statline_osx.cpp | 6 +- src/osx/stattext_osx.cpp | 6 +- src/osx/textctrl_osx.cpp | 2 +- src/osx/tglbtn_osx.cpp | 8 +- src/osx/window_osx.cpp | 256 ++++++++++++++++++----------- 35 files changed, 264 insertions(+), 182 deletions(-) diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index 41bfb61a0e..414bc6844c 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -201,9 +201,9 @@ public: bool MacIsReallyHilited() ; #if WXWIN_COMPATIBILITY_2_8 - bool MacIsUserPane() { return m_macIsUserPane; } + bool MacIsUserPane(); #endif - bool MacIsUserPane() const { return m_macIsUserPane; } + bool MacIsUserPane() const; virtual bool MacSetupCursor( const wxPoint& pt ) ; @@ -246,8 +246,18 @@ public: int& w, int& h , bool adjustForOrigin ) const ; // the 'true' OS level control for this wxWindow - wxOSXWidgetImpl* GetPeer() const { return m_peer ; } + wxOSXWidgetImpl* GetPeer() const; + + // optimization to avoid creating a user pane in wxWindow::Create if we already know + // we will replace it with our own peer + void DontCreatePeer(); + + // sets the native implementation wrapper, can replace an existing peer, use peer = NULL to + // release existing peer void SetPeer(wxOSXWidgetImpl* peer); + + // wraps the already existing peer with the wrapper + void SetWrappingPeer(wxOSXWidgetImpl* wrapper); #if wxOSX_USE_COCOA_OR_IPHONE // the NSView or NSWindow of this window: can be used for both child and @@ -289,9 +299,6 @@ protected: mutable wxRegion m_cachedClippedRegion ; mutable wxRegion m_cachedClippedClientRegion ; - // true if is is not a native control but a wxWindow control - bool m_macIsUserPane ; - // insets of the mac control from the wx top left corner wxPoint m_macTopLeftInset ; wxPoint m_macBottomRightInset ; diff --git a/src/html/htmlctrl/webkit/webkit.mm b/src/html/htmlctrl/webkit/webkit.mm index c13b969958..f0a423682f 100644 --- a/src/html/htmlctrl/webkit/webkit.mm +++ b/src/html/htmlctrl/webkit/webkit.mm @@ -406,7 +406,6 @@ bool wxWebKitCtrl::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { - m_currentURL = strURL; //m_pageTitle = _("Untitled Page"); @@ -427,6 +426,7 @@ bool wxWebKitCtrl::Create(wxWindow *parent, } */ // now create and attach WebKit view... + DontCreatePeer(); #ifdef __WXCOCOA__ wxControl::Create(parent, m_windowID, pos, sizeInstance, style , validator , name); SetSize(pos.x, pos.y, sizeInstance.x, sizeInstance.y); @@ -445,22 +445,24 @@ bool wxWebKitCtrl::Create(wxWindow *parent, if(m_parent) m_parent->CocoaAddChild(this); SetInitialFrameRect(pos,sizeInstance); #else - m_macIsUserPane = false; + DontCreatePeer(); wxControl::Create(parent, winID, pos, size, style , validator , name); #if wxOSX_USE_CARBON - SetPeer(new wxMacControl(this)); + wxMacControl* peer = new wxMacControl(this); WebInitForCarbon(); - HIWebViewCreate( GetPeer()->GetControlRefAddr() ); + HIWebViewCreate( peer->GetControlRefAddr() ); - m_webView = (WebView*) HIWebViewGetWebView( GetPeer()->GetControlRef() ); + m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() ); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 if ( UMAGetSystemVersion() >= 0x1030 ) - HIViewChangeFeatures( GetPeer()->GetControlRef() , kHIViewIsOpaque , 0 ) ; + HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ; #endif - InstallControlEventHandler( GetPeer()->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(), + InstallControlEventHandler( peer->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_webKitCtrlEventHandler); + + SetPeer(peer); #else NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; m_webView = [[WebView alloc] initWithFrame:r frameName:@"webkitFrame" groupName:@"webkitGroup"]; diff --git a/src/osx/bmpbuttn_osx.cpp b/src/osx/bmpbuttn_osx.cpp index 41693cbf6e..a2c2eadfee 100644 --- a/src/osx/bmpbuttn_osx.cpp +++ b/src/osx/bmpbuttn_osx.cpp @@ -33,8 +33,8 @@ bool wxBitmapButton::Create( wxWindow *parent, const wxValidator& validator, const wxString& name ) { - m_macIsUserPane = false; - + DontCreatePeer(); + if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style, validator, name) ) return false; diff --git a/src/osx/button_osx.cpp b/src/osx/button_osx.cpp index be20338e92..7867f9f5ae 100644 --- a/src/osx/button_osx.cpp +++ b/src/osx/button_osx.cpp @@ -56,6 +56,8 @@ bool wxButton::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { + DontCreatePeer(); + m_marginX = m_marginY = 0; @@ -81,7 +83,6 @@ bool wxButton::Create(wxWindow *parent, : labelOrig; } - m_macIsUserPane = false ; if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) return false; @@ -202,9 +203,8 @@ bool wxButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style,const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; diff --git a/src/osx/carbon/combobxc.cpp b/src/osx/carbon/combobxc.cpp index 9a132ebae7..b691300246 100644 --- a/src/osx/carbon/combobxc.cpp +++ b/src/osx/carbon/combobxc.cpp @@ -341,7 +341,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, m_text = NULL; m_choice = NULL; #if USE_HICOMBOBOX - m_macIsUserPane = false; + DontCreatePeer(); #endif if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , wxDefaultValidator, name) ) diff --git a/src/osx/carbon/frame.cpp b/src/osx/carbon/frame.cpp index 451ac4a964..e7c53a27aa 100644 --- a/src/osx/carbon/frame.cpp +++ b/src/osx/carbon/frame.cpp @@ -51,7 +51,6 @@ bool wxFrame::Create(wxWindow *parent, long style, const wxString& name) { - if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; diff --git a/src/osx/carbon/listctrl_mac.cpp b/src/osx/carbon/listctrl_mac.cpp index c9a1fab233..c37094dc70 100644 --- a/src/osx/carbon/listctrl_mac.cpp +++ b/src/osx/carbon/listctrl_mac.cpp @@ -655,8 +655,6 @@ bool wxListCtrl::Create(wxWindow *parent, && (wxSystemOptions::GetOptionInt( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL ) == 1)) || (style & wxLC_ICON) || (style & wxLC_SMALL_ICON) || (style & wxLC_LIST) ) { - m_macIsUserPane = true; - long paneStyle = style; paneStyle &= ~wxSIMPLE_BORDER; paneStyle &= ~wxDOUBLE_BORDER; @@ -674,7 +672,7 @@ bool wxListCtrl::Create(wxWindow *parent, else { - m_macIsUserPane = false; + DontCreatePeer(); if ( !wxWindow::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), name) ) return false; m_dbImpl = new wxMacDataBrowserListCtrlControl( this, pos, size, style ); diff --git a/src/osx/carbon/stattext.cpp b/src/osx/carbon/stattext.cpp index 995cc7966b..67be74dbb4 100644 --- a/src/osx/carbon/stattext.cpp +++ b/src/osx/carbon/stattext.cpp @@ -52,6 +52,7 @@ wxSize wxStaticText::DoGetBestSize() const GetPeer()->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); GetPeer()->GetBestRect( &bestsize ) ; GetPeer()->SetData( kControlStaticTextIsMultilineTag, former ); + if ( !EmptyRect( &bestsize ) ) { bounds.h = bestsize.right - bestsize.left ; diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 52e02398a9..c7289bdf46 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -836,7 +836,7 @@ wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, { OSStatus err = noErr; Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* c = new wxMacControl(wxpeer) ; + wxMacControl* c = new wxMacControl(wxpeer, false, true) ; UInt32 features = 0 | kControlSupportsEmbedding | kControlSupportsLiveFeedback diff --git a/src/osx/checkbox_osx.cpp b/src/osx/checkbox_osx.cpp index 1c4142f17d..1830c610d9 100644 --- a/src/osx/checkbox_osx.cpp +++ b/src/osx/checkbox_osx.cpp @@ -27,9 +27,9 @@ bool wxCheckBox::Create(wxWindow *parent, long style, const wxValidator& validator, const wxString& name) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); + if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) ) return false; diff --git a/src/osx/checklst_osx.cpp b/src/osx/checklst_osx.cpp index 16e0993bc4..55e3b9ce4e 100644 --- a/src/osx/checklst_osx.cpp +++ b/src/osx/checklst_osx.cpp @@ -56,9 +56,8 @@ bool wxCheckListBox::Create( long style, const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), wxT("only one of listbox selection modes can be specified") ); diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp index c0540c58a3..615b2592c5 100644 --- a/src/osx/choice_osx.cpp +++ b/src/osx/choice_osx.cpp @@ -65,9 +65,9 @@ bool wxChoice::Create(wxWindow *parent, long style, const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) ) return false; diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index abde96bf66..863bd8bf28 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -260,8 +260,8 @@ bool wxGLCanvas::Create(wxWindow *parent, if ( !m_glFormat ) return false; - // m_macIsUserPane = false ; - + // DontCreatePeer(); + if ( !wxWindow::Create(parent, id, pos, size, style, name) ) return false; diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 5326ae550e..9bbcb2146b 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -988,7 +988,7 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) if ( !DoHandleMouseEvent(event) ) { // for plain NSView mouse events would propagate to parents otherwise - if (!m_wxPeer->MacIsUserPane()) + if (!IsUserPane()) { wxOSX_EventHandlerPtr superimpl = (wxOSX_EventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; superimpl(slf, (SEL)_cmd, event); @@ -1062,7 +1062,7 @@ bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, voi bool wxWidgetCocoaImpl::acceptsFirstResponder(WXWidget slf, void *_cmd) { - if ( m_wxPeer->MacIsUserPane() ) + if ( IsUserPane() ) return m_wxPeer->AcceptsFocus(); else { @@ -2095,7 +2095,7 @@ bool wxWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event) // this will fire higher level events, like insertText, to help // us handle EVT_CHAR, etc. - if ( m_wxPeer->MacIsUserPane() && [event type] == NSKeyDown) + if ( IsUserPane() && [event type] == NSKeyDown) { if ( !result ) { @@ -2219,7 +2219,7 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX [v registerForDraggedTypes:[NSArray arrayWithObjects: NSStringPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPICTPboardType, NSPDFPboardType, nil]]; - wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); + wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v, false, true ); return c; } diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index 1d4529bbbc..1f3190f085 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -53,11 +53,11 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + DontCreatePeer(); + m_text = NULL; m_choice = NULL; - - m_macIsUserPane = false; - + if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index 9d2ea7506c..08c094bd86 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -351,7 +351,6 @@ void wxDataViewCtrl::Init() { m_CustomRendererPtr = NULL; m_Deleting = false; - m_macIsUserPane = false; m_cgContext = NULL; } @@ -363,6 +362,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { + DontCreatePeer(); if (!(wxControl::Create(parent,id,pos,size,style,validator,name))) return false; SetPeer(::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle())); diff --git a/src/osx/gauge_osx.cpp b/src/osx/gauge_osx.cpp index d8cd4a35ff..9e353f1f84 100644 --- a/src/osx/gauge_osx.cpp +++ b/src/osx/gauge_osx.cpp @@ -25,9 +25,9 @@ bool wxGauge::Create( wxWindow *parent, long style, const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) ) return false; diff --git a/src/osx/iphone/glcanvas.mm b/src/osx/iphone/glcanvas.mm index c15beb18c3..bfe0ce8bc6 100644 --- a/src/osx/iphone/glcanvas.mm +++ b/src/osx/iphone/glcanvas.mm @@ -382,7 +382,7 @@ bool wxGLCanvas::Create(wxWindow *parent, return false; */ #if USE_SEPARATE_VIEW - m_macIsUserPane = false ; + DontCreatePeer(); #endif if ( !wxWindow::Create(parent, id, pos, size, style, name) ) diff --git a/src/osx/iphone/toolbar.mm b/src/osx/iphone/toolbar.mm index 58422ca1a9..5cb6b9aefc 100644 --- a/src/osx/iphone/toolbar.mm +++ b/src/osx/iphone/toolbar.mm @@ -218,7 +218,7 @@ bool wxToolBar::Create( long style, const wxString& name ) { - m_macIsUserPane = false ; + DontCreatePeer(); if ( !wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; diff --git a/src/osx/iphone/window.mm b/src/osx/iphone/window.mm index 558e90d792..0419937f2b 100644 --- a/src/osx/iphone/window.mm +++ b/src/osx/iphone/window.mm @@ -797,7 +797,7 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX sv.clipsToBounds = YES; sv.contentMode = UIViewContentModeRedraw; sv.clearsContextBeforeDrawing = NO; - wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v ); + wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v, false, true ); return c; } diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index a784aed426..9c6830eafb 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -71,8 +71,8 @@ bool wxListBox::Create( const wxValidator& validator, const wxString& name ) { + DontCreatePeer(); m_blockEvents = false; - m_macIsUserPane = false; wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), wxT("only a single listbox selection mode can be specified") ); @@ -327,7 +327,6 @@ int wxListBox::FindString(const wxString& s, bool bCase) const void wxListBox::OnItemInserted(unsigned int WXUNUSED(pos)) { - } int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index f18f86dacf..4886a876b4 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -44,9 +44,9 @@ bool wxNotebook::Create( wxWindow *parent, const wxSize& size, long style, const wxString& name ) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); + if (! (style & wxBK_ALIGN_MASK)) style |= wxBK_TOP; diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index ae1526b0a5..1bd23582ef 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -97,15 +97,14 @@ bool wxRadioBox::Create( wxWindow *parent, int n, const wxString choices[], int majorDim, long style, const wxValidator& val, const wxString& name ) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, val, name ) ) return false; - int i; - - m_noItems = (unsigned int)n; + // during construction we must keep this at 0, otherwise GetBestSize fails + m_noItems = 0; m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; @@ -115,7 +114,7 @@ bool wxRadioBox::Create( wxWindow *parent, SetPeer(wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() )); - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) { wxRadioButton *radBtn = new wxRadioButton( this, @@ -130,7 +129,13 @@ bool wxRadioBox::Create( wxWindow *parent, // m_radioButtonCycle = radBtn->AddInCycle( m_radioButtonCycle ); } + // as all radiobuttons have been set-up, set the correct dimensions + m_noItems = (unsigned int)n; + SetMajorDim( majorDim == 0 ? n : majorDim, style ); + SetSelection( 0 ); + InvalidateBestSize(); + SetInitialSize( size ); MacPostControlCreate( pos, size ); return true; diff --git a/src/osx/radiobut_osx.cpp b/src/osx/radiobut_osx.cpp index 0b93ecd662..573ee1e62e 100644 --- a/src/osx/radiobut_osx.cpp +++ b/src/osx/radiobut_osx.cpp @@ -24,9 +24,9 @@ bool wxRadioButton::Create( wxWindow *parent, long style, const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; diff --git a/src/osx/scrolbar_osx.cpp b/src/osx/scrolbar_osx.cpp index eb324b9e7a..ca041ec530 100644 --- a/src/osx/scrolbar_osx.cpp +++ b/src/osx/scrolbar_osx.cpp @@ -34,9 +34,9 @@ bool wxScrollBar::Create( wxWindow *parent, long style, const wxValidator& validator, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; diff --git a/src/osx/slider_osx.cpp b/src/osx/slider_osx.cpp index dffe5eb2d2..b306575842 100644 --- a/src/osx/slider_osx.cpp +++ b/src/osx/slider_osx.cpp @@ -57,9 +57,9 @@ bool wxSlider::Create(wxWindow *parent, const wxSize& size, long style, const wxValidator& validator, const wxString& name) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + m_macMinimumStatic = NULL; m_macMaximumStatic = NULL; m_macValueStatic = NULL; diff --git a/src/osx/spinbutt_osx.cpp b/src/osx/spinbutt_osx.cpp index 92bc682b9a..3d6245c007 100644 --- a/src/osx/spinbutt_osx.cpp +++ b/src/osx/spinbutt_osx.cpp @@ -25,9 +25,8 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); if ( !wxSpinButtonBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; diff --git a/src/osx/spinctrl_osx.cpp b/src/osx/spinctrl_osx.cpp index 3c8a7e42a7..27bb861628 100644 --- a/src/osx/spinctrl_osx.cpp +++ b/src/osx/spinctrl_osx.cpp @@ -229,7 +229,8 @@ bool wxSpinCtrl::Create(wxWindow *parent, int initial, const wxString& name) { - m_macIsUserPane = true; + DontCreatePeer(); + if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) { diff --git a/src/osx/srchctrl_osx.cpp b/src/osx/srchctrl_osx.cpp index f62ecd530e..9a300ff33e 100644 --- a/src/osx/srchctrl_osx.cpp +++ b/src/osx/srchctrl_osx.cpp @@ -168,7 +168,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - m_macIsUserPane = false ; + DontCreatePeer(); m_editable = true ; if ( ! (style & wxNO_BORDER) ) diff --git a/src/osx/statbox_osx.cpp b/src/osx/statbox_osx.cpp index 2db314f9fc..0d9c91c629 100644 --- a/src/osx/statbox_osx.cpp +++ b/src/osx/statbox_osx.cpp @@ -23,9 +23,9 @@ bool wxStaticBox::Create( wxWindow *parent, const wxSize& size, long style, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; diff --git a/src/osx/statline_osx.cpp b/src/osx/statline_osx.cpp index 0e4515c674..6d53cd7752 100644 --- a/src/osx/statline_osx.cpp +++ b/src/osx/statline_osx.cpp @@ -47,9 +47,9 @@ bool wxStaticLine::Create( wxWindow *parent, const wxSize &size, long style, const wxString &name) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); + if ( !wxStaticLineBase::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; diff --git a/src/osx/stattext_osx.cpp b/src/osx/stattext_osx.cpp index 3f75f62491..ad7b76bc7f 100644 --- a/src/osx/stattext_osx.cpp +++ b/src/osx/stattext_osx.cpp @@ -35,9 +35,9 @@ bool wxStaticText::Create( wxWindow *parent, const wxSize& size, long style, const wxString& name ) -{ - m_macIsUserPane = false; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 9baf749989..0af4f04bcc 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -95,7 +95,7 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxValidator& validator, const wxString& name ) { - m_macIsUserPane = false ; + DontCreatePeer(); m_editable = true ; if ( ! (style & wxNO_BORDER) ) diff --git a/src/osx/tglbtn_osx.cpp b/src/osx/tglbtn_osx.cpp index cc70d3aaec..c381cd4eda 100644 --- a/src/osx/tglbtn_osx.cpp +++ b/src/osx/tglbtn_osx.cpp @@ -47,8 +47,8 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - m_macIsUserPane = FALSE ; - + DontCreatePeer(); + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; @@ -111,8 +111,8 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - m_macIsUserPane = FALSE ; - + DontCreatePeer(); + m_bitmap = label; m_marginX = diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 3cec4eb59b..f2f2539c3a 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -87,6 +87,8 @@ END_EVENT_TABLE() #define wxMAC_DEBUG_REDRAW 0 #endif +wxWidgetImplType* kOSXNoWidgetImpl = (wxWidgetImplType*) -1L; + // =========================================================================== // implementation // =========================================================================== @@ -202,7 +204,6 @@ void wxWindowMac::Init() m_vScrollBarAlwaysShown = false; m_growBox = NULL ; - m_macIsUserPane = true; m_clipChildren = false ; m_cachedClippedRectValid = false ; m_isNativeWindowWrapper = false; @@ -258,21 +259,88 @@ wxWindowMac::~wxWindowMac() wxDELETE(m_dropTarget); #endif - delete m_peer ; + delete GetPeer() ; } WXWidget wxWindowMac::GetHandle() const { - if ( m_peer ) - return (WXWidget) m_peer->GetWXWidget() ; + if ( GetPeer() ) + return (WXWidget) GetPeer()->GetWXWidget() ; return NULL; } +wxOSXWidgetImpl* wxWindowMac::GetPeer() const +{ + return m_peer == kOSXNoWidgetImpl ? NULL : m_peer ; +} + +void wxWindowMac::DontCreatePeer() +{ + m_peer = kOSXNoWidgetImpl; +} + +void wxWindowMac::SetWrappingPeer(wxOSXWidgetImpl* wrapper) +{ + wxOSXWidgetImpl* inner = GetPeer(); + wxASSERT_MSG( inner != NULL && inner->IsOk(), "missing or incomplete inner peer" ); + wxASSERT_MSG( wrapper != NULL && wrapper->IsOk(), "missing or incomplete wrapper" ); + + if ( !(inner != NULL && inner->IsOk() && wrapper != NULL && wrapper->IsOk()) ) + return; + + inner->RemoveFromParent(); + wrapper->InstallEventHandler(); + wrapper->Embed(inner); + m_peer = wrapper; +} + void wxWindowMac::SetPeer(wxOSXWidgetImpl* peer) { - wxDELETE(m_peer); - // todo event check handlers + if ( GetPeer() ) + { + GetPeer()->RemoveFromParent(); + wxDELETE(m_peer); + } + m_peer = peer; + + if ( GetPeer() && !GetPeer()->IsRootControl()) + { + wxASSERT_MSG( GetPeer()->IsOk() , wxT("The native control must exist already") ) ; + + if (!GetParent()->GetChildren().Find((wxWindow*)this)) + GetParent()->AddChild( this ); + + GetPeer()->InstallEventHandler(); + GetPeer()->Embed(GetParent()->GetPeer()); + + GetParent()->MacChildAdded() ; + + // adjust font, controlsize etc + DoSetWindowVariant( m_windowVariant ) ; + + GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; + + // for controls we want to use best size for wxDefaultSize params ) + if ( !GetPeer()->IsUserPane() ) + SetInitialSize(GetMinSize()); + + SetCursor( *wxSTANDARD_CURSOR ) ; + } +} + +#if WXWIN_COMPATIBILITY_2_8 + +bool wxWindowMac::MacIsUserPane() +{ + return GetPeer() == NULL || GetPeer()->IsUserPane(); +} + +#endif + +bool wxWindowMac::MacIsUserPane() const +{ + return GetPeer() == NULL || GetPeer()->IsUserPane(); } // --------------------------------------------------------------------------- @@ -311,9 +379,9 @@ bool wxWindowMac::Create(wxWindowMac *parent, m_windowVariant = parent->GetWindowVariant() ; - if ( m_macIsUserPane ) + if ( m_peer != kOSXNoWidgetImpl ) { - m_peer = wxWidgetImpl::CreateUserPane( this, parent, id, pos, size , style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateUserPane( this, parent, id, pos, size , style, GetExtraStyle() )); MacPostControlCreate(pos, size) ; } @@ -350,39 +418,43 @@ void wxWindowMac::MacChildAdded() void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSize& size) { - wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid mac control") ) ; + // todo remove if refactoring works correctly +#if 0 + wxASSERT_MSG( GetPeer() != NULL && GetPeer()->IsOk() , wxT("No valid mac control") ) ; - GetParent()->AddChild( this ); + if (!GetParent()->GetChildren().Find((wxWindow*)this)) + GetParent()->AddChild( this ); - m_peer->InstallEventHandler(); - m_peer->Embed(GetParent()->GetPeer()); + GetPeer()->InstallEventHandler(); + GetPeer()->Embed(GetParent()->GetPeer()); GetParent()->MacChildAdded() ; // adjust font, controlsize etc DoSetWindowVariant( m_windowVariant ) ; - m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; + GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; // for controls we want to use best size for wxDefaultSize params ) - if ( !m_macIsUserPane ) + if ( !GetPeer()->IsUserPane() ) SetInitialSize(size); SetCursor( *wxSTANDARD_CURSOR ) ; +#endif } void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) { // Don't assert, in case we set the window variant before // the window is created - // wxASSERT( m_peer->Ok() ) ; + // wxASSERT( GetPeer()->Ok() ) ; m_windowVariant = variant ; - if (m_peer == NULL || !m_peer->IsOk()) + if (GetPeer() == NULL || !GetPeer()->IsOk()) return; - m_peer->SetControlSize( variant ); + GetPeer()->SetControlSize( variant ); #if wxOSX_USE_CARBON ControlSize size ; @@ -413,7 +485,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) wxFAIL_MSG(wxT("unexpected window variant")); break ; } - m_peer->SetData(kControlEntireControl, kControlSizeTag, &size ) ; + GetPeer()->SetData(kControlEntireControl, kControlSizeTag, &size ) ; #endif @@ -447,8 +519,8 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) void wxWindowMac::MacUpdateControlFont() { - if ( m_peer ) - m_peer->SetFont( GetFont() , GetForegroundColour() , GetWindowStyle() ) ; + if ( GetPeer() ) + GetPeer()->SetFont( GetFont() , GetForegroundColour() , GetWindowStyle() ) ; // do not trigger refreshes upon invisible and possible partly created objects if ( IsShownOnScreen() ) @@ -479,8 +551,8 @@ bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style) if ( !wxWindowBase::SetBackgroundStyle(style) ) return false; - if ( m_peer ) - m_peer->SetBackgroundStyle(style); + if ( GetPeer() ) + GetPeer()->SetBackgroundStyle(style); return true; } @@ -497,8 +569,8 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col ) if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol ) return false ; - if ( m_peer ) - m_peer->SetBackgroundColour( col ) ; + if ( GetPeer() ) + GetPeer()->SetBackgroundColour( col ) ; return true ; } @@ -526,13 +598,13 @@ void wxWindowMac::SetFocus() if ( former == this ) return ; - m_peer->SetFocus() ; + GetPeer()->SetFocus() ; } void wxWindowMac::DoCaptureMouse() { wxApp::s_captureWindow = (wxWindow*) this ; - m_peer->CaptureMouse() ; + GetPeer()->CaptureMouse() ; } wxWindow * wxWindowBase::GetCapture() @@ -544,7 +616,7 @@ void wxWindowMac::DoReleaseMouse() { wxApp::s_captureWindow = NULL ; - m_peer->ReleaseMouse() ; + GetPeer()->ReleaseMouse() ; } #if wxUSE_DRAG_AND_DROP @@ -605,7 +677,7 @@ bool wxWindowMac::MacGetBoundsForControl( void wxWindowMac::DoGetSize(int *x, int *y) const { int width, height; - m_peer->GetSize( width, height ); + GetPeer()->GetSize( width, height ); if (x) *x = width + MacGetLeftBorderSize() + MacGetRightBorderSize() ; @@ -618,7 +690,7 @@ void wxWindowMac::DoGetPosition(int *x, int *y) const { int x1, y1; - m_peer->GetPosition( x1, y1 ) ; + GetPeer()->GetPosition( x1, y1 ) ; // get the wx window position from the native one x1 -= MacGetLeftBorderSize() ; @@ -703,7 +775,7 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const { pt.x -= MacGetLeftBorderSize() ; pt.y -= MacGetTopBorderSize() ; - wxWidgetImpl::Convert( &pt , m_peer , top->m_peer ) ; + wxWidgetImpl::Convert( &pt , GetPeer() , top->GetPeer() ) ; } } @@ -727,7 +799,7 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const wxNonOwnedWindow* top = MacGetTopLevelWindow(); if (top) { - wxWidgetImpl::Convert( &pt , top->m_peer , m_peer ) ; + wxWidgetImpl::Convert( &pt , top->GetPeer() , GetPeer() ) ; pt.x += MacGetLeftBorderSize() ; pt.y += MacGetTopBorderSize() ; } @@ -747,8 +819,8 @@ wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const int left, top; int outerwidth, outerheight; - m_peer->GetContentArea( left, top, innerwidth, innerheight ); - m_peer->GetSize( outerwidth, outerheight ); + GetPeer()->GetContentArea( left, top, innerwidth, innerheight ); + GetPeer()->GetSize( outerwidth, outerheight ); sizeTotal.x += outerwidth-innerwidth; sizeTotal.y += outerheight-innerheight; @@ -766,7 +838,7 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const int left, top; - m_peer->GetContentArea( left, top, ww, hh ); + GetPeer()->GetContentArea( left, top, ww, hh ); #if wxUSE_SCROLLBAR if (m_hScrollBar && m_hScrollBar->IsShown() ) hh -= m_hScrollBar->GetSize().y ; @@ -844,15 +916,15 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip) if ( m_tooltip ) m_tooltip->SetWindow(this); - if (m_peer) - m_peer->SetToolTip(tooltip); + if (GetPeer()) + GetPeer()->SetToolTip(tooltip); } #endif void wxWindowMac::MacInvalidateBorders() { - if ( m_peer == NULL ) + if ( GetPeer() == NULL ) return ; bool vis = IsShownOnScreen() ; @@ -861,7 +933,7 @@ void wxWindowMac::MacInvalidateBorders() int outerBorder = MacGetLeftBorderSize() ; - if ( m_peer->NeedsFocusRect() ) + if ( GetPeer()->NeedsFocusRect() ) outerBorder += 4 ; if ( outerBorder == 0 ) @@ -871,8 +943,8 @@ void wxWindowMac::MacInvalidateBorders() int tx,ty,tw,th; - m_peer->GetSize( tw, th ); - m_peer->GetPosition( tx, ty ); + GetPeer()->GetSize( tw, th ); + GetPeer()->GetPosition( tx, ty ); wxRect leftupdate( tx-outerBorder,ty,outerBorder,th ); wxRect rightupdate( tx+tw, ty, outerBorder, th ); @@ -880,10 +952,10 @@ void wxWindowMac::MacInvalidateBorders() wxRect bottomupdate( tx-outerBorder, ty + th, tw + 2 * outerBorder, outerBorder ); if (GetParent()) { - GetParent()->m_peer->SetNeedsDisplay(&leftupdate); - GetParent()->m_peer->SetNeedsDisplay(&rightupdate); - GetParent()->m_peer->SetNeedsDisplay(&topupdate); - GetParent()->m_peer->SetNeedsDisplay(&bottomupdate); + GetParent()->GetPeer()->SetNeedsDisplay(&leftupdate); + GetParent()->GetPeer()->SetNeedsDisplay(&rightupdate); + GetParent()->GetPeer()->SetNeedsDisplay(&topupdate); + GetParent()->GetPeer()->SetNeedsDisplay(&bottomupdate); } } @@ -946,7 +1018,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) m_cachedClippedRectValid = false ; - m_peer->Move( bounds.x, bounds.y, bounds.width, bounds.height); + GetPeer()->Move( bounds.x, bounds.y, bounds.width, bounds.height); wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified @@ -974,7 +1046,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) wxSize wxWindowMac::DoGetBestSize() const { - if ( m_macIsUserPane || IsTopLevel() ) + if ( GetPeer() == NULL || GetPeer()->IsUserPane() || IsTopLevel() ) { return wxWindowBase::DoGetBestSize() ; } @@ -982,7 +1054,7 @@ wxSize wxWindowMac::DoGetBestSize() const { wxRect r ; - m_peer->GetBestRect(&r); + GetPeer()->GetBestRect(&r); if ( r.GetWidth() == 0 && r.GetHeight() == 0 ) { @@ -1103,7 +1175,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) wxPoint wxWindowMac::GetClientAreaOrigin() const { int left,top,width,height; - m_peer->GetContentArea( left , top , width , height); + GetPeer()->GetContentArea( left , top , width , height); return wxPoint( left + MacGetLeftBorderSize() , top + MacGetTopBorderSize() ); } @@ -1124,7 +1196,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) float wxWindowMac::GetContentScaleFactor() const { - return m_peer->GetContentScaleFactor(); + return GetPeer()->GetContentScaleFactor(); } void wxWindowMac::SetLabel(const wxString& title) @@ -1136,8 +1208,8 @@ void wxWindowMac::SetLabel(const wxString& title) InvalidateBestSize(); - if ( m_peer && m_peer->IsOk() ) - m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; + if ( GetPeer() && GetPeer()->IsOk() ) + GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; // do not trigger refreshes upon invisible and possible partly created objects if ( IsShownOnScreen() ) @@ -1154,8 +1226,8 @@ bool wxWindowMac::Show(bool show) if ( !wxWindowBase::Show(show) ) return false; - if ( m_peer ) - m_peer->SetVisibility( show ) ; + if ( GetPeer() ) + GetPeer()->SetVisibility( show ) ; #ifdef __WXOSX_IPHONE__ // only when there's no native event support @@ -1176,7 +1248,7 @@ bool wxWindowMac::OSXShowWithEffect(bool show, unsigned timeout) { if ( effect == wxSHOW_EFFECT_NONE || - !m_peer || !m_peer->ShowWithEffect(show, effect, timeout) ) + !GetPeer() || !GetPeer()->ShowWithEffect(show, effect, timeout) ) return Show(show); return true; @@ -1184,7 +1256,7 @@ bool wxWindowMac::OSXShowWithEffect(bool show, void wxWindowMac::DoEnable(bool enable) { - m_peer->Enable( enable ) ; + GetPeer()->Enable( enable ) ; MacInvalidateBorders(); } @@ -1202,7 +1274,7 @@ void wxWindowMac::MacHiliteChanged() void wxWindowMac::MacEnabledStateChanged() { - OnEnabled( m_peer->IsEnabled() ); + OnEnabled( GetPeer()->IsEnabled() ); } // @@ -1211,13 +1283,13 @@ void wxWindowMac::MacEnabledStateChanged() bool wxWindowMac::MacIsReallyEnabled() { - return m_peer->IsEnabled() ; + return GetPeer()->IsEnabled() ; } bool wxWindowMac::MacIsReallyHilited() { #if wxOSX_USE_CARBON - return m_peer->IsActive(); + return GetPeer()->IsActive(); #else return true; // TODO #endif @@ -1278,30 +1350,30 @@ void wxWindowMac::DoGetTextExtent(const wxString& str, void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect) { - if ( m_peer == NULL ) + if ( GetPeer() == NULL ) return ; if ( !IsShownOnScreen() ) return ; - m_peer->SetNeedsDisplay( rect ) ; + GetPeer()->SetNeedsDisplay( rect ) ; } void wxWindowMac::DoFreeze() { #if wxOSX_USE_CARBON - if ( m_peer && m_peer->IsOk() ) - m_peer->SetDrawingEnabled( false ) ; + if ( GetPeer() && GetPeer()->IsOk() ) + GetPeer()->SetDrawingEnabled( false ) ; #endif } void wxWindowMac::DoThaw() { #if wxOSX_USE_CARBON - if ( m_peer && m_peer->IsOk() ) + if ( GetPeer() && GetPeer()->IsOk() ) { - m_peer->SetDrawingEnabled( true ) ; - m_peer->InvalidateWithChildren() ; + GetPeer()->SetDrawingEnabled( true ) ; + GetPeer()->InvalidateWithChildren() ; } #endif } @@ -1450,8 +1522,8 @@ void wxWindowMac::MacPaintGrowBox() int tx,ty,tw,th; - m_peer->GetSize( tw, th ); - m_peer->GetPosition( tx, ty ); + GetPeer()->GetSize( tw, th ); + GetPeer()->GetPosition( tx, ty ); Rect rect = { ty,tx, ty+th, tx+tw }; @@ -1489,13 +1561,13 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right if ( IsTopLevel() ) return ; - bool hasFocus = m_peer->NeedsFocusRect() && HasFocus(); + bool hasFocus = GetPeer()->NeedsFocusRect() && HasFocus(); // back to the surrounding frame rectangle int tx,ty,tw,th; - m_peer->GetSize( tw, th ); - m_peer->GetPosition( tx, ty ); + GetPeer()->GetSize( tw, th ); + GetPeer()->GetPosition( tx, ty ); Rect rect = { ty,tx, ty+th, tx+tw }; @@ -1510,7 +1582,7 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right CGContextRef cgContext = (CGContextRef) GetParent()->MacGetCGContextRef() ; wxASSERT( cgContext ) ; - if ( m_peer->NeedsFrame() ) + if ( GetPeer()->NeedsFrame() ) { HIThemeFrameDrawInfo info ; memset( &info, 0 , sizeof(info) ) ; @@ -1626,7 +1698,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) // as the native control might be not a 0/0 wx window coordinates, we have to offset scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ; - m_peer->ScrollRect( &scrollrect, dx, dy ); + GetPeer()->ScrollRect( &scrollrect, dx, dy ); } wxWindowMac *child; @@ -1698,13 +1770,13 @@ wxWindow *wxWindowBase::DoFindFocus() // Raise the window to the top of the Z order void wxWindowMac::Raise() { - m_peer->Raise(); + GetPeer()->Raise(); } // Lower the window to the bottom of the Z order void wxWindowMac::Lower() { - m_peer->Lower(); + GetPeer()->Lower(); } // static wxWindow *gs_lastWhich = NULL; @@ -1845,8 +1917,8 @@ void wxWindowMac::MacUpdateClippedRects() const int tx,ty,tw,th; - m_peer->GetSize( tw, th ); - m_peer->GetPosition( tx, ty ); + GetPeer()->GetSize( tw, th ); + GetPeer()->GetPosition( tx, ty ); Rect r = { ty,tx, ty+th, tx+tw }; @@ -2227,10 +2299,10 @@ void wxWindowMac::MacRepositionScrollBars() bool wxWindowMac::AcceptsFocus() const { - if ( MacIsUserPane() ) + if ( GetPeer() == NULL || GetPeer()->IsUserPane() ) return wxWindowBase::AcceptsFocus(); else - return m_peer->CanFocus(); + return GetPeer()->CanFocus(); } void wxWindowMac::MacSuperChangedPosition() @@ -2272,7 +2344,7 @@ long wxWindowMac::MacGetWXBorderSize() const SInt32 border = 0 ; - if ( m_peer && m_peer->NeedsFrame() ) + if ( GetPeer() && GetPeer()->NeedsFrame() ) { if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER)) { @@ -2304,10 +2376,10 @@ long wxWindowMac::MacGetLeftBorderSize() const // the wx borders are all symmetric in mac themes long border = MacGetWXBorderSize() ; - if ( m_peer ) + if ( GetPeer() ) { int left, top, right, bottom; - m_peer->GetLayoutInset( left, top, right, bottom ); + GetPeer()->GetLayoutInset( left, top, right, bottom ); border -= left; } @@ -2320,10 +2392,10 @@ long wxWindowMac::MacGetRightBorderSize() const // the wx borders are all symmetric in mac themes long border = MacGetWXBorderSize() ; - if ( m_peer ) + if ( GetPeer() ) { int left, top, right, bottom; - m_peer->GetLayoutInset( left, top, right, bottom ); + GetPeer()->GetLayoutInset( left, top, right, bottom ); border -= right; } @@ -2335,10 +2407,10 @@ long wxWindowMac::MacGetTopBorderSize() const // the wx borders are all symmetric in mac themes long border = MacGetWXBorderSize() ; - if ( m_peer ) + if ( GetPeer() ) { int left, top, right, bottom; - m_peer->GetLayoutInset( left, top, right, bottom ); + GetPeer()->GetLayoutInset( left, top, right, bottom ); border -= top; } @@ -2350,10 +2422,10 @@ long wxWindowMac::MacGetBottomBorderSize() const // the wx borders are all symmetric in mac themes long border = MacGetWXBorderSize() ; - if ( m_peer ) + if ( GetPeer() ) { int left, top, right, bottom; - m_peer->GetLayoutInset( left, top, right, bottom ); + GetPeer()->GetLayoutInset( left, top, right, bottom ); border -= bottom; } @@ -2448,8 +2520,8 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase) if ( !wxWindowBase::Reparent(newParent) ) return false; - m_peer->RemoveFromParent(); - m_peer->Embed( GetParent()->GetPeer() ); + GetPeer()->RemoveFromParent(); + GetPeer()->Embed( GetParent()->GetPeer() ); MacChildAdded(); return true; @@ -2480,9 +2552,9 @@ wxByte wxWindowMac::GetTransparent() const bool wxWindowMac::IsShownOnScreen() const { - if ( m_peer && m_peer->IsOk() ) + if ( GetPeer() && GetPeer()->IsOk() ) { - bool peerVis = m_peer->IsVisible(); + bool peerVis = GetPeer()->IsVisible(); bool wxVis = wxWindowBase::IsShownOnScreen(); if( peerVis != wxVis ) { @@ -2496,7 +2568,7 @@ bool wxWindowMac::IsShownOnScreen() const return wxVis; } - return m_peer->IsVisible(); + return GetPeer()->IsVisible(); } return wxWindowBase::IsShownOnScreen(); } -- 2.45.2