]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/spinctrl.cpp
Fix the off-by-one a little differently, and correct a refresh problem
[wxWidgets.git] / src / gtk1 / spinctrl.cpp
index e071efbce9a94a46406eaa9255424e3d98e6123c..ff4ee9faeb5008591cc8952dacb123278df4c998 100644 (file)
@@ -228,6 +228,19 @@ void wxSpinCtrl::SetValue( int value )
     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)
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );