]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxSearchCtrl::[Get|Set]DescriptiveText
authorRobin Dunn <robin@alldunn.com>
Fri, 19 Jan 2007 05:27:16 +0000 (05:27 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 19 Jan 2007 05:27:16 +0000 (05:27 +0000)
Tweaked the layout of the subcontrols a bit
Lightened the icons to be more like Mac

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
include/wx/generic/srchctlg.h
include/wx/mac/carbon/srchctrl.h
src/generic/srchctlg.cpp
src/mac/carbon/srchctrl.cpp
version-script.in
wxPython/src/_srchctrl.i
wxPython/src/gtk/_controls.py
wxPython/src/gtk/_controls_wrap.cpp
wxPython/src/mac/_controls.py
wxPython/src/mac/_controls_wrap.cpp
wxPython/src/msw/_controls.py
wxPython/src/msw/_controls_wrap.cpp

index 690048098da9483b5ea4117238bc037b94139670..d9f42af826b5ab1f77d0ca6858d5802acda4b07b 100644 (file)
@@ -60,6 +60,12 @@ public:
     virtual void ShowCancelButton( bool show );
     virtual bool IsCancelButtonVisible() const;
 
+#if wxABI_VERSION >= 20802
+    // TODO: In 2.9 these should probably be virtual, and declared in the base class...
+    void SetDescriptiveText(const wxString& text);
+    wxString GetDescriptiveText() const;
+#endif
+
     // accessors
     // ---------
 
index 6c3f2496a2d0210af2c3e2b95624032bfc2ff1c5..7b368aa20625e0fefba6dc2bedc8e5446b63e076 100644 (file)
@@ -53,6 +53,12 @@ public:
     virtual void ShowCancelButton( bool show );
     virtual bool IsCancelButtonVisible() const;
 
+#if wxABI_VERSION >= 20802
+    // TODO: In 2.9 these should probably be virtual, and declared in the base class...
+    void SetDescriptiveText(const wxString& text);
+    wxString GetDescriptiveText() const;
+#endif
+
     virtual wxInt32     MacSearchFieldSearchHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
     virtual wxInt32     MacSearchFieldCancelHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
 
index 8edf081475bc4d447085167c66849921d386deab..b40557a72458fcbb1aed01a1e99be63a7a8ebfbb 100644 (file)
@@ -50,6 +50,57 @@ static const wxCoord ICON_MARGIN = 0;
 static const wxCoord ICON_OFFSET = 0;
 #endif
 
+// ----------------------------------------------------------------------------
+// TODO: These functions or something like them should probably be made
+// public.  There are similar functions in src/aui/dockart.cpp...
+
+static double wxBlendColour(double fg, double bg, double alpha)
+{
+    double result = bg + (alpha * (fg - bg));
+    if (result < 0.0)
+        result = 0.0;
+    if (result > 255)
+        result = 255;
+    return result;
+}
+
+static wxColor wxStepColour(const wxColor& c, int ialpha)
+{
+    if (ialpha == 100)
+        return c;
+        
+    double r = c.Red(), g = c.Green(), b = c.Blue();
+    double bg;
+    
+    // ialpha is 0..200 where 0 is completely black
+    // and 200 is completely white and 100 is the same
+    // convert that to normal alpha 0.0 - 1.0
+    ialpha = wxMin(ialpha, 200);
+    ialpha = wxMax(ialpha, 0);
+    double alpha = ((double)(ialpha - 100.0))/100.0;
+    
+    if (ialpha > 100)
+    {
+        // blend with white
+        bg = 255.0;
+        alpha = 1.0 - alpha;  // 0 = transparent fg; 1 = opaque fg
+    }
+     else
+    {
+        // blend with black
+        bg = 0.0;
+        alpha = 1.0 + alpha;  // 0 = transparent fg; 1 = opaque fg
+    }
+    
+    r = wxBlendColour(r, bg, alpha);
+    g = wxBlendColour(g, bg, alpha);
+    b = wxBlendColour(b, bg, alpha);
+    
+    return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
+}
+
+#define LIGHT_STEP 160
+
 // ----------------------------------------------------------------------------
 // wxSearchTextCtrl: text control used by search control
 // ----------------------------------------------------------------------------
@@ -62,11 +113,27 @@ public:
                      style | wxNO_BORDER)
     {
         m_search = search;
-
+        m_defaultFG = GetForegroundColour();
+        
         // remove the default minsize, the searchctrl will have one instead
         SetSizeHints(wxDefaultCoord,wxDefaultCoord);
     }
 
