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_Widget_Type.cxx | |
| parent | 502fa72eb472382cc47964874893085fb88116f5 (diff) | |
Adds compact buttons feature to create keypads.
See test/buttons for an example.
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 7418e65e1..3eddc890f 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1081,6 +1081,39 @@ void down_box_cb(Fl_Choice* i, void *v) { } } +void compact_cb(Fl_Light_Button* i, void* v) { + if (v == LOAD) { + uchar n; + if (current_widget->is_a(Fl_Type::ID_Button)) { + n = ((Fl_Button*)(current_widget->o))->compact(); + i->value(n); + i->show(); + } else { + i->hide(); + } + } else { + int mod = 0; + uchar n = (uchar)i->value(); + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_a(Fl_Type::ID_Button)) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + uchar v = ((Fl_Button*)(q->o))->compact(); + if (n != v) { + if (!mod) { + mod = 1; + undo_checkpoint(); + } + ((Fl_Button*)(q->o))->compact(n); + q->redraw(); + } + } + } + if (mod) set_modflag(1); + } +} + + + //////////////////////////////////////////////////////////////// Fl_Menu_Item whenmenu[] = { @@ -3039,6 +3072,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) { if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var, boxname(b->down_box())); if (b->value()) f.write_c("%s%s->value(1);\n", f.indent(), var); + if (b->compact()) f.write_c("%s%s->compact(%d);\n", f.indent(), var, b->compact()); } else if (is_a(Fl_Type::ID_Input_Choice)) { Fl_Input_Choice* b = (Fl_Input_Choice*)o; if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var, |
