From 22756322824e8f377b792897209d052ca9281534 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 18 Mar 2011 14:20:12 +0000 Subject: [PATCH] going private for m_peer to give a foundation for better encapsulation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/window.h | 3 ++- src/html/htmlctrl/webkit/webkit.mm | 18 +++++++++--------- src/osx/bmpbuttn_osx.cpp | 2 +- src/osx/button_osx.cpp | 24 ++++++++++++------------ src/osx/carbon/button.cpp | 4 ++-- src/osx/carbon/control.cpp | 4 ++-- src/osx/carbon/listbox.cpp | 4 ++-- src/osx/carbon/listctrl_mac.cpp | 4 ++-- src/osx/carbon/notebmac.cpp | 18 +++++++++--------- src/osx/carbon/stattext.cpp | 10 +++++----- src/osx/carbon/toolbar.cpp | 6 +++--- src/osx/checkbox_osx.cpp | 8 ++++---- src/osx/choice_osx.cpp | 12 ++++++------ src/osx/cocoa/button.mm | 2 +- src/osx/cocoa/notebook.mm | 2 +- src/osx/cocoa/toolbar.mm | 6 +++--- src/osx/combobox_osx.cpp | 6 +++--- src/osx/dataview_osx.cpp | 2 +- src/osx/gauge_osx.cpp | 12 ++++++------ src/osx/listbox_osx.cpp | 4 ++-- src/osx/menu_osx.cpp | 6 +++--- src/osx/menuitem_osx.cpp | 10 +++++----- src/osx/nonownedwnd_osx.cpp | 8 ++++---- src/osx/notebook_osx.cpp | 30 +++++++++++++++--------------- src/osx/radiobox_osx.cpp | 2 +- src/osx/radiobut_osx.cpp | 10 +++++----- src/osx/scrolbar_osx.cpp | 16 ++++++++-------- src/osx/slider_osx.cpp | 14 +++++++------- src/osx/spinbutt_osx.cpp | 14 +++++++------- src/osx/srchctrl_osx.cpp | 4 ++-- src/osx/statbox_osx.cpp | 2 +- src/osx/statline_osx.cpp | 2 +- src/osx/stattext_osx.cpp | 6 +++--- src/osx/textctrl_osx.cpp | 2 +- src/osx/tglbtn_osx.cpp | 12 ++++++------ src/osx/window_osx.cpp | 7 +++++++ 36 files changed, 152 insertions(+), 144 deletions(-) diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index 184e135910..41bfb61a0e 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -247,6 +247,7 @@ public: // the 'true' OS level control for this wxWindow wxOSXWidgetImpl* GetPeer() const { return m_peer ; } + void SetPeer(wxOSXWidgetImpl* peer); #if wxOSX_USE_COCOA_OR_IPHONE // the NSView or NSWindow of this window: can be used for both child and @@ -274,7 +275,6 @@ protected: wxList m_subControls; // the peer object, allowing for cleaner API support - wxOSXWidgetImpl * m_peer ; void * m_cgContextRef ; @@ -365,6 +365,7 @@ protected: unsigned timeout); private: + wxOSXWidgetImpl * m_peer ; // common part of all ctors void Init(); diff --git a/src/html/htmlctrl/webkit/webkit.mm b/src/html/htmlctrl/webkit/webkit.mm index 5a3913d084..c13b969958 100644 --- a/src/html/htmlctrl/webkit/webkit.mm +++ b/src/html/htmlctrl/webkit/webkit.mm @@ -448,28 +448,28 @@ bool wxWebKitCtrl::Create(wxWindow *parent, m_macIsUserPane = false; wxControl::Create(parent, winID, pos, size, style , validator , name); #if wxOSX_USE_CARBON - m_peer = new wxMacControl(this); + SetPeer(new wxMacControl(this)); WebInitForCarbon(); - HIWebViewCreate( m_peer->GetControlRefAddr() ); + HIWebViewCreate( GetPeer()->GetControlRefAddr() ); - m_webView = (WebView*) HIWebViewGetWebView( m_peer->GetControlRef() ); + m_webView = (WebView*) HIWebViewGetWebView( GetPeer()->GetControlRef() ); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 if ( UMAGetSystemVersion() >= 0x1030 ) - HIViewChangeFeatures( m_peer->GetControlRef() , kHIViewIsOpaque , 0 ) ; + HIViewChangeFeatures( GetPeer()->GetControlRef() , kHIViewIsOpaque , 0 ) ; #endif - InstallControlEventHandler( m_peer->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(), + InstallControlEventHandler( GetPeer()->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_webKitCtrlEventHandler); #else NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; m_webView = [[WebView alloc] initWithFrame:r frameName:@"webkitFrame" groupName:@"webkitGroup"]; - m_peer = new wxWidgetCocoaImpl( this, m_webView ); + SetPeer(new wxWidgetCocoaImpl( this, m_webView )); #endif MacPostControlCreate(pos, size); #if wxOSX_USE_CARBON - HIViewSetVisible( m_peer->GetControlRef(), true ); + HIViewSetVisible( GetPeer()->GetControlRef(), true ); #endif [m_webView setHidden:false]; @@ -742,7 +742,7 @@ void wxWebKitCtrl::OnSize(wxSizeEvent &event){ // and this tripped me up at first. But in fact, what we want is the root view, because we need to // make the y origin relative to the very top of the window, not its contents, since we later flip // the y coordinate for Cocoa. - HIViewConvertRect (&rect, m_peer->GetControlRef(), + HIViewConvertRect (&rect, GetPeer()->GetControlRef(), HIViewGetRoot( (WindowRef) MacGetTopLevelWindowRef() ) ); x = (int)rect.origin.x; @@ -773,7 +773,7 @@ void wxWebKitCtrl::OnSize(wxSizeEvent &event){ void wxWebKitCtrl::MacVisibilityChanged(){ #if defined(__WXMAC__) && wxOSX_USE_CARBON - bool isHidden = !IsControlVisible( m_peer->GetControlRef()); + bool isHidden = !IsControlVisible( GetPeer()->GetControlRef()); if (!isHidden) [(WebView*)m_webView display]; diff --git a/src/osx/bmpbuttn_osx.cpp b/src/osx/bmpbuttn_osx.cpp index 4e872a906e..41693cbf6e 100644 --- a/src/osx/bmpbuttn_osx.cpp +++ b/src/osx/bmpbuttn_osx.cpp @@ -52,7 +52,7 @@ bool wxBitmapButton::Create( wxWindow *parent, m_bitmaps[State_Normal] = bitmap; - m_peer = wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); diff --git a/src/osx/button_osx.cpp b/src/osx/button_osx.cpp index 358fffffd3..be20338e92 100644 --- a/src/osx/button_osx.cpp +++ b/src/osx/button_osx.cpp @@ -89,7 +89,7 @@ bool wxButton::Create(wxWindow *parent, m_labelOrig = m_label = label ; - m_peer = wxWidgetImpl::CreateButton( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateButton( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -126,10 +126,10 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which) m_bitmaps[which] = bitmap; if ( which == State_Normal ) - m_peer->SetBitmap(bitmap); + GetPeer()->SetBitmap(bitmap); else if ( which == State_Pressed ) { - wxButtonImpl* bi = dynamic_cast (m_peer); + wxButtonImpl* bi = dynamic_cast (GetPeer()); if ( bi ) bi->SetPressedBitmap(bitmap); } @@ -138,7 +138,7 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which) void wxButton::DoSetBitmapPosition(wxDirection dir) { - m_peer->SetBitmapPosition(dir); + GetPeer()->SetBitmapPosition(dir); InvalidateBestSize(); } @@ -149,7 +149,7 @@ bool wxButton::DoSetLabelMarkup(const wxString& markup) if ( !wxButtonBase::DoSetLabelMarkup(markup) ) return false; - m_peer->SetLabelMarkup(markup); + GetPeer()->SetLabelMarkup(markup); return true; } @@ -165,27 +165,27 @@ wxWindow *wxButton::SetDefault() btnOldDefault->GetPeer()->SetDefaultButton( false ); } - m_peer->SetDefaultButton( true ); + GetPeer()->SetDefaultButton( true ); return btnOldDefault; } void wxButton::Command (wxCommandEvent & WXUNUSED(event)) { - m_peer->PerformClick() ; + GetPeer()->PerformClick() ; // ProcessCommand(event); } void wxButton::OnEnterWindow( wxMouseEvent& WXUNUSED(event)) { if ( DoGetBitmap( State_Current ).IsOk() ) - m_peer->SetBitmap( DoGetBitmap( State_Current ) ); + GetPeer()->SetBitmap( DoGetBitmap( State_Current ) ); } void wxButton::OnLeaveWindow( wxMouseEvent& WXUNUSED(event)) { if ( DoGetBitmap( State_Current ).IsOk() ) - m_peer->SetBitmap( DoGetBitmap( State_Normal ) ); + GetPeer()->SetBitmap( DoGetBitmap( State_Normal ) ); } bool wxButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) @@ -208,7 +208,7 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; - m_peer = wxWidgetImpl::CreateDisclosureTriangle(this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateDisclosureTriangle(this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); // passing the text in the param doesn't seem to work, so lets do it again @@ -219,12 +219,12 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin void wxDisclosureTriangle::SetOpen( bool open ) { - m_peer->SetValue( open ? 1 : 0 ); + GetPeer()->SetValue( open ? 1 : 0 ); } bool wxDisclosureTriangle::IsOpen() const { - return m_peer->GetValue() == 1; + return GetPeer()->GetValue() == 1; } bool wxDisclosureTriangle::OSXHandleClicked( double WXUNUSED(timestampsec) ) diff --git a/src/osx/carbon/button.cpp b/src/osx/carbon/button.cpp index ea77565438..2924a24614 100644 --- a/src/osx/carbon/button.cpp +++ b/src/osx/carbon/button.cpp @@ -55,7 +55,7 @@ wxSize wxButton::DoGetBestSize() const #if wxOSX_USE_CARBON Rect bestsize = { 0 , 0 , 0 , 0 } ; - m_peer->GetBestRect( &bestsize ) ; + GetPeer()->GetBestRect( &bestsize ) ; int wBtn; if ( EmptyRect( &bestsize ) || ( GetWindowStyle() & wxBU_EXACTFIT) ) @@ -63,7 +63,7 @@ wxSize wxButton::DoGetBestSize() const Point bounds; ControlFontStyleRec controlFont; - OSStatus err = m_peer->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); + OSStatus err = GetPeer()->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); verify_noerr( err ); // GetThemeTextDimensions will cache strings and the documentation diff --git a/src/osx/carbon/control.cpp b/src/osx/carbon/control.cpp index 7f406f3a8b..dba7a99689 100644 --- a/src/osx/carbon/control.cpp +++ b/src/osx/carbon/control.cpp @@ -73,7 +73,7 @@ bool wxControl::ProcessCommand( wxCommandEvent &event ) void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) { - if ( m_peer == NULL || !m_peer->IsOk() ) + if ( GetPeer() == NULL || !GetPeer()->IsOk() ) return; #if wxOSX_USE_CARBON @@ -84,7 +84,7 @@ void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode ); GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - m_peer->HandleKey( keyCode, charCode, modifiers ); + GetPeer()->HandleKey( keyCode, charCode, modifiers ); #else // TODO #endif diff --git a/src/osx/carbon/listbox.cpp b/src/osx/carbon/listbox.cpp index 2ee41be25e..5baf503d8b 100644 --- a/src/osx/carbon/listbox.cpp +++ b/src/osx/carbon/listbox.cpp @@ -337,8 +337,8 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const err = SetHasScrollBars( (style & wxHSCROLL) != 0 , true ); #if 0 // shouldn't be necessary anymore under 10.2 - m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false ); - m_peer->SetNeedsFocusRect( true ); + GetPeer()->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false ); + GetPeer()->SetNeedsFocusRect( true ); #endif } diff --git a/src/osx/carbon/listctrl_mac.cpp b/src/osx/carbon/listctrl_mac.cpp index 898890d2ff..c9a1fab233 100644 --- a/src/osx/carbon/listctrl_mac.cpp +++ b/src/osx/carbon/listctrl_mac.cpp @@ -678,11 +678,11 @@ bool wxListCtrl::Create(wxWindow *parent, if ( !wxWindow::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), name) ) return false; m_dbImpl = new wxMacDataBrowserListCtrlControl( this, pos, size, style ); - m_peer = m_dbImpl; + SetPeer(m_dbImpl); MacPostControlCreate( pos, size ); - InstallControlEventHandler( m_peer->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(), + InstallControlEventHandler( GetPeer()->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macListCtrlEventHandler); diff --git a/src/osx/carbon/notebmac.cpp b/src/osx/carbon/notebmac.cpp index 9840b549f4..189b31c2a3 100644 --- a/src/osx/carbon/notebmac.cpp +++ b/src/osx/carbon/notebmac.cpp @@ -97,32 +97,32 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const HIPoint hipoint= { adjustedPt.x , adjustedPt.y } ; HIViewPartCode outPart = 0 ; - OSStatus err = HIViewGetPartHit( m_peer->GetControlRef(), &hipoint, &outPart ); + OSStatus err = HIViewGetPartHit( GetPeer()->GetControlRef(), &hipoint, &outPart ); - int max = m_peer->GetMaximum() ; + int max = GetPeer()->GetMaximum() ; if ( outPart == 0 && max > 0 ) { // this is a hack, as unfortunately a hit on an already selected tab returns 0, // so we have to go some extra miles to make sure we select something different // and try again .. - int val = m_peer->GetValue() ; + int val = GetPeer()->GetValue() ; int maxval = max ; if ( max == 1 ) { - m_peer->SetMaximum( 2 ) ; + GetPeer()->SetMaximum( 2 ) ; maxval = 2 ; } if ( val == 1 ) - m_peer->SetValue( maxval ) ; + GetPeer()->SetValue( maxval ) ; else - m_peer->SetValue( 1 ) ; + GetPeer()->SetValue( 1 ) ; - err = HIViewGetPartHit( m_peer->GetControlRef(), &hipoint, &outPart ); + err = HIViewGetPartHit( GetPeer()->GetControlRef(), &hipoint, &outPart ); - m_peer->SetValue( val ) ; + GetPeer()->SetValue( val ) ; if ( max == 1 ) - m_peer->SetMaximum( 1 ) ; + GetPeer()->SetMaximum( 1 ) ; } if ( outPart >= 1 && outPart <= countPages ) diff --git a/src/osx/carbon/stattext.cpp b/src/osx/carbon/stattext.cpp index 90765430e8..995cc7966b 100644 --- a/src/osx/carbon/stattext.cpp +++ b/src/osx/carbon/stattext.cpp @@ -48,10 +48,10 @@ wxSize wxStaticText::DoGetBestSize() const Rect bestsize = { 0 , 0 , 0 , 0 } ; // try the built-in best size if available - Boolean former = m_peer->GetData( kControlStaticTextIsMultilineTag); - m_peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); - m_peer->GetBestRect( &bestsize ) ; - m_peer->SetData( kControlStaticTextIsMultilineTag, former ); + Boolean former = GetPeer()->GetData( kControlStaticTextIsMultilineTag); + GetPeer()->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); + GetPeer()->GetBestRect( &bestsize ) ; + GetPeer()->SetData( kControlStaticTextIsMultilineTag, former ); if ( !EmptyRect( &bestsize ) ) { bounds.h = bestsize.right - bestsize.left ; @@ -62,7 +62,7 @@ wxSize wxStaticText::DoGetBestSize() const { #if wxOSX_USE_CARBON ControlFontStyleRec controlFont; - OSStatus err = m_peer->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); + OSStatus err = GetPeer()->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); verify_noerr( err ); #if wxOSX_USE_ATSU_TEXT diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index 08917a2f28..f0576260c5 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -1118,9 +1118,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); - m_peer->Move(0,0,0,0 ); + GetPeer()->Move(0,0,0,0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 ); - m_peer->SetVisibility( false ); + GetPeer()->SetVisibility( false ); wxToolBarBase::Show( false ); } } @@ -1135,7 +1135,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute ); MacUninstallNativeToolbar(); - m_peer->SetVisibility( true ); + GetPeer()->SetVisibility( true ); } } diff --git a/src/osx/checkbox_osx.cpp b/src/osx/checkbox_osx.cpp index 3a72833961..1c4142f17d 100644 --- a/src/osx/checkbox_osx.cpp +++ b/src/osx/checkbox_osx.cpp @@ -36,7 +36,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_labelOrig = m_label = label ; WXValidateStyle( &style ); - m_peer = wxWidgetImpl::CreateCheckBox( this, parent, id, label, pos, size, style, GetExtraStyle() ) ; + SetPeer(wxWidgetImpl::CreateCheckBox( this, parent, id, label, pos, size, style, GetExtraStyle() )) ; MacPostControlCreate(pos, size) ; @@ -72,12 +72,12 @@ void wxCheckBox::Command(wxCommandEvent & event) wxCheckBoxState wxCheckBox::DoGet3StateValue() const { - return (wxCheckBoxState)m_peer->GetValue() ; + return (wxCheckBoxState)GetPeer()->GetValue() ; } void wxCheckBox::DoSet3StateValue(wxCheckBoxState val) { - m_peer->SetValue( val ) ; + GetPeer()->SetValue( val ) ; } bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) @@ -85,7 +85,7 @@ bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) bool sendEvent = true; wxCheckBoxState newState = Get3StateValue(); - if ( !m_peer->ButtonClickDidStateChange() ) + if ( !GetPeer()->ButtonClickDidStateChange() ) { wxCheckBoxState origState ; diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp index 28af5cdf2c..c0540c58a3 100644 --- a/src/osx/choice_osx.cpp +++ b/src/osx/choice_osx.cpp @@ -74,7 +74,7 @@ bool wxChoice::Create(wxWindow *parent, m_popUpMenu = new wxMenu(); m_popUpMenu->SetNoEventsMode(true); - m_peer = wxWidgetImpl::CreateChoice( this, parent, id, m_popUpMenu, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateChoice( this, parent, id, m_popUpMenu, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -132,7 +132,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, AssignNewItemClientData(idx, clientData, i, type); } - m_peer->SetMaximum( GetCount() ); + GetPeer()->SetMaximum( GetCount() ); return pos - 1; } @@ -148,7 +148,7 @@ void wxChoice::DoDeleteOneItem(unsigned int n) m_strings.RemoveAt( n ) ; m_datas.RemoveAt( n ) ; - m_peer->SetMaximum( GetCount() ) ; + GetPeer()->SetMaximum( GetCount() ) ; } @@ -162,7 +162,7 @@ void wxChoice::DoClear() m_strings.Empty() ; m_datas.Empty() ; - m_peer->SetMaximum( 0 ) ; + GetPeer()->SetMaximum( 0 ) ; } // ---------------------------------------------------------------------------- @@ -170,12 +170,12 @@ void wxChoice::DoClear() // ---------------------------------------------------------------------------- int wxChoice::GetSelection() const { - return m_peer->GetValue(); + return GetPeer()->GetValue(); } void wxChoice::SetSelection( int n ) { - m_peer->SetValue( n ); + GetPeer()->SetValue( n ); } // ---------------------------------------------------------------------------- diff --git a/src/osx/cocoa/button.mm b/src/osx/cocoa/button.mm index 2eb0889fe2..7350cef3f3 100644 --- a/src/osx/cocoa/button.mm +++ b/src/osx/cocoa/button.mm @@ -32,7 +32,7 @@ wxSize wxButton::DoGetBestSize() const return wxSize( 23 , 23 ) ; wxRect r ; - m_peer->GetBestRect(&r); + GetPeer()->GetBestRect(&r); wxSize sz = r.GetSize(); sz.x = sz.x + MacGetLeftBorderSize() + diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm index 5dff77fb3c..b409af77b7 100644 --- a/src/osx/cocoa/notebook.mm +++ b/src/osx/cocoa/notebook.mm @@ -221,7 +221,7 @@ public: m_peer = new wxMacControl( this ); OSStatus err = CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() ); + tabsize, tabstyle, 0, NULL, GetPeer()->GetControlRefAddr() ); verify_noerr( err ); #endif */ diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index f1233ce809..02ac8d591e 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -841,9 +841,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) [tlw setToolbar:(NSToolbar*) m_macToolbar]; [(NSToolbar*) m_macToolbar setVisible:YES]; - m_peer->Move(0,0,0,0 ); + GetPeer()->Move(0,0,0,0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 ); - m_peer->SetVisibility( false ); + GetPeer()->SetVisibility( false ); wxToolBarBase::Show( false ); } } @@ -855,7 +855,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) bResult = true; [(NSToolbar*) m_macToolbar setVisible:NO]; MacUninstallNativeToolbar(); - m_peer->SetVisibility( true ); + GetPeer()->SetVisibility( true ); } } diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index bf092f3772..1d4529bbbc 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -64,7 +64,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, wxASSERT_MSG( !(style & wxCB_SORT), "wxCB_SORT not currently supported by wxOSX/Cocoa"); - m_peer = wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -110,7 +110,7 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, AssignNewItemClientData(idx, clientData, i, type); } - m_peer->SetMaximum( GetCount() ); + GetPeer()->SetMaximum( GetCount() ); return pos - 1; } @@ -216,7 +216,7 @@ bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxComboWidgetImpl* wxComboBox::GetComboPeer() const { - return dynamic_cast (m_peer); + return dynamic_cast (GetPeer()); } #endif // wxUSE_COMBOBOX && wxOSX_USE_COCOA diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index 6a15bd3aeb..9d2ea7506c 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -365,7 +365,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, { if (!(wxControl::Create(parent,id,pos,size,style,validator,name))) return false; - m_peer = ::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle()); + SetPeer(::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle())); MacPostControlCreate(pos,size); diff --git a/src/osx/gauge_osx.cpp b/src/osx/gauge_osx.cpp index 284d7fc666..d8cd4a35ff 100644 --- a/src/osx/gauge_osx.cpp +++ b/src/osx/gauge_osx.cpp @@ -33,7 +33,7 @@ bool wxGauge::Create( wxWindow *parent, wxSize size = s; - m_peer = wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -45,8 +45,8 @@ void wxGauge::SetRange(int r) // we are going via the base class in case there is // some change behind the values by it wxGaugeBase::SetRange( r ) ; - if ( m_peer ) - m_peer->SetMaximum( GetRange() ) ; + if ( GetPeer() ) + GetPeer()->SetMaximum( GetRange() ) ; } void wxGauge::SetValue(int pos) @@ -55,8 +55,8 @@ void wxGauge::SetValue(int pos) // some change behind the values by it wxGaugeBase::SetValue( pos ) ; - if ( m_peer ) - m_peer->SetValue( GetValue() ) ; + if ( GetPeer() ) + GetPeer()->SetValue( GetValue() ) ; } int wxGauge::GetValue() const @@ -66,7 +66,7 @@ int wxGauge::GetValue() const void wxGauge::Pulse() { - m_peer->PulseGauge(); + GetPeer()->PulseGauge(); } #endif // wxUSE_GAUGE diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index 624eb806ff..a784aed426 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -85,7 +85,7 @@ bool wxListBox::Create( else m_strings.unsorted = new wxArrayString; - m_peer = wxWidgetImpl::CreateListBox( this, parent, id, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateListBox( this, parent, id, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -106,7 +106,7 @@ wxListBox::~wxListBox() m_blockEvents = false; // make sure no native events get sent to a object in destruction - wxDELETE(m_peer); + SetPeer(NULL); if ( IsSorted() ) delete m_strings.sorted; diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index ea54053308..a24b9c2910 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -111,7 +111,7 @@ void wxMenu::SetNoEventsMode( bool noEvents ) bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) { wxASSERT_MSG( pItem != NULL, wxT("can't append NULL item to the menu") ); - m_peer->InsertOrAppend( pItem, pos ); + GetPeer()->InsertOrAppend( pItem, pos ); if ( pItem->IsSeparator() ) { @@ -228,7 +228,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) wxOSXMenuRemoveItem(m_hMenu , pos ); */ - m_peer->Remove( item ); + GetPeer()->Remove( item ); // and from internal data structures return wxMenuBase::DoRemove(item); } @@ -236,7 +236,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) void wxMenu::SetTitle(const wxString& label) { m_title = label ; - m_peer->SetTitle( wxStripMenuCodes( label ) ); + GetPeer()->SetTitle( wxStripMenuCodes( label ) ); } bool wxMenu::ProcessCommand(wxCommandEvent & event) diff --git a/src/osx/menuitem_osx.cpp b/src/osx/menuitem_osx.cpp index 3d83c08356..ce44dbccbf 100644 --- a/src/osx/menuitem_osx.cpp +++ b/src/osx/menuitem_osx.cpp @@ -177,7 +177,7 @@ void wxMenuItem::UpdateItemBitmap() if ( m_bitmap.Ok() ) { - m_peer->SetBitmap( m_bitmap ); + GetPeer()->SetBitmap( m_bitmap ); } } @@ -190,11 +190,11 @@ void wxMenuItem::UpdateItemStatus() return ; if ( IsCheckable() && IsChecked() ) - m_peer->Check( true ); + GetPeer()->Check( true ); else - m_peer->Check( false ); + GetPeer()->Check( false ); - m_peer->Enable( IsEnabled() ); + GetPeer()->Enable( IsEnabled() ); } void wxMenuItem::UpdateItemText() @@ -210,7 +210,7 @@ void wxMenuItem::UpdateItemText() } wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ; - m_peer->SetLabel( text, entry ); + GetPeer()->SetLabel( text, entry ); delete entry ; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index e2543dff27..c3f981a100 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -144,7 +144,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, name ); wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ; - m_peer = wxWidgetImpl::CreateContentView(this); + SetPeer(wxWidgetImpl::CreateContentView(this)); DoSetWindowVariant( m_windowVariant ) ; @@ -177,7 +177,7 @@ void wxNonOwnedWindow::SubclassWin(WXWindow nativeWindow) m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, GetParent(), nativeWindow ); m_isNativeWindowWrapper = true; wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ; - m_peer = wxWidgetImpl::CreateContentView(this); + SetPeer(wxWidgetImpl::CreateContentView(this)); } void wxNonOwnedWindow::UnsubclassWin() @@ -189,7 +189,7 @@ void wxNonOwnedWindow::UnsubclassWin() wxNonOwnedWindowImpl::RemoveAssociations(m_nowpeer) ; wxDELETE(m_nowpeer); - wxDELETE(m_peer); + SetPeer(NULL); m_isNativeWindowWrapper = false; } @@ -471,7 +471,7 @@ void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const // inner area, while the content area extends under the translucent // status bar, therefore we use the content view's area #ifdef __WXOSX_IPHONE__ - m_peer->GetContentArea(left, top, w, h); + GetPeer()->GetContentArea(left, top, w, h); #else m_nowpeer->GetContentArea(left, top, w, h); #endif diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 7c65da4656..f18f86dacf 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -53,7 +53,7 @@ bool wxNotebook::Create( wxWindow *parent, if ( !wxNotebookBase::Create( parent, id, pos, size, style, name ) ) return false; - m_peer = wxWidgetImpl::CreateTabView(this,parent, id, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateTabView(this,parent, id, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -235,7 +235,7 @@ bool wxNotebook::InsertPage(size_t nPage, m_selection++; // while this still is the same page showing, we need to update the tabs - m_peer->SetValue( m_selection + 1 ) ; + GetPeer()->SetValue( m_selection + 1 ) ; } DoSetSelectionAfterInsertion(nPage, bSelect); @@ -259,32 +259,32 @@ int wxNotebook::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(flags)) con HIPoint hipoint= { adjustedPt.x , adjustedPt.y } ; HIViewPartCode outPart = 0 ; - OSStatus err = HIViewGetPartHit( m_peer->GetControlRef(), &hipoint, &outPart ); + OSStatus err = HIViewGetPartHit( GetPeer()->GetControlRef(), &hipoint, &outPart ); - int max = m_peer->GetMaximum() ; + int max = GetPeer()->GetMaximum() ; if ( outPart == 0 && max > 0 ) { // this is a hack, as unfortunately a hit on an already selected tab returns 0, // so we have to go some extra miles to make sure we select something different // and try again .. - int val = m_peer->GetValue() ; + int val = GetPeer()->GetValue() ; int maxval = max ; if ( max == 1 ) { - m_peer->SetMaximum( 2 ) ; + GetPeer()->SetMaximum( 2 ) ; maxval = 2 ; } if ( val == 1 ) - m_peer->SetValue( maxval ) ; + GetPeer()->SetValue( maxval ) ; else - m_peer->SetValue( 1 ) ; + GetPeer()->SetValue( 1 ) ; - err = HIViewGetPartHit( m_peer->GetControlRef(), &hipoint, &outPart ); + err = HIViewGetPartHit( GetPeer()->GetControlRef(), &hipoint, &outPart ); - m_peer->SetValue( val ) ; + GetPeer()->SetValue( val ) ; if ( max == 1 ) - m_peer->SetMaximum( 1 ) ; + GetPeer()->SetMaximum( 1 ) ; } if ( outPart >= 1 && outPart <= countPages ) @@ -311,7 +311,7 @@ int wxNotebook::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(flags)) con // void wxNotebook::MacSetupTabs() { - m_peer->SetupTabs(*this); + GetPeer()->SetupTabs(*this); Refresh(); } @@ -494,14 +494,14 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) } m_selection = nSel; - m_peer->SetValue( m_selection + 1 ) ; + GetPeer()->SetValue( m_selection + 1 ) ; } bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) { bool status = false ; - SInt32 newSel = m_peer->GetValue() - 1 ; + SInt32 newSel = GetPeer()->GetValue() - 1 ; if ( newSel != m_selection ) { wxBookCtrlEvent changing( @@ -520,7 +520,7 @@ bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) } else { - m_peer->SetValue( m_selection + 1 ) ; + GetPeer()->SetValue( m_selection + 1 ) ; } status = true ; diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index 874381292c..ae1526b0a5 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -113,7 +113,7 @@ bool wxRadioBox::Create( wxWindow *parent, m_labelOrig = m_label = label; - m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() )); for (i = 0; i < n; i++) { diff --git a/src/osx/radiobut_osx.cpp b/src/osx/radiobut_osx.cpp index 772a2601a6..0b93ecd662 100644 --- a/src/osx/radiobut_osx.cpp +++ b/src/osx/radiobut_osx.cpp @@ -32,7 +32,7 @@ bool wxRadioButton::Create( wxWindow *parent, m_labelOrig = m_label = label; - m_peer = wxWidgetImpl::CreateRadioButton( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateRadioButton( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -74,10 +74,10 @@ wxRadioButton::~wxRadioButton() void wxRadioButton::SetValue(bool val) { wxRadioButton *cycle; - if (m_peer->GetValue() == val) + if (GetPeer()->GetValue() == val) return; - m_peer->SetValue( val ); + GetPeer()->SetValue( val ); if (val) { cycle = this->NextInCycle(); @@ -94,7 +94,7 @@ void wxRadioButton::SetValue(bool val) bool wxRadioButton::GetValue() const { - return m_peer->GetValue() != 0; + return GetPeer()->GetValue() != 0; } void wxRadioButton::Command(wxCommandEvent& event) @@ -105,7 +105,7 @@ void wxRadioButton::Command(wxCommandEvent& event) bool wxRadioButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) { - if ( !m_peer->ButtonClickDidStateChange() ) + if ( !GetPeer()->ButtonClickDidStateChange() ) { // if already set -> no action if (GetValue()) diff --git a/src/osx/scrolbar_osx.cpp b/src/osx/scrolbar_osx.cpp index 3842de5686..eb324b9e7a 100644 --- a/src/osx/scrolbar_osx.cpp +++ b/src/osx/scrolbar_osx.cpp @@ -40,7 +40,7 @@ bool wxScrollBar::Create( wxWindow *parent, if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; - m_peer = wxWidgetImpl::CreateScrollBar( this, parent, id, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateScrollBar( this, parent, id, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -53,12 +53,12 @@ wxScrollBar::~wxScrollBar() void wxScrollBar::SetThumbPosition( int viewStart ) { - m_peer->SetScrollThumb( viewStart, m_viewSize ); + GetPeer()->SetScrollThumb( viewStart, m_viewSize ); } int wxScrollBar::GetThumbPosition() const { - return m_peer->GetValue(); + return GetPeer()->GetValue(); } void wxScrollBar::SetScrollbar( int position, @@ -73,8 +73,8 @@ void wxScrollBar::SetScrollbar( int position, int range1 = wxMax( (m_objectSize - m_viewSize), 0 ); - m_peer->SetMaximum( range1 ); - m_peer->SetScrollThumb( position, m_viewSize ); + GetPeer()->SetMaximum( range1 ); + GetPeer()->SetScrollThumb( position, m_viewSize ); } void wxScrollBar::Command( wxCommandEvent& event ) @@ -85,7 +85,7 @@ void wxScrollBar::Command( wxCommandEvent& event ) bool wxScrollBar::OSXHandleClicked( double WXUNUSED(timestampsec) ) { - int new_pos = m_peer->GetValue(); + int new_pos = GetPeer()->GetValue(); wxScrollEvent event( wxEVT_SCROLL_THUMBRELEASE, m_windowId ); if ( m_windowStyle & wxHORIZONTAL ) @@ -127,9 +127,9 @@ wxSize wxScrollBar::DoGetBestSize() const void wxScrollBar::TriggerScrollEvent( wxEventType scrollEvent ) { - int position = m_peer->GetValue(); + int position = GetPeer()->GetValue(); int minPos = 0 ; - int maxPos = m_peer->GetMaximum(); + int maxPos = GetPeer()->GetMaximum(); int nScrollInc = 0; if ( scrollEvent == wxEVT_SCROLL_LINEUP ) diff --git a/src/osx/slider_osx.cpp b/src/osx/slider_osx.cpp index ef3a7f1b7d..dffe5eb2d2 100644 --- a/src/osx/slider_osx.cpp +++ b/src/osx/slider_osx.cpp @@ -103,7 +103,7 @@ bool wxSlider::Create(wxWindow *parent, if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; - m_peer = wxWidgetImpl::CreateSlider( this, parent, id, value, minValue, maxValue, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateSlider( this, parent, id, value, minValue, maxValue, pos, size, style, GetExtraStyle() )); if (style & wxSL_VERTICAL) // Forces SetSize to use the proper width @@ -146,7 +146,7 @@ wxSlider::~wxSlider() int wxSlider::GetValue() const { // We may need to invert the value returned by the widget - return ValueInvertOrNot( m_peer->GetValue() ) ; + return ValueInvertOrNot( GetPeer()->GetValue() ) ; } void wxSlider::SetValue(int value) @@ -159,7 +159,7 @@ void wxSlider::SetValue(int value) } // We only invert for the setting of the actual native widget - m_peer->SetValue( ValueInvertOrNot( value ) ); + GetPeer()->SetValue( ValueInvertOrNot( value ) ); } void wxSlider::SetRange(int minValue, int maxValue) @@ -175,8 +175,8 @@ void wxSlider::SetRange(int minValue, int maxValue) m_rangeMin = minValue; m_rangeMax = maxValue; - m_peer->SetMinimum( m_rangeMin ); - m_peer->SetMaximum( m_rangeMax ); + GetPeer()->SetMinimum( m_rangeMin ); + GetPeer()->SetMaximum( m_rangeMax ); if (m_macMinimumStatic) { @@ -288,7 +288,7 @@ void wxSlider::TriggerScrollEvent( wxEventType scrollEvent) { // Whatever the native value is, we may need to invert it for calling // SetValue and putting the possibly inverted value in the event - int value = ValueInvertOrNot( m_peer->GetValue() ); + int value = ValueInvertOrNot( GetPeer()->GetValue() ); SetValue( value ); @@ -436,7 +436,7 @@ void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) if (GetWindowStyle() & wxSL_VERTICAL) // If vertical, use current value - text.Printf(wxT("%d"), (int)m_peer->GetValue()); + text.Printf(wxT("%d"), (int)GetPeer()->GetValue()); else // Use max so that the current value doesn't drift as centering would need to change text.Printf(wxT("%d"), m_rangeMax); diff --git a/src/osx/spinbutt_osx.cpp b/src/osx/spinbutt_osx.cpp index 5e3408d519..92bc682b9a 100644 --- a/src/osx/spinbutt_osx.cpp +++ b/src/osx/spinbutt_osx.cpp @@ -37,8 +37,8 @@ bool wxSpinButton::Create( wxWindow *parent, if (!parent) return false; - m_peer = wxWidgetImpl::CreateSpinButton( this , parent, id, 0, m_min, m_max, pos, size, - style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateSpinButton( this , parent, id, 0, m_min, m_max, pos, size, + style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -51,20 +51,20 @@ wxSpinButton::~wxSpinButton() void wxSpinButton::SetValue( int val ) { - m_peer->SetValue( val ); + GetPeer()->SetValue( val ); } int wxSpinButton::GetValue() const { - return m_peer->GetValue(); + return GetPeer()->GetValue(); } void wxSpinButton::SetRange(int minVal, int maxVal) { m_min = minVal; m_max = maxVal; - m_peer->SetMaximum( maxVal ); - m_peer->SetMinimum( minVal ); + GetPeer()->SetMaximum( maxVal ); + GetPeer()->SetMinimum( minVal ); } void wxSpinButton::SendThumbTrackEvent() @@ -143,7 +143,7 @@ void wxSpinButton::TriggerScrollEvent(wxEventType scrollEvent) newValue = oldValue; } - m_peer->SetValue( newValue ); + GetPeer()->SetValue( newValue ); // always send a thumbtrack event SendThumbTrackEvent() ; diff --git a/src/osx/srchctrl_osx.cpp b/src/osx/srchctrl_osx.cpp index 58cc5313ec..f62ecd530e 100644 --- a/src/osx/srchctrl_osx.cpp +++ b/src/osx/srchctrl_osx.cpp @@ -68,7 +68,7 @@ void wxSearchCtrl::Init() wxSearchWidgetImpl* wxSearchCtrl::GetSearchPeer() const { - return dynamic_cast (m_peer); + return dynamic_cast (GetPeer()); } wxSearchCtrl::~wxSearchCtrl() @@ -185,7 +185,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, } - m_peer = wxWidgetImpl::CreateSearchControl( this, GetParent(), GetId(), value, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateSearchControl( this, GetParent(), GetId(), value, pos, size, style, GetExtraStyle() )); MacPostControlCreate(pos, size) ; diff --git a/src/osx/statbox_osx.cpp b/src/osx/statbox_osx.cpp index c093cd384f..2db314f9fc 100644 --- a/src/osx/statbox_osx.cpp +++ b/src/osx/statbox_osx.cpp @@ -31,7 +31,7 @@ bool wxStaticBox::Create( wxWindow *parent, m_labelOrig = m_label = label; - m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); diff --git a/src/osx/statline_osx.cpp b/src/osx/statline_osx.cpp index 73e29957c7..0e4515c674 100644 --- a/src/osx/statline_osx.cpp +++ b/src/osx/statline_osx.cpp @@ -54,7 +54,7 @@ bool wxStaticLine::Create( wxWindow *parent, style, wxDefaultValidator, name) ) return false; - m_peer = wxWidgetImpl::CreateStaticLine( this, parent, id, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateStaticLine( this, parent, id, pos, size, style, GetExtraStyle() )); MacPostControlCreate(pos,size) ; diff --git a/src/osx/stattext_osx.cpp b/src/osx/stattext_osx.cpp index 0ff943ff6d..3f75f62491 100644 --- a/src/osx/stattext_osx.cpp +++ b/src/osx/stattext_osx.cpp @@ -41,7 +41,7 @@ bool wxStaticText::Create( wxWindow *parent, if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; - m_peer = wxWidgetImpl::CreateStaticText( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateStaticText( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -101,7 +101,7 @@ bool wxStaticText::SetFont(const wxFont& font) void wxStaticText::DoSetLabel(const wxString& label) { m_label = RemoveMnemonics(label); - m_peer->SetLabel(m_label , GetFont().GetEncoding() ); + GetPeer()->SetLabel(m_label , GetFont().GetEncoding() ); } #if wxUSE_MARKUP && wxOSX_USE_COCOA @@ -111,7 +111,7 @@ bool wxStaticText::DoSetLabelMarkup(const wxString& markup) if ( !wxStaticTextBase::DoSetLabelMarkup(markup) ) return false; - m_peer->SetLabelMarkup(markup); + GetPeer()->SetLabelMarkup(markup); return true; } diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 226c24f2a8..9baf749989 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -112,7 +112,7 @@ bool wxTextCtrl::Create( wxWindow *parent, } - m_peer = wxWidgetImpl::CreateTextControl( this, GetParent(), GetId(), str, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateTextControl( this, GetParent(), GetId(), str, pos, size, style, GetExtraStyle() )); MacPostControlCreate(pos, size) ; diff --git a/src/osx/tglbtn_osx.cpp b/src/osx/tglbtn_osx.cpp index 9c5e02bfcf..cc70d3aaec 100644 --- a/src/osx/tglbtn_osx.cpp +++ b/src/osx/tglbtn_osx.cpp @@ -54,7 +54,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, m_labelOrig = m_label = label ; - m_peer = wxWidgetImpl::CreateToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() ) ; + SetPeer(wxWidgetImpl::CreateToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() )) ; MacPostControlCreate(pos,size) ; @@ -75,12 +75,12 @@ wxSize wxToggleButton::DoGetBestSize() const void wxToggleButton::SetValue(bool val) { - m_peer->SetValue( val ) ; + GetPeer()->SetValue( val ) ; } bool wxToggleButton::GetValue() const { - return m_peer->GetValue() ; + return GetPeer()->GetValue() ; } void wxToggleButton::Command(wxCommandEvent & event) @@ -121,7 +121,7 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; - m_peer = wxWidgetImpl::CreateBitmapToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() ) ; + SetPeer(wxWidgetImpl::CreateBitmapToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate(pos,size) ; @@ -142,12 +142,12 @@ wxSize wxBitmapToggleButton::DoGetBestSize() const void wxBitmapToggleButton::SetValue(bool val) { - m_peer->SetValue( val ) ; + GetPeer()->SetValue( val ) ; } bool wxBitmapToggleButton::GetValue() const { - return m_peer->GetValue() ; + return GetPeer()->GetValue() ; } void wxBitmapToggleButton::Command(wxCommandEvent & event) diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 5e8dc24763..9ae46ce412 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -268,6 +268,13 @@ WXWidget wxWindowMac::GetHandle() const return NULL; } +void wxWindowMac::SetPeer(wxOSXWidgetImpl* peer) +{ + wxDELETE(m_peer); + // todo event check handlers + m_peer = peer; +} + // --------------------------------------------------------------------------- // Utility Routines to move between different coordinate systems // --------------------------------------------------------------------------- -- 2.45.2