Author: spitzak
Date: 2007-10-17 12:57:31 -0700 (Wed, 17 Oct 2007)
New Revision: 5956
Log:
Valuator::value(newvalue) returns bool instead of int.
Fix for STR #1800:
const-correctness and don't hide base class value() methods.
Modified:
trunk/fltk/Scrollbar.h
trunk/fltk/Valuator.h
trunk/src/Scrollbar.cxx
trunk/src/Valuator.cxx
Modified: trunk/fltk/Scrollbar.h
===================================================================
--- trunk/fltk/Scrollbar.h 2007-10-17 19:46:35 UTC (rev 5955)
+++ trunk/fltk/Scrollbar.h 2007-10-17 19:57:31 UTC (rev 5956)
@@ -37,8 +37,9 @@
Scrollbar(int x,int y,int w,int h, const char *l = 0);
static NamedStyle* default_style;
- int value() {return int(Slider::value());}
- int value(int position, int size, int top, int total);
+ int value() const {return int(Slider::value());}
+ bool value(int position) {return Slider::value(position);}
+ bool value(int position, int size, int top, int total);
int handle(int);
int pagesize() const {return pagesize_;}
Modified: trunk/fltk/Valuator.h
===================================================================
--- trunk/fltk/Valuator.h 2007-10-17 19:46:35 UTC (rev 5955)
+++ trunk/fltk/Valuator.h 2007-10-17 19:57:31 UTC (rev 5956)
@@ -33,7 +33,7 @@
public:
double value() const {return value_;}
- int value(double);
+ bool value(double);
double minimum() const {return minimum_;}
void minimum(double a) {minimum_ = a;}
Modified: trunk/src/Scrollbar.cxx
===================================================================
--- trunk/src/Scrollbar.cxx 2007-10-17 19:46:35 UTC (rev 5955)
+++ trunk/src/Scrollbar.cxx 2007-10-17 19:57:31 UTC (rev 5956)
@@ -76,7 +76,7 @@
\a l = the total size of your data.
*/
-int Scrollbar::value(int p, int w, int t, int l) {
+bool Scrollbar::value(int p, int w, int t, int l) {
if (p+w > t+l) l = p+w-t;
if (l <= 0) l = 1;
int b = l-w+t;
Modified: trunk/src/Valuator.cxx
===================================================================
--- trunk/src/Valuator.cxx 2007-10-17 19:46:35 UTC (rev 5955)
+++ trunk/src/Valuator.cxx 2007-10-17 19:57:31 UTC (rev 5956)
@@ -91,13 +91,14 @@
Sets the current value, redrawing the widget if necessary by calling
value_damage(). <i>The new value is stored unchanged, even if it is
outside the range or not a multiple of step()</i>.
+ Returns true if the new value is different.
*/
-int Valuator::value(double v) {
+bool Valuator::value(double v) {
clear_changed();
- if (v == value_) return 0;
+ if (v == value_) return false;
value_ = v;
value_damage();
- return 1;
+ return true;
}
/*! \fn void Valuator::set_value(double)
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit