diff --git a/include/wx/gtk/textentry.h b/include/wx/gtk/textentry.h index 5df686cf24..3d9da824ec 100644 --- a/include/wx/gtk/textentry.h +++ b/include/wx/gtk/textentry.h @@ -48,6 +48,11 @@ public: virtual void SetMaxLength(unsigned long len); +#ifdef __WXGTK3__ + virtual bool SetHint(const wxString& hint); + virtual wxString GetHint() const; +#endif + // implementation only from now on void SendMaxLenEvent(); bool GTKEntryOnInsertText(const char* text); diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index 0c15570343..03a6867379 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -514,4 +514,31 @@ wxPoint wxTextEntry::DoGetMargins() const #endif } +#ifdef __WXGTK3__ +bool wxTextEntry::SetHint(const wxString& hint) +{ +#if GTK_CHECK_VERSION(3,2,0) + GtkEntry *entry = GetEntry(); + if ( entry ) + { + gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint)); + return true; + } + else +#endif + return wxTextEntryBase::SetHint(hint); +} + +wxString wxTextEntry::GetHint() const +{ +#if GTK_CHECK_VERSION(3,2,0) + GtkEntry *entry = GetEntry(); + if ( entry ) + return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry)); + else +#endif + return wxTextEntryBase::GetHint(); +} +#endif // __WXGTK3__ + #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX