From dd295300cab5573c8ef83b45ff43e69396faf764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 2 Nov 2013 18:01:25 +0000 Subject: [PATCH] Make wxTextEntry::SetHint() work with all derived controls in wxOSX. Previously, the method was only implemented in wxTextCtrl even though it used wxTextEntry code to do the actual work. Move the implementation into wxTextEntry. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/textctrl.h | 5 ----- include/wx/osx/textentry.h | 6 ++++++ src/osx/textctrl_osx.cpp | 15 --------------- src/osx/textentry_osx.cpp | 12 ++++++++++++ 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/wx/osx/textctrl.h b/include/wx/osx/textctrl.h index 53604bab7b..a52620b5c7 100644 --- a/include/wx/osx/textctrl.h +++ b/include/wx/osx/textctrl.h @@ -74,10 +74,6 @@ public: virtual void MarkDirty(); virtual void DiscardEdits(); - // set the grayed out hint text - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; - // text control under some platforms supports the text styles: these // methods apply the given text style to the given selection or to // set/get the style which will be used for all appended text @@ -151,7 +147,6 @@ protected: private : wxMenu *m_privateContextMenu; - wxString m_hintString; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/osx/textentry.h b/include/wx/osx/textentry.h index 2362cae8af..12d780778a 100644 --- a/include/wx/osx/textentry.h +++ b/include/wx/osx/textentry.h @@ -81,6 +81,10 @@ public: virtual bool SendMaxLenEvent(); + // set the grayed out hint text + virtual bool SetHint(const wxString& hint); + virtual wxString GetHint() const; + // Implementation // -------------- @@ -102,6 +106,8 @@ protected: // need to make this public because of the current implementation via callbacks unsigned long m_maxLength; +private: + wxString m_hintString; }; #endif // _WX_OSX_TEXTENTRY_H_ diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index dcfc0e15b4..08346e5adb 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -599,21 +599,6 @@ bool wxTextCtrl::MacSetupCursor( const wxPoint& pt ) return true ; } -bool wxTextCtrl::SetHint(const wxString& hint) -{ - m_hintString = hint; - - if ( GetTextPeer() && GetTextPeer()->SetHint(hint) ) - return true; - - return false; -} - -wxString wxTextCtrl::GetHint() const -{ - return m_hintString; -} - // ---------------------------------------------------------------------------- // implementation base class // ---------------------------------------------------------------------------- diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index 67a858ea8f..8a1466ba83 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -287,6 +287,18 @@ wxTextWidgetImpl * wxTextEntry::GetTextPeer() const return win ? dynamic_cast(win->GetPeer()) : NULL; } +bool wxTextEntry::SetHint(const wxString& hint) +{ + m_hintString = hint; + return GetTextPeer() && GetTextPeer()->SetHint(hint); +} + +wxString wxTextEntry::GetHint() const +{ + return m_hintString; +} + + // ---------------------------------------------------------------------------- // Auto-completion // ----------------------------------------------------------------------------