implemented SetSelection

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-01-22 15:20:34 +00:00
parent 8282369a53
commit f8f9ec5563
4 changed files with 28 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ public:
const wxString& name = _T("wxSpinCtrl")); const wxString& name = _T("wxSpinCtrl"));
void SetValue(const wxString& text); void SetValue(const wxString& text);
void SetSelection(long from, long to);
virtual int GetValue() const; virtual int GetValue() const;
virtual void SetValue( int value ); virtual void SetValue( int value );

View File

@@ -51,6 +51,7 @@ public:
const wxString& name = _T("wxSpinCtrl")); const wxString& name = _T("wxSpinCtrl"));
void SetValue(const wxString& text); void SetValue(const wxString& text);
void SetSelection(long from, long to);
virtual int GetValue() const; virtual int GetValue() const;
virtual void SetValue( int value ); virtual void SetValue( int value );

View File

@@ -228,6 +228,19 @@ void wxSpinCtrl::SetValue( int value )
GtkEnableEvents(); GtkEnableEvents();
} }
void wxSpinCtrl::SetSelection(long from, long to)
{
// translate from wxWindows conventions to GTK+ ones: (-1, -1) means the
// entire range
if ( from == -1 && to == -1 )
{
from = 0;
to = INT_MAX;
}
gtk_editable_select_region( GTK_EDITABLE(m_widget), (gint)from, (gint)to );
}
void wxSpinCtrl::SetRange(int minVal, int maxVal) void wxSpinCtrl::SetRange(int minVal, int maxVal)
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );

View File

@@ -228,6 +228,19 @@ void wxSpinCtrl::SetValue( int value )
GtkEnableEvents(); GtkEnableEvents();
} }
void wxSpinCtrl::SetSelection(long from, long to)
{
// translate from wxWindows conventions to GTK+ ones: (-1, -1) means the
// entire range
if ( from == -1 && to == -1 )
{
from = 0;
to = INT_MAX;
}
gtk_editable_select_region( GTK_EDITABLE(m_widget), (gint)from, (gint)to );
}
void wxSpinCtrl::SetRange(int minVal, int maxVal) void wxSpinCtrl::SetRange(int minVal, int maxVal)
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );