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
This commit is contained in:
Václav Slavík
2013-11-02 18:01:25 +00:00
parent 73eb200299
commit dd295300ca
4 changed files with 18 additions and 20 deletions

View File

@@ -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()
};

View File

@@ -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_

View File

@@ -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
// ----------------------------------------------------------------------------

View File

@@ -287,6 +287,18 @@ wxTextWidgetImpl * wxTextEntry::GetTextPeer() const
return win ? dynamic_cast<wxTextWidgetImpl *>(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
// ----------------------------------------------------------------------------