| 1 |
/* File : Fl_Valuator.i */ |
| 2 |
//%module Fl_Valuator |
| 3 |
|
| 4 |
%feature("docstring") ::Fl_Valuator |
| 5 |
""" |
| 6 |
The Fl_Valuator class controls a single floating-point value and provides |
| 7 |
a consistent interface to set the value, range, and step, and insures that |
| 8 |
callbacks are done the same for every object. |
| 9 |
""" ; |
| 10 |
|
| 11 |
%{ |
| 12 |
#include "FL/Fl_Valuator.H" |
| 13 |
%} |
| 14 |
|
| 15 |
%include "macros.i" |
| 16 |
|
| 17 |
CHANGE_OWNERSHIP(Fl_Valuator) |
| 18 |
|
| 19 |
SET_FORMAT_STRING_IN_TYPEMAP(char*, format_string) |
| 20 |
SET_FORMAT_STRING_OUT_TYPEMAP(int, format, format_string) |
| 21 |
|
| 22 |
class Fl_Valuator : public Fl_Widget { |
| 23 |
protected: |
| 24 |
Fl_Valuator(int X, int Y, int W, int H, const char* L); |
| 25 |
|
| 26 |
public: |
| 27 |
~Fl_Valuator() FL_OVERRIDE { }; |
| 28 |
void bounds(double a, double b) {min=a; max=b;} |
| 29 |
double minimum() const {return min;} |
| 30 |
void minimum(double a) {min = a;} |
| 31 |
double maximum() const {return max;} |
| 32 |
void maximum(double a) {max = a;} |
| 33 |
void range(double a, double b) {min = a; max = b;} |
| 34 |
void step(int a) {A = a; B = 1;} |
| 35 |
void step(double a, int b) {A = a; B = b;} |
| 36 |
void step(double s); |
| 37 |
double step() const {return A/B;} |
| 38 |
void precision(int); |
| 39 |
|
| 40 |
double value() const {return value_;} |
| 41 |
int value(double); |
| 42 |
|
| 43 |
virtual int format(char* format_string); |
| 44 |
double round(double); // round to nearest multiple of step |
| 45 |
double clamp(double); // keep in range |
| 46 |
double increment(double, int); // add n*step to value |
| 47 |
}; |
| 48 |
|
| 49 |
%pythoncode %{ |
| 50 |
FL_VERTICAL=0 |
| 51 |
FL_HORIZONTAL=1 |
| 52 |
%} |
| 53 |
|
| 54 |
CLEAR_FORMAT_STRING_OUT_TYPEMAP(int, format) |