From 5e8adebac2899d60fffc53d4692bc4972abcf795 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 3 Sep 2023 00:09:32 +0200 Subject: Adds compact buttons feature to create keypads. See test/buttons for an example. --- fluid/Fl_Button_Type.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'fluid/Fl_Button_Type.cxx') 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 #include @@ -34,6 +35,9 @@ #include #include +#include + + // ---- 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; -- cgit v1.2.3