From 05bd3ade18e53762079994c41cbb953994d994c9 Mon Sep 17 00:00:00 2001
From: Matthias Melcher
Date: Thu, 22 Jun 2006 07:35:39 +0000
Subject: Added support for floating point Fl_Spinner
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5221 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
CHANGES | 2 +
FL/Fl_Spinner.H | 9 +++
documentation/Fl_Spinner.html | 20 +++++-
fluid/Fl_Widget_Type.cxx | 30 ++++++---
fluid/factory.cxx | 6 +-
test/valuators.fl | 142 +++++++++++++++++++++++-------------------
6 files changed, 134 insertions(+), 75 deletions(-)
diff --git a/CHANGES b/CHANGES
index 01e7a2643..9a5f81a36 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8
+ - Added support for floating point Fl_Spinner in the
+ API, documentation, and Fluid (STR #1331)
- Repeat button now cancels timeout if it should get
deactivated during a callback (STR #1330)
- Added support for assigning Fl_Menu_Items to array
diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H
index 2a6c0bcdf..c475681de 100644
--- a/FL/Fl_Spinner.H
+++ b/FL/Fl_Spinner.H
@@ -163,6 +163,15 @@ class Fl_Spinner : public Fl_Group
void textsize(uchar s) {
input_.textsize(s);
}
+ uchar type() const { return (input_.type()); }
+ void type(uchar v) {
+ if (v==FL_FLOAT_INPUT) {
+ format("%g");
+ } else {
+ format("%.0f");
+ }
+ input_.type(v);
+ }
double value() const { return (value_); }
void value(double v) { value_ = v; update(); }
};
diff --git a/documentation/Fl_Spinner.html b/documentation/Fl_Spinner.html
index ab6383c77..c294262ca 100644
--- a/documentation/Fl_Spinner.html
+++ b/documentation/Fl_Spinner.html
@@ -44,6 +44,7 @@ input area or use the buttons to change the value.
textcolor
textfont
textsize
+ type
value
@@ -81,7 +82,10 @@ double minimum() const
double step() const
Sets or returns the amount to change the value when the user
-clicks a button.
+clicks a button.
+Before setting step to a non-integer value, the spinner
+type() should be changed
+to floating point.
@@ -98,10 +102,22 @@ uchar textsize() const
Sets or returns the size of the text in the input field.
+
+
+Sets or returns the numeric representation in the input field.
+Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
+The first form also changes the format() template.
+Please note that type is not a virtual function.
+Setting a new spinner type via a superclass pointer will not work.
+
-Sets or returns the current value of the widget.
+Sets or returns the current value of the widget.
+Before setting value to a non-integer value, the spinner
+type() should be changed
+to floating point.