diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-02-14 13:20:34 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2022-02-14 13:20:34 +0100 |
| commit | 390095392b51034f42e03534925f59802076b487 (patch) | |
| tree | 3dc753c7520b40eef33d9483517ebd6a34a22123 /fluid/Shortcut_Button.h | |
| parent | 8c3778e13feebced373497a3e4060ae065cf65b7 (diff) | |
Adding comments to recent Fluid changes.
Diffstat (limited to 'fluid/Shortcut_Button.h')
| -rw-r--r-- | fluid/Shortcut_Button.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/fluid/Shortcut_Button.h b/fluid/Shortcut_Button.h index 443d2bd67..97d7d9323 100644 --- a/fluid/Shortcut_Button.h +++ b/fluid/Shortcut_Button.h @@ -20,6 +20,7 @@ #include <FL/Fl_Button.H> #include <FL/Fl_Input.H> +// Button will catch and display keyboard shortcuts when activated. class Shortcut_Button : public Fl_Button { public: int svalue; @@ -29,6 +30,7 @@ public: Fl_Button(X,Y,W,H,l) {svalue = 0;} }; +// Adding drag and drop for dragging widgets into windows. class Widget_Bin_Button : public Fl_Button { public: int handle(int); @@ -36,6 +38,7 @@ public: Fl_Button(X,Y,W,H,l) { } }; +// Adding drag and drop functionality to drag window prototypes onto the desktop. class Widget_Bin_Window_Button : public Fl_Button { public: int handle(int); @@ -43,15 +46,20 @@ public: Fl_Button(X,Y,W,H,l) { } }; - +// Callback signature for function returning the value of a variable. typedef int (Fluid_Coord_Callback)(class Fluid_Coord_Input const *, void*); +// Entry for a list of variables available to an input field. +// Fluid_Coord_Input::variables() expects an array of Fluid_Coord_Input_Vars +// with the last entry's name_ set to NULL. typedef struct Fluid_Coord_Input_Vars { const char *name_; Fluid_Coord_Callback *callback_; } Fluid_Coord_Input_Vars; -class Fluid_Coord_Input : public Fl_Input { +// A text input widget that understands simple math. +class Fluid_Coord_Input : public Fl_Input +{ Fl_Callback *user_callback_; Fluid_Coord_Input_Vars *vars_; void *vars_user_data_; @@ -60,15 +68,27 @@ class Fluid_Coord_Input : public Fl_Input { int eval_var(uchar *&s) const; int eval(uchar *&s, int prio) const; int eval(const char *s) const; + public: Fluid_Coord_Input(int x, int y, int w, int h, const char *l=0L); + + /** Return the text in the widget text field. */ const char *text() const { return Fl_Input::value(); } + + /** Set the text in the text field */ void text(const char *v) { Fl_Input::value(v); } + int value() const; void value(int v); + + /** Set the general callback for this widget. */ void callback(Fl_Callback *cb) { user_callback_ = cb; } + + /** Set the list of the available variables + \param vars array of variables, last entry `has name_` set to `NULL` + \param user_data is forwarded to the Variable callback */ void variables(Fluid_Coord_Input_Vars *vars, void *user_data) { vars_ = vars; vars_user_data_ = user_data; |
