]> git.saurik.com Git - wxWidgets.git/commitdiff
Remove duplicated GetTextPeer() definitions from derived classes.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Apr 2010 18:46:14 +0000 (18:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Apr 2010 18:46:14 +0000 (18:46 +0000)
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

include/wx/osx/combobox.h
include/wx/osx/textctrl.h
src/osx/combobox_osx.cpp
src/osx/textctrl_osx.cpp
src/osx/textentry_osx.cpp

index bf1b20861bf7a8d6367c315cdf8b3c01f87a471d..cae14068b8f8e99de774a45cdaed75177251fe01 100644 (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
index 988340df218c7b536cfd18cf9cc4958afa3a6028..85583505fdd5dd43278181c82dcd0d9d94166aea 100644 (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();
index 744ad7304a1a78660ee3fc3fe72a4c91f7973b5d..a69e26cf8bd2cf1301bee394665b6217e43b57b4 100644 (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);
index 869fcb5b506bd5125c0ded290a3ffbe576cbdb2a..4021966024a197c35e133e216e09e09b6306056f 100644 (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() ;
index 680a4fdcfbcb9afa0af3749a6b2743d6e12ab09c..3e2ca4f22dffc6933924ee23b79551a2f808c72b 100644 (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