]> git.saurik.com Git - wxWidgets.git/commitdiff
removed multiple duplicate copies (with subtly different behaviour) of SetStringSelec...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Feb 2005 16:29:31 +0000 (16:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Feb 2005 16:29:31 +0000 (16:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
docs/latex/wx/ctrlsub.tex
include/wx/choice.h
include/wx/cocoa/combobox.h
include/wx/ctrlsub.h
include/wx/gtk/combobox.h
include/wx/gtk1/combobox.h
include/wx/mac/carbon/combobox.h
include/wx/mac/classic/combobox.h
include/wx/univ/combobox.h
src/cocoa/combobox.mm
src/common/choiccmn.cpp
src/common/ctrlsub.cpp
src/gtk/combobox.cpp
src/gtk1/combobox.cpp
src/mac/carbon/combobox.cpp
src/mac/carbon/combobxc.cpp
src/mac/classic/combobox.cpp

index fe7dbbf5fe50e3f119ad9ece7c658df72c9eda60..08488430585aa7e87217640f07a6bfb87e3e13c7 100644 (file)
@@ -337,7 +337,7 @@ Sets the label for the given item.
 
 \membersection{wxControlWithItems::SetStringSelection}\label{wxcontrolwithitemssetstringselection}
 
 
 \membersection{wxControlWithItems::SetStringSelection}\label{wxcontrolwithitemssetstringselection}
 
-\func{void}{SetStringSelection}{\param{const wxString\& }{ string}}
+\func{bool}{SetStringSelection}{\param{const wxString\& }{ string}}
 
 Selects the item with the specified string in the control. This doesn't cause
 any command events being emitted.
 
 Selects the item with the specified string in the control. This doesn't cause
 any command events being emitted.
@@ -346,6 +346,11 @@ any command events being emitted.
 
 \docparam{string}{The string to select.}
 
 
 \docparam{string}{The string to select.}
 
+\wxheading{Return value}
+
+\true if the specified string has been selected, \false if it wasn't found in
+the control.
+
 \wxheading{See also}
 
 \helpref{SetSelection}{wxcontrolwithitemssetselection}
 \wxheading{See also}
 
 \helpref{SetSelection}{wxcontrolwithitemssetselection}
index 47f742605189e407c79859b42c13882a4ee48db2..12bf96c6e06917a16bd4ce6a4930f84a9c69eb6e 100644 (file)
@@ -44,7 +44,6 @@ public:
 
     // single selection logic
     virtual void SetSelection(int n) = 0;
 
     // single selection logic
     virtual void SetSelection(int n) = 0;
-    virtual bool SetStringSelection(const wxString& s);
 
     // don't override this
     virtual void Select(int n) { SetSelection(n); }
 
     // don't override this
     virtual void Select(int n) { SetSelection(n); }
index 4db5e4499854d39f1cc47f7c115de99776f22cf0..b9679a6f0b0e9a21e60bee4f37d1fc9a3542e9c1 100644 (file)
@@ -81,8 +81,6 @@ public:
     virtual void SetSelection(int);
     // Overlapping methods
     virtual wxString GetStringSelection();
     virtual void SetSelection(int);
     // Overlapping methods
     virtual wxString GetStringSelection();
-    // other methods
-    virtual void SetStringSelection(const wxString& selection);
     // wxItemContainer
     virtual void Clear();
     virtual void Delete(int);
     // wxItemContainer
     virtual void Clear();
     virtual void Delete(int);
index dbf7e9884bf4d756bceb9ce1ae4cca01bf9b8fdb..56fd1750cc65a37e2c8124516592fb553d8fd2ae 100644 (file)
@@ -46,7 +46,7 @@ public:
 
     // only for rtti needs (separate name)
     void AppendString( const wxString& item)
 
     // only for rtti needs (separate name)
     void AppendString( const wxString& item)
-    { Append( item ) ; }
+        { Append( item ); }
 
     // append several items at once to the control
     void Append(const wxArrayString& strings);
 
     // append several items at once to the control
     void Append(const wxArrayString& strings);
@@ -79,6 +79,10 @@ public:
     virtual void Select(int n) = 0;
     virtual int GetSelection() const = 0;
 
     virtual void Select(int n) = 0;
     virtual int GetSelection() const = 0;
 
+    // set selection to the specified string, return false if not found
+    bool SetStringSelection(const wxString& s);
+
+    // return the selected string or empty string if none
     wxString GetStringSelection() const;
 
     // misc
     wxString GetStringSelection() const;
 
     // misc
index 6bfc5cf1a3d428aa9c7cc292dcfcf8e877d254f4..6c73810879f814a175d720fb0584692b08966317 100644 (file)
@@ -96,7 +96,6 @@ public:
     int Number() const { return GetCount(); }
     void SetSelection( int n );
     void Select( int n ) { return SetSelection( n ); }
     int Number() const { return GetCount(); }
     void SetSelection( int n );
     void Select( int n ) { return SetSelection( n ); }
-    bool SetStringSelection( const wxString &string );
     void SetString(int n, const wxString &text);
 
     wxString GetValue() const;
     void SetString(int n, const wxString &text);
 
     wxString GetValue() const;
index 6bfc5cf1a3d428aa9c7cc292dcfcf8e877d254f4..6c73810879f814a175d720fb0584692b08966317 100644 (file)
@@ -96,7 +96,6 @@ public:
     int Number() const { return GetCount(); }
     void SetSelection( int n );
     void Select( int n ) { return SetSelection( n ); }
     int Number() const { return GetCount(); }
     void SetSelection( int n );
     void Select( int n ) { return SetSelection( n ); }
-    bool SetStringSelection( const wxString &string );
     void SetString(int n, const wxString &text);
 
     wxString GetValue() const;
     void SetString(int n, const wxString &text);
 
     wxString GetValue() const;
index b72509253d8ddf5fd55e2bb9b93b707220cbf037..34e982c20b6aa5799a84a87a642350ef3ef9dfee 100644 (file)
@@ -97,7 +97,6 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
     virtual wxString GetString(int n) const ;
     virtual wxString GetStringSelection() const ;
     virtual void SetString(int n, const wxString& s) ;
     virtual wxString GetString(int n) const ;
     virtual wxString GetStringSelection() const ;
     virtual void SetString(int n, const wxString& s) ;
-    virtual bool SetStringSelection(const wxString& sel);
 
     // Text field functions
     virtual wxString GetValue() const ;
 
     // Text field functions
     virtual wxString GetValue() const ;
index b59bce7a64da6efb4f7f56900094ae8c1e46a7a0..f97c8a627f26c83ac08d4ef034ed3efe8debc20c 100644 (file)
@@ -92,7 +92,6 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
     virtual wxString GetString(int n) const ;
     virtual wxString GetStringSelection() const ;
     virtual void SetString(int n, const wxString& s) ;
     virtual wxString GetString(int n) const ;
     virtual wxString GetStringSelection() const ;
     virtual void SetString(int n, const wxString& s) ;
-    virtual bool SetStringSelection(const wxString& sel);
 
     // Text field functions
     virtual wxString GetValue() const ;
 
     // Text field functions
     virtual wxString GetValue() const ;
index 32f2881cad606ddc098e56beef2cb414b5bff6e9..51012743f16261485fe84b47fcf176210a0693d1 100644 (file)
@@ -305,8 +305,6 @@ public:
     virtual int GetSelection() const;
     void SetSelection(int n) { Select(n); }
 
     virtual int GetSelection() const;
     void SetSelection(int n) { Select(n); }
 
-    void SetStringSelection(const wxString& WXUNUSED(s)) {  }
-
     wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
 
 protected:
     wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
 
 protected:
index e016e8920556576e4be1b342c9731051dca0dfbb..86ce625c2eef8246f7dde155cea449107cb6ca42 100644 (file)
@@ -80,10 +80,6 @@ wxString wxComboBox::GetStringSelection()
     return wxEmptyString;
 }
 
     return wxEmptyString;
 }
 
