summaryrefslogtreecommitdiff
path: root/FL/Fl_Spinner.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-03-10 18:49:44 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-03-10 18:49:44 +0000
commitb67ba50f147534bcf2beb3305dbcf24e20ff2e72 (patch)
tree7ea736568dd76e90aed465bef584dd60da296a7b /FL/Fl_Spinner.H
parent7123b78f3fd6758421f46a9fe735cb7de6bc6904 (diff)
New method Fl_Spinner::wrap(int) to set wrap mode at bounds (STR #3365).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12190 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Spinner.H')
-rw-r--r--FL/Fl_Spinner.H25
1 files changed, 25 insertions, 0 deletions
diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H
index 107bebb3b..bac216e70 100644
--- a/FL/Fl_Spinner.H
+++ b/FL/Fl_Spinner.H
@@ -43,6 +43,7 @@ class FL_EXPORT Fl_Spinner : public Fl_Group {
double maximum_; // Maximum value
double step_; // Amount to add/subtract for up/down
const char *format_; // Format string for input field
+ int wrap_; // wrap around at bounds (1/0)
private:
@@ -96,6 +97,30 @@ public:
*/
double step() const { return (step_); }
+ /** Sets whether the spinner wraps around at upper and lower bounds.
+
+ If wrap mode is on (default) the spinner value is set to the minimum()
+ or maximum() when the value exceeds the upper or lower bounds, resp.,
+ if the value was changed by one of the buttons.
+
+ If wrap mode is off, the spinner value stops at the upper and lower bounds.
+ \see minimum(), maximum()
+
+ \note This does not apply to the input field. The input value is always
+ clipped to the allowed range as if wrap mode was off.
+
+ \param[in] set non-zero sets wrap mode, zero resets wrap mode
+
+ \since 1.4.0
+ */
+ void wrap(int set) { wrap_ = set ? 1 : 0; }
+
+ /** Gets the wrap mode of the Fl_Spinner widget.
+ \see void wrap(int)
+ \since 1.4.0
+ */
+ int wrap() const { return wrap_; }
+
/** Gets the color of the text in the input field. */
Fl_Color textcolor() const { return (input_.textcolor()); }