From c63312c472c83be6d3b935f0ceeef484a7d611ce Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Oct 2006 16:04:27 +0000 Subject: [PATCH] GetCurrentSelection() was documented but not present in all ports (just MSW and GTK); moved it to the base classes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/combobox.tex | 10 ++++++++++ include/wx/choice.h | 10 ++++++++-- include/wx/combobox.h | 4 ++++ include/wx/gtk/choice.h | 1 - include/wx/gtk1/choice.h | 1 - include/wx/mac/carbon/choice.h | 1 - include/wx/mac/carbon/combobox.h | 1 - include/wx/os2/choice.h | 1 - 8 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/latex/wx/combobox.tex b/docs/latex/wx/combobox.tex index 76f9c15324..2ffe9b4427 100644 --- a/docs/latex/wx/combobox.tex +++ b/docs/latex/wx/combobox.tex @@ -191,6 +191,16 @@ Copies the selected text to the clipboard. Copies the selected text to the clipboard and removes the selection. +\membersection{wxComboBox::GetCurrentSelection}\label{wxcomboboxgetcurrentselection} + +\constfunc{int}{GetCurrentSelection}{\void} + +This function does the same things as +\helpref{wxChoice::GetCurrentSelection}{wxchoicegetcurrentselection} and +returns the item currently selected in the dropdown list if it's open or the +same thing as \helpref{GetSelection}{wxcontrolwithitemsgetselection} otherwise. + + \membersection{wxComboBox::GetInsertionPoint}\label{wxcomboboxgetinsertionpoint} \constfunc{long}{GetInsertionPoint}{\void} diff --git a/include/wx/choice.h b/include/wx/choice.h index 63f3267936..16017f87ec 100644 --- a/include/wx/choice.h +++ b/include/wx/choice.h @@ -40,6 +40,13 @@ public: // all generic methods are in wxControlWithItems + // get the current selection: this can only be different from the normal + // selection if the popup items list is currently opened and the user + // selected some item in it but didn't close the list yet; otherwise (and + // currently always on platforms other than MSW) this is the same as + // GetSelection() + virtual int GetCurrentSelection() const { return GetSelection(); } + // set/get the number of columns in the control (as they're not supported on // most platforms, they do nothing by default) virtual void SetColumns(int WXUNUSED(n) = 1 ) { } @@ -78,5 +85,4 @@ private: #endif // wxUSE_CHOICE -#endif - // _WX_CHOICE_H_BASE_ +#endif // _WX_CHOICE_H_BASE_ diff --git a/include/wx/combobox.h b/include/wx/combobox.h index 6b361163ea..cd19a9a503 100644 --- a/include/wx/combobox.h +++ b/include/wx/combobox.h @@ -59,6 +59,10 @@ public: virtual bool CanUndo() const = 0; virtual bool CanRedo() const = 0; + // may return value different from GetSelection() when the combobox + // dropdown is shown and the user selected, but not yet accepted, a value + // different from the old one in it + virtual int GetCurrentSelection() const { return GetSelection(); } // redeclare inherited SetSelection() overload here as well to avoid // virtual function hiding diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index 172fb049d8..a61d876403 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -66,7 +66,6 @@ public: void Clear(); int GetSelection() const; - int GetCurrentSelection() const { return GetSelection(); } void SetSelection(int n); virtual unsigned int GetCount() const; diff --git a/include/wx/gtk1/choice.h b/include/wx/gtk1/choice.h index 01539cbf10..9d80932e74 100644 --- a/include/wx/gtk1/choice.h +++ b/include/wx/gtk1/choice.h @@ -66,7 +66,6 @@ public: void Clear(); int GetSelection() const; - int GetCurrentSelection() const { return GetSelection(); } virtual void SetSelection(int n); virtual unsigned int GetCount() const; diff --git a/include/wx/mac/carbon/choice.h b/include/wx/mac/carbon/choice.h index aa7fd46ac3..57f765da1b 100644 --- a/include/wx/mac/carbon/choice.h +++ b/include/wx/mac/carbon/choice.h @@ -75,7 +75,6 @@ public: virtual unsigned int GetCount() const ; virtual int GetSelection() const ; virtual void SetSelection(int n); - int GetCurrentSelection() const { return GetSelection(); } virtual int FindString(const wxString& s, bool bCase = false) const; virtual wxString GetString(unsigned int n) const ; diff --git a/include/wx/mac/carbon/combobox.h b/include/wx/mac/carbon/combobox.h index 1622c07a18..446b4b14a5 100644 --- a/include/wx/mac/carbon/combobox.h +++ b/include/wx/mac/carbon/combobox.h @@ -89,7 +89,6 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase virtual void Clear(); virtual int GetSelection() const; - int GetCurrentSelection() const { return GetSelection(); } virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; virtual wxString GetString(unsigned int n) const; diff --git a/include/wx/os2/choice.h b/include/wx/os2/choice.h index 1dbff3e6a6..8054f22344 100644 --- a/include/wx/os2/choice.h +++ b/include/wx/os2/choice.h @@ -98,7 +98,6 @@ public: virtual unsigned int GetCount() const; virtual int GetSelection(void) const; - virtual int GetCurrentSelection(void) const { return GetSelection(); } virtual void SetSelection(int n); virtual wxString GetString(unsigned int n) const; -- 2.47.2