-void wxComboBox::SetStringSelection(const wxString& selection)
-{
-}
-
 void wxComboBox::Clear()
 {
 }
 void wxComboBox::Clear()
 {
 }
@@ -108,7 +104,7 @@ void wxComboBox::SetString(int, const wxString&)
 
 int wxComboBox::FindString(const wxString&) const
 {
 
 int wxComboBox::FindString(const wxString&) const
 {
-    return 0;
+    return wxNOT_FOUND;
 }
 
 int wxComboBox::GetSelection() const
 }
 
 int wxComboBox::GetSelection() const
index d090aafd74983c17f998dd4f2dd0ef1cdc4accb0..50c633894e9a6f670aa8ff959d791ad77e1fac7e 100644 (file)
@@ -43,21 +43,6 @@ wxChoiceBase::~wxChoiceBase()
     // this destructor is required for Darwin
 }
 
     // this destructor is required for Darwin
 }
 
-// ----------------------------------------------------------------------------
-// selection
-// ----------------------------------------------------------------------------
-
-bool wxChoiceBase::SetStringSelection(const wxString& s)
-{
-    int sel = FindString(s);
-    wxCHECK_MSG( sel != -1, false,
-                 wxT("invalid string in wxChoice::SetStringSelection") );
-
-    Select(sel);
-
-    return true;
-}
-
 // ----------------------------------------------------------------------------
 // misc
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // misc
 // ----------------------------------------------------------------------------
