X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68fc5c8025e38b9d827383fbfe7ce509ae331c1f..677dc0ed1a3ff68af15f6246d6d0708d5264b07a:/src/mac/carbon/srchctrl.cpp?ds=inline diff --git a/src/mac/carbon/srchctrl.cpp b/src/mac/carbon/srchctrl.cpp index 223ed8fcb1..fb9ec1f67b 100644 --- a/src/mac/carbon/srchctrl.cpp +++ b/src/mac/carbon/srchctrl.cpp @@ -68,6 +68,10 @@ public : virtual void SetSearchMenu( wxMenu* menu ); virtual wxMenu* GetSearchMenu() const; + + virtual void SetDescriptiveText(const wxString& text); + virtual wxString GetDescriptiveText() const; + protected : virtual void CreateControl( wxTextCtrl* peer, const Rect* bounds, CFStringRef crf ); @@ -75,7 +79,9 @@ private: wxMenu* m_menu; } ; -void wxMacSearchFieldControl::CreateControl( wxTextCtrl* /*peer*/, const Rect* bounds, CFStringRef crf ) +void wxMacSearchFieldControl::CreateControl(wxTextCtrl* WXUNUSED(peer), + const Rect* bounds, + CFStringRef WXUNUSED(crf)) { OptionBits attributes = 0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @@ -167,6 +173,28 @@ wxMenu* wxMacSearchFieldControl::GetSearchMenu() const return m_menu; } + +void wxMacSearchFieldControl::SetDescriptiveText(const wxString& text) +{ + verify_noerr( HISearchFieldSetDescriptiveText( + m_controlRef, + wxMacCFStringHolder( text, wxFont::GetDefaultEncoding() ))); +} + +wxString wxMacSearchFieldControl::GetDescriptiveText() const +{ + CFStringRef cfStr; + verify_noerr( HISearchFieldCopyDescriptiveText( m_controlRef, &cfStr )); + if ( cfStr ) + { + return wxMacCFStringHolder(cfStr).AsString(); + } + else + { + return wxEmptyString; + } +} + #endif // ============================================================================ @@ -249,6 +277,8 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&searchEventHandler); + SetValue(value); + return true; } @@ -351,6 +381,16 @@ bool wxSearchCtrl::IsCancelButtonVisible() const return GetPeer()->IsCancelButtonVisible(); } +void wxSearchCtrl::SetDescriptiveText(const wxString& text) +{ + GetPeer()->SetDescriptiveText(text); +} + +wxString wxSearchCtrl::GetDescriptiveText() const +{ + return GetPeer()->GetDescriptiveText(); +} + wxInt32 wxSearchCtrl::MacSearchFieldSearchHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) { wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, m_windowId );