removed multiple duplicate copies (with subtly different behaviour) of SetStringSelection(); left only one of them in wxItemContainer (and another one in wxRadioBoxBase, to be removed)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-02-13 16:29:31 +00:00
parent 7f461f8a05
commit 64fa6f167e
17 changed files with 23 additions and 87 deletions

View File

@ -337,7 +337,7 @@ Sets the label for the given item.
\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.
@ -346,6 +346,11 @@ any command events being emitted.
\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}

View File

@ -44,7 +44,6 @@ public:
// 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); }

View File

@ -81,8 +81,6 @@ public:
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);

View File

@ -46,7 +46,7 @@ public:
// 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);
@ -79,6 +79,10 @@ public:
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

View File

@ -96,7 +96,6 @@ public:
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;

View File

@ -96,7 +96,6 @@ public:
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;

View 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 bool SetStringSelection(const wxString& sel);
// Text field functions
virtual wxString GetValue() const ;

View 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 bool SetStringSelection(const wxString& sel);
// Text field functions
virtual wxString GetValue() const ;

View File

@ -305,8 +305,6 @@ public:
virtual int GetSelection() const;
void SetSelection(int n) { Select(n); }
void SetStringSelection(const wxString& WXUNUSED(s)) { }
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
protected:

View File

@ -80,10 +80,6 @@ wxString wxComboBox::GetStringSelection()
return wxEmptyString;
}
void wxComboBox::SetStringSelection(const wxString& selection)
{
}
void wxComboBox::Clear()
{
}
@ -108,7 +104,7 @@ void wxComboBox::SetString(int, const wxString&)
int wxComboBox::FindString(const wxString&) const
{
return 0;
return wxNOT_FOUND;
}
int wxComboBox::GetSelection() const

View File

@ -43,21 +43,6 @@ wxChoiceBase::~wxChoiceBase()
// 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
// ----------------------------------------------------------------------------

View File

@ -58,6 +58,17 @@ wxString wxItemContainer::GetStringSelection() const
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 ;

View File

@ -644,16 +644,6 @@ void wxComboBox::SetSelection( int n )
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 );

View File

@ -644,16 +644,6 @@ void wxComboBox::SetSelection( int n )
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 );

View File

@ -565,18 +565,6 @@ wxString wxComboBox::GetStringSelection() const
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 ) ;

View File

@ -721,18 +721,6 @@ wxString wxComboBox::GetStringSelection() const
#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

View File

@ -511,18 +511,6 @@ wxString wxComboBox::GetStringSelection() const
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 ) ;