diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
| commit | f9039b2ae21988783feae9b362818e7923e82d14 (patch) | |
| tree | 6d6fe3679d73448758f9794e7d4d4f6b22a4adad /FL/Fl_Value_Input.H | |
| parent | 67e89232f9ba067825a158734a09e0fa21aacbe3 (diff) | |
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Value_Input.H')
| -rw-r--r-- | FL/Fl_Value_Input.H | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/FL/Fl_Value_Input.H b/FL/Fl_Value_Input.H new file mode 100644 index 000000000..ddb557b05 --- /dev/null +++ b/FL/Fl_Value_Input.H @@ -0,0 +1,50 @@ +// Fl_Value_Input.H + +// Edit text or drag to adjust floating point value. +// as suggested by Pierre Jasmin + +// Current behavior: +// Dragging left mouse moves by step() +// Middle mouse is 5*step() +// Right mouse is 20*step() +// clicking any mouse button puts insertion cursor there +// You can also navigate there with tab + +// Bugs (?): +// No way to select region of text +// Hard to paste in new values + +#ifndef Fl_Value_Input_H +#define Fl_Value_Input_H + +#include "Fl_Valuator.H" +#include "Fl_Input.H" + +class Fl_Value_Input : public Fl_Valuator { +public: + Fl_Input input; +private: + char soft_; + static void input_cb(Fl_Widget*,void*); + virtual void value_damage(); // cause damage() due to value() changing +public: + int handle(int); + void draw(); + void resize(int,int,int,int); + Fl_Value_Input(int x,int y,int w,int h,const char *l=0); + + void soft(char x) {soft_ = x;} + char soft() const {return soft_;} + + Fl_Font textfont() const {return input.textfont();} + void textfont(uchar s) {input.textfont(s);} + uchar textsize() const {return input.textsize();} + void textsize(uchar s) {input.textsize(s);} + Fl_Color textcolor() const {return input.textcolor();} + void textcolor(uchar n) {input.textcolor(n);} + Fl_Color cursor_color() const {return input.cursor_color();} + void cursor_color(uchar n) {input.cursor_color(n);} + +}; + +#endif |