+    void SetDescriptiveText(const wxString& text)
+    {
+        if ( GetValue() == m_descriptiveText )
+        {
+            SetValue(wxEmptyString);
+        }
+        
+        m_descriptiveText = text;
+    }
+    
+    wxString GetDescriptiveText() const
+    {
+        return m_descriptiveText;
+    }
+    
 protected:
     void OnText(wxCommandEvent& eventText)
     {
@@ -92,9 +159,31 @@ protected:
         m_search->GetEventHandler()->ProcessEvent(event);
     }
 
+    void OnIdle(wxIdleEvent& WXUNUSED(event))
+    {
+        if ( IsEmpty() && !(wxWindow::FindFocus() == this) )
+        {
+            SetValue(m_descriptiveText);
+            SetInsertionPoint(0);
+            SetForegroundColour(wxStepColour(m_defaultFG, LIGHT_STEP));
+        }
+    }
+
+    void OnFocus(wxFocusEvent& event)
+    {
+        event.Skip();
+        if ( GetValue() == m_descriptiveText )
+        {
+            SetValue(wxEmptyString);
+            SetForegroundColour(m_defaultFG);
+        }
+    }
+    
 private:
     wxSearchCtrl* m_search;
-
+    wxString      m_descriptiveText;
+    wxColour      m_defaultFG;
+    
     DECLARE_EVENT_TABLE()
 };
 
@@ -103,6 +192,8 @@ BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl)
     EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText)
     EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl)
     EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText)
+    EVT_IDLE(wxSearchTextCtrl::OnIdle)
+    EVT_SET_FOCUS(wxSearchTextCtrl::OnFocus)
 END_EVENT_TABLE()
 
 // ----------------------------------------------------------------------------
@@ -234,7 +325,8 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
     }
 
     m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK);
-
+    m_text->SetDescriptiveText(_("Search"));
+    
     wxSize sizeText = m_text->GetBestSize();
 
     m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap);
@@ -280,12 +372,6 @@ void wxSearchCtrl::SetMenu( wxMenu* menu )
     {
         m_searchButton->SetBitmapLabel(m_searchMenuBitmap);
         m_searchButton->Refresh();
-        if ( !m_searchButtonVisible )
-        {
-            // adding the menu will force the search button to be visible
-            wxRect rect = GetRect();
-            LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
-        }
     }
     else if ( !m_menu && hadMenu )
     {
@@ -294,12 +380,9 @@ void wxSearchCtrl::SetMenu( wxMenu* menu )
         {
             m_searchButton->Refresh();
         }
-        else
-        {
-            wxRect rect = GetRect();
-            LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
-        }
     }
+    wxRect rect = GetRect();
+    LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());    
 }
 
 wxMenu* wxSearchCtrl::GetMenu()
@@ -348,6 +431,15 @@ bool wxSearchCtrl::IsCancelButtonVisible() const
     return m_cancelButtonVisible;
 }
 
+void wxSearchCtrl::SetDescriptiveText(const wxString& text)
+{
+    m_text->SetDescriptiveText(text);
+}
+
+wxString wxSearchCtrl::GetDescriptiveText() const
+{
+    return m_text->GetDescriptiveText();
+}
 
 // ----------------------------------------------------------------------------
 // geometry
@@ -393,7 +485,7 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height)
     
     wxSize sizeText = m_text->GetBestSize();
     // make room for the search menu & clear button
-    int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
+    int horizontalBorder = ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
     x += horizontalBorder;
     y += BORDER;
     width -= horizontalBorder*2;
@@ -427,13 +519,13 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height)
 
     // position the subcontrols inside the client area
 
