git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32000
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
17 files changed:
\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.
\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}
// 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); }
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);
// only for rtti needs (separate name)
void AppendString( const wxString& item)
// only for rtti needs (separate name)
void AppendString( const wxString& 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);
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
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;
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;
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 ;
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 ;
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:
-void wxComboBox::SetStringSelection(const wxString& selection)
-{
-}
-
void wxComboBox::Clear()
{
}
void wxComboBox::Clear()
{
}
int wxComboBox::FindString(const wxString&) const
{
int wxComboBox::FindString(const wxString&) const
{
}
int wxComboBox::GetSelection() const
}
int wxComboBox::GetSelection() const
// 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
// ----------------------------------------------------------------------------
+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 ;
-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 );
-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 );
-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 ) ;
-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
-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 ) ;