From 6d65dcba88092bbff9979399a7d204bb0c88dd59 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 25 Mar 2005 02:39:25 +0000 Subject: [PATCH] Change Fl_Spinner to use double values instead of ints. Update FLUID dependencies. The # copies spinner was just a bit too small for 100 copies. Didn't set the menu divider if there were exactly 10 files in the history. Add documentation for Fl_Spinner. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4186 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Spinner.H | 40 ++++++------- documentation/Fl_Spinner.html | 107 ++++++++++++++++++++++++++++++++++ documentation/Makefile | 1 + documentation/fltk.book | 1 + documentation/widgets.html | 2 + fluid/fluid.cxx | 15 +++-- fluid/makedepend | 33 ++++++----- fluid/print_panel.cxx | 2 +- fluid/print_panel.fl | 6 +- 9 files changed, 164 insertions(+), 43 deletions(-) create mode 100644 documentation/Fl_Spinner.html diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H index 139079980..35a9badfb 100644 --- a/FL/Fl_Spinner.H +++ b/FL/Fl_Spinner.H @@ -45,10 +45,10 @@ class Fl_Spinner : public Fl_Group { - int value_; // Current value - int minimum_; // Minimum value - int maximum_; // Maximum value - int step_; // Amount to add/subtract for up/down + double value_; // Current value + double minimum_; // Minimum value + double maximum_; // Maximum value + double step_; // Amount to add/subtract for up/down const char *format_; // Format string Fl_Input input_; // Input field for the value @@ -57,11 +57,11 @@ class Fl_Spinner : public Fl_Group down_button_; // Down button static void sb_cb(Fl_Widget *w, Fl_Spinner *sb) { - int v; // New value + double v; // New value if (w == &(sb->input_)) { // Something changed in the input field... - v = atoi(sb->input_.value()); + v = atof(sb->input_.value()); if (v < sb->minimum_) { sb->value_ = sb->minimum_; @@ -107,11 +107,11 @@ class Fl_Spinner : public Fl_Group H / 2 + 2, H / 2, "@-22>") { end(); - value_ = 1; - minimum_ = 1; - maximum_ = 100; - step_ = 1; - format_ = "%d"; + value_ = 1.0; + minimum_ = 1.0; + maximum_ = 100.0; + step_ = 1.0; + format_ = "%.0f"; align(FL_ALIGN_LEFT); @@ -127,11 +127,11 @@ class Fl_Spinner : public Fl_Group const char *format() { return (format_); } void format(const char *f) { format_ = f; update(); } - int maxinum() const { return (maximum_); } - void maximum(int m) { maximum_ = m; } - int mininum() const { return (minimum_); } - void minimum(int m) { minimum_ = m; } - void range(int a, int b) { minimum_ = a; maximum_ = b; } + double maxinum() const { return (maximum_); } + void maximum(double m) { maximum_ = m; } + double mininum() const { return (minimum_); } + void minimum(double m) { minimum_ = m; } + void range(double a, double b) { minimum_ = a; maximum_ = b; } void resize(int X, int Y, int W, int H) { Fl_Group::resize(X,Y,W,H); @@ -140,8 +140,8 @@ class Fl_Spinner : public Fl_Group down_button_.resize(X + W - H / 2 - 2, Y + H - H / 2, H / 2 + 2, H / 2); } - int step() const { return (step_); } - void step(int s) { step_ = s; } + double step() const { return (step_); } + void step(double s) { step_ = s; } Fl_Color textcolor() const { return (input_.textcolor()); } @@ -160,8 +160,8 @@ class Fl_Spinner : public Fl_Group void textsize(uchar s) { input_.textsize(s); } - int value() const { return (value_); } - void value(int v) { value_ = v; update(); } + double value() const { return (value_); } + void value(double v) { value_ = v; update(); } }; #endif // !Fl_Spinner_H diff --git a/documentation/Fl_Spinner.html b/documentation/Fl_Spinner.html new file mode 100644 index 000000000..ab6383c77 --- /dev/null +++ b/documentation/Fl_Spinner.html @@ -0,0 +1,107 @@ + + + + + +

class Fl_Spinner

+ +
+ +

Class Hierarchy

+ + + +

Include Files

+ + + +

Description

+ +

The Fl_Spinner widget is a combination of the input +widget and repeat buttons. The user can either type into the +input area or use the buttons to change the value. + +

Methods

+ + + +

Fl_Spinner::Fl_Spinner(int x, int y, int w, +int h, const char *label = 0)

+ +

Creates a new Fl_Spinner widget using the given position, size, +and label string. + +

virtual Fl_Spinner::~Fl_Spinner()

+ +

Destroys the widget and any value associated with it. + +

void format(const char *f)
+const char *format()

+ +

Sets or returns the format string for the value.

+ +

void maximum(double m)
+double maximum() const

+ +

Sets or returns the maximum value of the widget.

+ +

void minimum(double m)
+double minimum() const

+ +

Sets or returns the minimum value of the widget.

+ +

void range(double minval, double maxval)

+ +

Sets the minimum and maximum values for the widget.

+ +

void step(double s)
+double step() const

+ +

Sets or returns the amount to change the value when the user +clicks a button.

+ +

void textcolor(Fl_Color c)
+Fl_Color textcolor() const

+ +

Sets or returns the color of the text in the input field.

+ +

void textfont(uchar f)
+uchar textfont() const

+ +

Sets or returns the font of the text in the input field.

+ +

void textsize(uchar s)
+uchar textsize() const

+ +

Sets or returns the size of the text in the input field.

+ +

void Fl_Spinner::value(double v)
+double Fl_Spinner::value() const

+ +

Sets or returns the current value of the widget.

+ + + diff --git a/documentation/Makefile b/documentation/Makefile index a8434510a..a648c6304 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -119,6 +119,7 @@ HTMLFILES = \ Fl_Shared_Image.html \ Fl_Single_Window.html \ Fl_Slider.html \ + Fl_Spinner.html \ Fl_Tabs.html \ Fl_Text_Buffer.html \ Fl_Text_Display.html \ diff --git a/documentation/fltk.book b/documentation/fltk.book index cc71dc505..436ffe97d 100644 --- a/documentation/fltk.book +++ b/documentation/fltk.book @@ -76,6 +76,7 @@ Fl_Secret_Input.html Fl_Select_Browser.html Fl_Single_Window.html Fl_Slider.html +Fl_Spinner.html Fl_Tabs.html Fl_Text_Buffer.html Fl_Text_Display.html diff --git a/documentation/widgets.html b/documentation/widgets.html index d101330c6..393b8af65 100644 --- a/documentation/widgets.html +++ b/documentation/widgets.html @@ -79,6 +79,7 @@ description of the fl_ functions, see Fl_Shared_Image
Fl_Single_Window
Fl_Slider
+Fl_Spinner
Fl_Tabs
Fl_Text_Buffer
Fl_Text_Display
@@ -165,6 +166,7 @@ description of the fl_ functions, see
  • Fl_Input_Choice
  • Fl_Pack
  • Fl_Scroll +
  • Fl_Slider
  • Fl_Tabs
  • Fl_Text_Display