-    m_searchButton->SetSize(x, y + ICON_OFFSET, sizeSearch.x, height);
+    m_searchButton->SetSize(x, y + ICON_OFFSET - 1, sizeSearch.x, height);
     m_text->SetSize( x + sizeSearch.x + searchMargin, 
                      y + ICON_OFFSET - BORDER,
                      textWidth, 
                      height);
     m_cancelButton->SetSize(x + sizeSearch.x + searchMargin + textWidth + cancelMargin,
-                            y + ICON_OFFSET, sizeCancel.x, height);
+                            y + ICON_OFFSET - 1, sizeCancel.x, height);
 }
 
 
@@ -811,7 +903,7 @@ static int GetMultiplier()
 wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
 {
     wxColour bg = GetBackgroundColour();
-    wxColour fg = GetForegroundColour();
+    wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP-20);
 
     //===============================================================================
     // begin drawing code
@@ -892,7 +984,8 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
         };
         mem.DrawPolygon(WXSIZEOF(dropPolygon),dropPolygon,multiplier*triangleX,multiplier*triangleY);
     }
-
+    mem.SelectObject(wxNullBitmap);
+    
     //===============================================================================
     // end drawing code
     //===============================================================================
@@ -903,6 +996,11 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
         image.Rescale(x,y);
         bitmap = wxBitmap( image );
     }
+    if ( !renderDrop )
+    {
+        // Trim the edge where the arrow would have gone
+        bitmap = bitmap.GetSubBitmap(wxRect(0,0, y,y));
+    }
 
     return bitmap;
 }
@@ -910,7 +1008,7 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
 wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y )
 {
     wxColour bg = GetBackgroundColour();
-    wxColour fg = GetForegroundColour();
+    wxColour fg = wxStepColour(GetForegroundColour(), LIGHT_STEP);
 
     //===============================================================================
     // begin drawing code
index 223ed8fcb137d013fc56cf9abd807aeb745f707c..3fcb8d7d6686bdb05336d56939c70c94efa45c85 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 );
 
@@ -167,6 +171,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
 
 // ============================================================================
@@ -351,6 +377,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 );
index 14c31478466cc7a0775bedd2e7acbb120458b5b0..231bb6a0829c3a7dd30df1f88fe175a6e66bd4cf 100644 (file)
@@ -31,6 +31,8 @@
         *wxFileHistory*etBaseId*;
         *wxSizerFlags*Shaped*;
         *wxSizerFlags*FixedMinSize*;
+       *wxSearchCtrl*SetDescriptiveText*;
+       *wxSearchCtrl*GetDescriptiveText*;
 };
 
 # public symbols added in 2.8.1 (please keep in alphabetical order):
index 1449811f1507eb5c000e251069a271d6f40986f9..894b8a49a6352f836e659e9cc5573ff3bd4f24df 100644 (file)
@@ -58,6 +58,9 @@ public:
 
     virtual void ShowCancelButton( bool ) {}
     virtual bool IsCancelButtonVisible() const { return false; }
+
+    virtual void SetDescriptiveText(const wxString& text);
+    virtual wxString GetDescriptiveText() const;
 };    
 #endif
 %}
@@ -167,6 +170,17 @@ button visibility value.  This always returns false in Mac OS X v10.3", "");
         "Indicates whether the cancel button is visible. ", "");
     
 
