From b67ba50f147534bcf2beb3305dbcf24e20ff2e72 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 10 Mar 2017 18:49:44 +0000 Subject: 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 --- FL/Fl_Spinner.H | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'FL') 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()); } -- cgit v1.2.3