Remove duplicated GetTextPeer() definitions from derived classes.

GetTextPeer() may be implemented directly in wxTextEntry under OS X, there is
no need to define it (identically) in wxTextCtrl and wxComboBox.

Also just call this method instead of duplicating its code in wxOSX
wxTextCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63878 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-04-06 18:46:14 +00:00
parent f25cb0af6b
commit 005ac806ea
5 changed files with 4 additions and 20 deletions

View File

@ -146,10 +146,6 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
WX_DECLARE_CONTROL_CONTAINER();
#endif
// only used by the native Cocoa combobox, but we must define it everywhere
// to maintain the wxTextEntry abstraction.
virtual wxTextWidgetImpl * GetTextPeer() const;
#if wxOSX_USE_COCOA
wxComboWidgetImpl* GetComboPeer() const;
#endif

View File

@ -26,9 +26,6 @@
#include "wx/control.h"
#include "wx/textctrl.h"
// forward decl for wxListWidgetImpl implementation type.
class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl;
class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
@ -142,7 +139,6 @@ public:
virtual void MacSuperChangedPosition();
virtual void MacCheckSpelling(bool check);
virtual wxTextWidgetImpl * GetTextPeer() const;
protected:
// common part of all ctors
void Init();

View File

@ -217,11 +217,6 @@ bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) )
return true;
}
wxTextWidgetImpl* wxComboBox::GetTextPeer() const
{
return dynamic_cast<wxTextWidgetImpl*> (m_peer);
}
wxComboWidgetImpl* wxComboBox::GetComboPeer() const
{
return dynamic_cast<wxComboWidgetImpl*> (m_peer);

View File

@ -137,11 +137,6 @@ bool wxTextCtrl::Create( wxWindow *parent,
return true;
}
wxTextWidgetImpl* wxTextCtrl::GetTextPeer() const
{
return dynamic_cast<wxTextWidgetImpl*> (m_peer);
}
void wxTextCtrl::MacSuperChangedPosition()
{
wxWindow::MacSuperChangedPosition() ;

View File

@ -204,7 +204,9 @@ bool wxTextEntry::CanRedo() const
wxTextWidgetImpl * wxTextEntry::GetTextPeer() const
{
wxFAIL_MSG("You need to implement wxTextWidgetImpl* GetTextPeer() in your wxTextEntry subclass if you want to use the native impls of its methods.");
return NULL;
wxWindow * const win = const_cast<wxTextEntry *>(this)->GetEditableWindow();
return win ? dynamic_cast<wxTextWidgetImpl *>(win->GetPeer()) : NULL;
}
#endif // wxUSE_TEXTCTRL