+    DocDeclStr(
+        virtual void , SetDescriptiveText(const wxString& text),
+        "Set the text to be displayed when the user has not yet typed anything
+in the control.", "");
+    
+    DocDeclStr(
+        virtual wxString , GetDescriptiveText() const,
+        "Get the text to be displayed when the user has not yet typed anything
+in the control.", "");
+    
+    
     DocStr(SetSearchBitmap,
            "Sets the bitmap to use for the search button.  This currently does not
 work on the Mac.", "");
@@ -177,6 +191,7 @@ on the Mac.", "");
     DocStr(SetCancelBitmap,
            "Sets the bitmap to use for the cancel button.  This currently does not
 work on the Mac.", "");
+
     
 #ifdef __WXMAC__
     %extend {
@@ -194,6 +209,7 @@ work on the Mac.", "");
     %property(Menu, GetMenu, SetMenu);
     %property(SearchButtonVisible, IsSearchButtonVisible, ShowSearchButton);
     %property(CancelButtonVisible, IsCancelButtonVisible, ShowCancelButton);
+    %property(DescriptiveText, GetDescriptiveText, SetDescriptiveText);
 };
      
 
index f1a81dc24b449c23f7b6711fd895ba4d4af69962..233923129cdf4ea4941fe8f08032edd48f4e6785 100644 (file)
@@ -7268,6 +7268,24 @@ class SearchCtrl(TextCtrl):
         """
         return _controls_.SearchCtrl_IsCancelButtonVisible(*args, **kwargs)
 
+    def SetDescriptiveText(*args, **kwargs):
+        """
+        SetDescriptiveText(self, String text)
+
+        Set the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_SetDescriptiveText(*args, **kwargs)
+
+    def GetDescriptiveText(*args, **kwargs):
+        """
+        GetDescriptiveText(self) -> String
+
+        Get the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_GetDescriptiveText(*args, **kwargs)
+
     def SetSearchBitmap(*args, **kwargs):
         """
         SetSearchBitmap(self, Bitmap bitmap)
@@ -7299,6 +7317,7 @@ class SearchCtrl(TextCtrl):
     Menu = property(GetMenu,SetMenu) 
     SearchButtonVisible = property(IsSearchButtonVisible,ShowSearchButton) 
     CancelButtonVisible = property(IsCancelButtonVisible,ShowCancelButton) 
+    DescriptiveText = property(GetDescriptiveText,SetDescriptiveText) 
 _controls_.SearchCtrl_swigregister(SearchCtrl)
 SearchCtrlNameStr = cvar.SearchCtrlNameStr
 
index e0479c2ba98c4f5c4fa68f465ca5b264640250a4..889e70551b642d1ced29423e55b4f162af7ea9d9 100644 (file)
@@ -3419,6 +3419,9 @@ public:
 
     virtual void ShowCancelButton( bool ) {}
     virtual bool IsCancelButtonVisible() const { return false; }
+
+    virtual void SetDescriptiveText(const wxString& text);
+    virtual wxString GetDescriptiveText() const;
 };    
 #endif
 
@@ -46659,6 +46662,85 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_SearchCtrl_SetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool temp2 = false ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "text", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SearchCtrl_SetDescriptiveText",kwnames,&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_SetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    arg2 = wxString_in_helper(obj1);
+    if (arg2 == NULL) SWIG_fail;
+    temp2 = true;
+  }
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    (arg1)->SetDescriptiveText((wxString const &)*arg2);
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  resultobj = SWIG_Py_Void();
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return resultobj;
+fail:
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_SearchCtrl_GetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject *swig_obj[1] ;
+  
+  if (!args) SWIG_fail;
+  swig_obj[0] = args;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_GetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl const *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    result = ((wxSearchCtrl const *)arg1)->GetDescriptiveText();
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  {
+#if wxUSE_UNICODE
+    resultobj = PyUnicode_FromWideChar((&result)->c_str(), (&result)->Len());
+#else
+    resultobj = PyString_FromStringAndSize((&result)->c_str(), (&result)->Len());
+#endif
+  }
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_SearchCtrl_SetSearchBitmap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
@@ -47863,6 +47945,8 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"SearchCtrl_IsSearchButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsSearchButtonVisible, METH_O, NULL},
         { (char *)"SearchCtrl_ShowCancelButton", (PyCFunction) _wrap_SearchCtrl_ShowCancelButton, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_IsCancelButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsCancelButtonVisible, METH_O, NULL},
+        { (char *)"SearchCtrl_SetDescriptiveText", (PyCFunction) _wrap_SearchCtrl_SetDescriptiveText, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"SearchCtrl_GetDescriptiveText", (PyCFunction)_wrap_SearchCtrl_GetDescriptiveText, METH_O, NULL},
         { (char *)"SearchCtrl_SetSearchBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetSearchMenuBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchMenuBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetCancelBitmap", (PyCFunction) _wrap_SearchCtrl_SetCancelBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
index cb9f2787a6ce4d117f21aae2293ba24b7b388f21..09eaac9f35953977d180cea959e21e4c53771130 100644 (file)
@@ -7261,6 +7261,24 @@ class SearchCtrl(TextCtrl):
         """
         return _controls_.SearchCtrl_IsCancelButtonVisible(*args, **kwargs)
 
+    def SetDescriptiveText(*args, **kwargs):
+        """
+        SetDescriptiveText(self, String text)
+
+        Set the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_SetDescriptiveText(*args, **kwargs)
+
+    def GetDescriptiveText(*args, **kwargs):
+        """
+        GetDescriptiveText(self) -> String
+
+        Set the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_GetDescriptiveText(*args, **kwargs)
+
     def SetSearchBitmap(*args, **kwargs):
         """
         SetSearchBitmap(self, Bitmap ?)
@@ -7292,6 +7310,7 @@ class SearchCtrl(TextCtrl):
     Menu = property(GetMenu,SetMenu) 
     SearchButtonVisible = property(IsSearchButtonVisible,ShowSearchButton) 
     CancelButtonVisible = property(IsCancelButtonVisible,ShowCancelButton) 
+    DescriptiveText = property(GetDescriptiveText,SetDescriptiveText) 
 _controls_.SearchCtrl_swigregister(SearchCtrl)
 SearchCtrlNameStr = cvar.SearchCtrlNameStr
 
index 7a5869366963fa59cc6ee1669e58aa06016381e2..556a522a73254d767e3495d60b1c6bbf47cdeb4c 100644 (file)
@@ -3418,6 +3418,9 @@ public:
 
     virtual void ShowCancelButton( bool ) {}
     virtual bool IsCancelButtonVisible() const { return false; }
+
+    virtual void SetDescriptiveText(const wxString& text);
+    virtual wxString GetDescriptiveText() const;
 };    
 #endif
 
@@ -46586,6 +46589,85 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_SearchCtrl_SetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool temp2 = false ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "text", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SearchCtrl_SetDescriptiveText",kwnames,&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_SetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    arg2 = wxString_in_helper(obj1);
+    if (arg2 == NULL) SWIG_fail;
+    temp2 = true;
+  }
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    (arg1)->SetDescriptiveText((wxString const &)*arg2);
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  resultobj = SWIG_Py_Void();
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return resultobj;
+fail:
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_SearchCtrl_GetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject *swig_obj[1] ;
+  
+  if (!args) SWIG_fail;
+  swig_obj[0] = args;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_GetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl const *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    result = ((wxSearchCtrl const *)arg1)->GetDescriptiveText();
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  {
+#if wxUSE_UNICODE
+    resultobj = PyUnicode_FromWideChar((&result)->c_str(), (&result)->Len());
+#else
+    resultobj = PyString_FromStringAndSize((&result)->c_str(), (&result)->Len());
+#endif
+  }
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_SearchCtrl_SetSearchBitmap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
@@ -47788,6 +47870,8 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"SearchCtrl_IsSearchButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsSearchButtonVisible, METH_O, NULL},
         { (char *)"SearchCtrl_ShowCancelButton", (PyCFunction) _wrap_SearchCtrl_ShowCancelButton, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_IsCancelButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsCancelButtonVisible, METH_O, NULL},
+        { (char *)"SearchCtrl_SetDescriptiveText", (PyCFunction) _wrap_SearchCtrl_SetDescriptiveText, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"SearchCtrl_GetDescriptiveText", (PyCFunction)_wrap_SearchCtrl_GetDescriptiveText, METH_O, NULL},
         { (char *)"SearchCtrl_SetSearchBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetSearchMenuBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchMenuBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetCancelBitmap", (PyCFunction) _wrap_SearchCtrl_SetCancelBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
index 6fd0cbd7df1f84fa76a94b56bd8e6c5082da5ad1..c9408dd9c5a6b70354344f1d42e3a7ba7244a5b3 100644 (file)
@@ -7287,6 +7287,24 @@ class SearchCtrl(TextCtrl):
         """
         return _controls_.SearchCtrl_IsCancelButtonVisible(*args, **kwargs)
 
+    def SetDescriptiveText(*args, **kwargs):
+        """
+        SetDescriptiveText(self, String text)
+
+        Set the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_SetDescriptiveText(*args, **kwargs)
+
+    def GetDescriptiveText(*args, **kwargs):
+        """
+        GetDescriptiveText(self) -> String
+
+        Get the text to be displayed when the user has not yet typed anything
+        in the control.
+        """
+        return _controls_.SearchCtrl_GetDescriptiveText(*args, **kwargs)
+
     def SetSearchBitmap(*args, **kwargs):
         """
         SetSearchBitmap(self, Bitmap bitmap)
@@ -7318,6 +7336,7 @@ class SearchCtrl(TextCtrl):
     Menu = property(GetMenu,SetMenu) 
     SearchButtonVisible = property(IsSearchButtonVisible,ShowSearchButton) 
     CancelButtonVisible = property(IsCancelButtonVisible,ShowCancelButton) 
+    DescriptiveText = property(GetDescriptiveText,SetDescriptiveText) 
 _controls_.SearchCtrl_swigregister(SearchCtrl)
 SearchCtrlNameStr = cvar.SearchCtrlNameStr
 
index fe413e81790331774633816981e5c0d5834fcd08..0b2dc3130a6a220f1197ef1248d397739d20eb38 100644 (file)
@@ -3419,6 +3419,9 @@ public:
 
     virtual void ShowCancelButton( bool ) {}
     virtual bool IsCancelButtonVisible() const { return false; }
+
+    virtual void SetDescriptiveText(const wxString& text);
+    virtual wxString GetDescriptiveText() const;
 };    
 #endif
 
@@ -46871,6 +46874,85 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_SearchCtrl_SetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool temp2 = false ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "text", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SearchCtrl_SetDescriptiveText",kwnames,&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_SetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    arg2 = wxString_in_helper(obj1);
+    if (arg2 == NULL) SWIG_fail;
+    temp2 = true;
+  }
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    (arg1)->SetDescriptiveText((wxString const &)*arg2);
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  resultobj = SWIG_Py_Void();
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return resultobj;
+fail:
+  {
+    if (temp2)
+    delete arg2;
+  }
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_SearchCtrl_GetDescriptiveText(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
+  wxString result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject *swig_obj[1] ;
+  
+  if (!args) SWIG_fail;
+  swig_obj[0] = args;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_wxSearchCtrl, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SearchCtrl_GetDescriptiveText" "', expected argument " "1"" of type '" "wxSearchCtrl const *""'"); 
+  }
+  arg1 = reinterpret_cast< wxSearchCtrl * >(argp1);
+  {
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    result = ((wxSearchCtrl const *)arg1)->GetDescriptiveText();
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) SWIG_fail;
+  }
+  {
+#if wxUSE_UNICODE
+    resultobj = PyUnicode_FromWideChar((&result)->c_str(), (&result)->Len());
+#else
+    resultobj = PyString_FromStringAndSize((&result)->c_str(), (&result)->Len());
+#endif
+  }
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_SearchCtrl_SetSearchBitmap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   wxSearchCtrl *arg1 = (wxSearchCtrl *) 0 ;
@@ -48080,6 +48162,8 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"SearchCtrl_IsSearchButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsSearchButtonVisible, METH_O, NULL},
         { (char *)"SearchCtrl_ShowCancelButton", (PyCFunction) _wrap_SearchCtrl_ShowCancelButton, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_IsCancelButtonVisible", (PyCFunction)_wrap_SearchCtrl_IsCancelButtonVisible, METH_O, NULL},
+        { (char *)"SearchCtrl_SetDescriptiveText", (PyCFunction) _wrap_SearchCtrl_SetDescriptiveText, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"SearchCtrl_GetDescriptiveText", (PyCFunction)_wrap_SearchCtrl_GetDescriptiveText, METH_O, NULL},
         { (char *)"SearchCtrl_SetSearchBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetSearchMenuBitmap", (PyCFunction) _wrap_SearchCtrl_SetSearchMenuBitmap, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"SearchCtrl_SetCancelBitmap", (PyCFunction) _wrap_SearchCtrl_SetCancelBitmap, METH_VARARGS | METH_KEYWORDS, NULL},