diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-09-03 00:09:32 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2023-09-03 00:09:40 +0200 |
| commit | 5e8adebac2899d60fffc53d4692bc4972abcf795 (patch) | |
| tree | b79581c85dc80c4d132390de42c15faee8f3d4c9 /fluid/Fl_Button_Type.cxx | |
| parent | 502fa72eb472382cc47964874893085fb88116f5 (diff) | |
Adds compact buttons feature to create keypads.
See test/buttons for an example.
Diffstat (limited to 'fluid/Fl_Button_Type.cxx')
| -rw-r--r-- | fluid/Fl_Button_Type.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fluid/Fl_Button_Type.cxx b/fluid/Fl_Button_Type.cxx index 53355b7c3..ee12c731a 100644 --- a/fluid/Fl_Button_Type.cxx +++ b/fluid/Fl_Button_Type.cxx @@ -25,6 +25,7 @@ #include "Fl_Button_Type.h" #include "Fd_Snap_Action.h" +#include "file.h" #include <FL/Fl.H> #include <FL/Fl_Button.H> @@ -34,6 +35,9 @@ #include <FL/Fl_Repeat_Button.H> #include <FL/Fl_Round_Button.H> +#include <stdlib.h> + + // ---- Button Types --------------------------------------------------- MARK: - @@ -61,6 +65,30 @@ Fl_Widget *Fl_Button_Type::widget(int x, int y, int w, int h) { return new Fl_Button(x, y, w, h, "Button"); } +void Fl_Button_Type::write_properties(Fd_Project_Writer &f) { + Fl_Widget_Type::write_properties(f); + Fl_Button *btn = (Fl_Button*)o; + if (btn->compact()) { + f.write_string("compact"); + f.write_string("%d", btn->compact()); + } +} + +void Fl_Button_Type::read_property(Fd_Project_Reader &f, const char *c) { + Fl_Button *btn = (Fl_Button*)o; + if (!strcmp(c, "compact")) { + btn->compact((uchar)atol(f.read_word())); + } else { + Fl_Widget_Type::read_property(f, c); + } +} + +void Fl_Button_Type::copy_properties() { + Fl_Widget_Type::copy_properties(); + Fl_Button *s = (Fl_Button*)o, *d = (Fl_Button*)live_widget; + d->compact(s->compact()); +} + Fl_Button_Type Fl_Button_type; |