index cf913548e08ba71cc9b73aa6aa125d357e671d6c..59a9c9832bee0fd13f9dd20534857d9de93ec31b 100644 (file)
@@ -58,6 +58,17 @@ wxString wxItemContainer::GetStringSelection() const
     return s;
 }
 
     return s;
 }
 
+bool wxItemContainer::SetStringSelection(const wxString& s)
+{
+    const int sel = FindString(s);
+    if ( sel == wxNOT_FOUND )
+        return false;
+
+    Select(sel);
+
+    return true;
+}
+
 wxArrayString wxItemContainer::GetStrings() const
 {
     wxArrayString result ;
 wxArrayString wxItemContainer::GetStrings() const
 {
     wxArrayString result ;
index e5dd27f1eac368d4c43c9c6770cc5aac16303682..0e16d9ae26ed136c1314a8421dfd51acfc30fd9b 100644 (file)
@@ -644,16 +644,6 @@ void wxComboBox::SetSelection( int n )
     EnableEvents();
 }
 
     EnableEvents();
 }
 
-bool wxComboBox::SetStringSelection( const wxString &string )
-{
-    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid combobox") );
-
-    int res = FindString( string );
-    if (res == -1) return false;
-    SetSelection( res );
-    return true;
-}
-
 wxString wxComboBox::GetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
 wxString wxComboBox::GetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
index e5dd27f1eac368d4c43c9c6770cc5aac16303682..0e16d9ae26ed136c1314a8421dfd51acfc30fd9b 100644 (file)
@@ -644,16 +644,6 @@ void wxComboBox::SetSelection( int n )
     EnableEvents();
 }
 
     EnableEvents();
 }
 
-bool wxComboBox::SetStringSelection( const wxString &string )
-{
-    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid combobox") );
-
-    int res = FindString( string );
-    if (res == -1) return false;
-    SetSelection( res );
-    return true;
-}
-
 wxString wxComboBox::GetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
 wxString wxComboBox::GetValue() const
 {
     GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
index 7e6da680cf93c366b134af6a71f7d5c1b0908c6f..7e83e671aad3c67c307385f36ed3c8f04836bf05 100644 (file)
@@ -565,18 +565,6 @@ wxString wxComboBox::GetStringSelection() const
         return wxEmptyString;
 }
 
         return wxEmptyString;
 }
 
-bool wxComboBox::SetStringSelection(const wxString& sel)
-{
-    int s = FindString (sel);
-    if (s > -1)
-        {
-            SetSelection (s);
-            return true;
-        }
-    else
-        return false;
-}
-
 void wxComboBox::SetString(int n, const wxString& s)
 {
     m_choice->SetString( n , s ) ;
 void wxComboBox::SetString(int n, const wxString& s)
 {
     m_choice->SetString( n , s ) ;
index fcbdd47b6b1bd8b4bcfdc0a6c034ef8c399deafa..59c2d1db3bd7020c628d5b263a08043f2b63ea30 100644 (file)
@@ -721,18 +721,6 @@ wxString wxComboBox::GetStringSelection() const
 #endif
 }
 
 #endif
 }
 
-bool wxComboBox::SetStringSelection(const wxString& sel)
-{
-    int s = FindString (sel);
-    if (s > -1)
-        {
-            SetSelection (s);
-            return true;
-        }
-    else
-        return false;
-}
-
 void wxComboBox::SetString(int n, const wxString& s)
 {
 #if USE_HICOMBOBOX
 void wxComboBox::SetString(int n, const wxString& s)
 {
 #if USE_HICOMBOBOX
index 4991d4587cd9cbaea713b9084f6d02813455ed05..8562e17e72626ddd238c67a3fa3d1ba43a97c5c3 100644 (file)
@@ -511,18 +511,6 @@ wxString wxComboBox::GetStringSelection() const
         return wxEmptyString;
 }
 
         return wxEmptyString;
 }
 
-bool wxComboBox::SetStringSelection(const wxString& sel)
-{
-    int s = FindString (sel);
-    if (s > -1)
-        {
-            SetSelection (s);
-            return true;
-        }
-    else
-        return false;
-}
-
 void wxComboBox::SetString(int n, const wxString& s)
 {
     m_choice->SetString( n , s ) ;
 void wxComboBox::SetString(int n, const wxString& s)
 {
     m_choice->SetString( n , s ) ;