]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/srchctrl.cpp
Border corrections
[wxWidgets.git] / src / mac / carbon / srchctrl.cpp
index 223ed8fcb137d013fc56cf9abd807aeb745f707c..fb9ec1f67bc64fb420383d8a33096bb66494475e 100644 (file)
@@ -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 );