From 7fe7ebd5e41be2effb4247deab7cd7df9c66944b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Nov 2020 13:12:37 +0100 Subject: [PATCH] Fix problems with GetSelection() documentation Move wxListBox-specific part to wxListBox documentation, it doesn't apply to the other controls, such as wxRadioBox. Also improve the documentation of wxRadioBox::GetSelection() to mention that it always returns a valid value. Closes #18968. --- interface/wx/ctrlsub.h | 4 ---- interface/wx/listbox.h | 12 ++++++++++++ interface/wx/radiobox.h | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/interface/wx/ctrlsub.h b/interface/wx/ctrlsub.h index a9582e7b10..68fb7f8980 100644 --- a/interface/wx/ctrlsub.h +++ b/interface/wx/ctrlsub.h @@ -113,10 +113,6 @@ public: @return The position of the current selection. - @remarks This method can be used with single selection list boxes only, - you should use wxListBox::GetSelections() for the list - boxes with wxLB_MULTIPLE style. - @see SetSelection(), GetStringSelection() */ virtual int GetSelection() const = 0; diff --git a/interface/wx/listbox.h b/interface/wx/listbox.h index 5239107ff9..ee0467d371 100644 --- a/interface/wx/listbox.h +++ b/interface/wx/listbox.h @@ -174,6 +174,18 @@ public: virtual void SetSelection(int n); + /** + Returns the index of the selected item or @c wxNOT_FOUND if no item is + selected. + + @return The position of the current selection. + + @remarks This method can be used with single selection list boxes only, + you must use wxListBox::GetSelections() for the list + boxes with wxLB_MULTIPLE style. + + @see SetSelection(), GetStringSelection() + */ virtual int GetSelection() const; virtual bool SetStringSelection(const wxString& s, bool select); diff --git a/interface/wx/radiobox.h b/interface/wx/radiobox.h index 7f0fa4ea03..37d2de7a77 100644 --- a/interface/wx/radiobox.h +++ b/interface/wx/radiobox.h @@ -317,6 +317,13 @@ public: virtual unsigned int GetCount() const; virtual wxString GetString(unsigned int n) const; virtual void SetString(unsigned int n, const wxString& string); + + /** + Returns the index of the selected item. + + As radio boxes always have a selected item, the return value is never + @c wxNOT_FOUND for this class. + */ virtual int GetSelection() const; };