diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index bcb589ef15..8f3e5ecc92 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -60,6 +60,7 @@ public: virtual ~wxSpinCtrlGenericBase(); // accessors + virtual wxString GetTextValue() const wxOVERRIDE; // T GetValue() const // T GetMin() const // T GetMax() const diff --git a/include/wx/gtk/spinctrl.h b/include/wx/gtk/spinctrl.h index 0db4cb0b39..b3db6befcd 100644 --- a/include/wx/gtk/spinctrl.h +++ b/include/wx/gtk/spinctrl.h @@ -35,6 +35,7 @@ public: // wxSpinCtrl(Double) methods call DoXXX functions of the same name // accessors + virtual wxString GetTextValue() const wxOVERRIDE; // T GetValue() const // T GetMin() const // T GetMax() const diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 491d9d99bd..b222089165 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -62,6 +62,7 @@ public: void SetSelection(long from, long to); // wxSpinCtrlBase methods + virtual wxString GetTextValue() const; virtual int GetBase() const; virtual bool SetBase(int base); diff --git a/include/wx/spinctrl.h b/include/wx/spinctrl.h index 775672f97b..3c49cb6f31 100644 --- a/include/wx/spinctrl.h +++ b/include/wx/spinctrl.h @@ -35,6 +35,7 @@ public: wxSpinCtrlBase() {} // accessor functions that derived classes are expected to have + virtual wxString GetTextValue() const { return wxString(); } // T GetValue() const // T GetMin() const // T GetMax() const diff --git a/interface/wx/spinctrl.h b/interface/wx/spinctrl.h index 98cc2bd189..a92b458e02 100644 --- a/interface/wx/spinctrl.h +++ b/interface/wx/spinctrl.h @@ -133,6 +133,13 @@ public: */ int GetMin() const; + /** + Returns the text in the text entry part of the control. + + @since 3.1.6 + */ + wxString GetTextValue() const; + /** Gets the value of the spin control. */ @@ -315,6 +322,13 @@ public: */ double GetMin() const; + /** + Returns the text in the text entry part of the control. + + @since 3.1.6 + */ + wxString GetTextValue() const; + /** Gets the value of the spin control. */ diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 28393d38fa..aa99410c35 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -506,6 +506,11 @@ bool wxSpinCtrlGenericBase::SyncSpinToText(SendEvent sendEvent) // changing value and range // ---------------------------------------------------------------------------- +wxString wxSpinCtrlGenericBase::GetTextValue() const +{ + return m_textCtrl ? m_textCtrl->GetValue() : wxString(); +} + void wxSpinCtrlGenericBase::SetValue(const wxString& text) { wxCHECK_RET( m_textCtrl, wxT("invalid call to wxSpinCtrl::SetValue") ); diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 14793ec74c..2d8914caff 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -214,6 +214,13 @@ double wxSpinCtrlGTKBase::DoGetIncrement() const return inc; } +wxString wxSpinCtrlGTKBase::GetTextValue() const +{ + wxCHECK_MSG(m_widget, wxEmptyString, "invalid spin button"); + + return gtk_entry_get_text( GTK_ENTRY(m_widget) ); +} + bool wxSpinCtrlGTKBase::GetSnapToTicks() const { wxCHECK_MSG(m_widget, false, "invalid spin button"); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index f4c60ba158..9cad282bcc 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -442,6 +442,11 @@ bool wxSpinCtrl::SetBase(int base) // wxTextCtrl-like methods // ---------------------------------------------------------------------------- +wxString wxSpinCtrl::GetTextValue() const +{ + return wxGetWindowText(m_hwndBuddy); +} + void wxSpinCtrl::SetValue(const wxString& text) { if ( !::SetWindowText(GetBuddyHwnd(), text.c_str()) )