diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-11-06 14:40:18 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2022-11-08 19:09:17 +0100 |
| commit | b76152cf6c0346a34a1f866ad1809ad0c6f2e6ea (patch) | |
| tree | 8cd13cb8e5507c8f110f527e1d4eb8f3a7860f10 /fluid/Fl_Window_Type.cxx | |
| parent | ec47afb7eb5864e915ea89530ffb8b6a81bf230d (diff) | |
Fluid: widget classes can resize children on instantiation
Diffstat (limited to 'fluid/Fl_Window_Type.cxx')
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 39a4c84b3..9138378c3 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1608,12 +1608,17 @@ Fl_Type *Fl_Widget_Class_Type::make(Strategy strategy) { void Fl_Widget_Class_Type::write_properties() { Fl_Window_Type::write_properties(); - if (wc_relative) write_string("position_relative"); + if (wc_relative==1) + write_string("position_relative"); + else if (wc_relative==2) + write_string("position_relative_rescale"); } void Fl_Widget_Class_Type::read_property(const char *c) { if (!strcmp(c,"position_relative")) { wc_relative = 1; + } else if (!strcmp(c,"position_relative_rescale")) { + wc_relative = 2; } else { Fl_Window_Type::read_property(c); } @@ -1684,8 +1689,10 @@ void Fl_Widget_Class_Type::write_code1() { write_h("%s%s(int X, int Y, int W, int H, const char *L = 0);\n", indent(1), trimclassname(name())); write_c("%s::%s(int X, int Y, int W, int H, const char *L) :\n", name(), trimclassname(name())); - if (wc_relative) + if (wc_relative==1) write_c("%s%s(0, 0, W, H, L)\n{\n", indent(1), c); + else if (wc_relative==2) + write_c("%s%s(0, 0, %d, %d, L)\n{\n", indent(1), c, o->w(), o->h()); else write_c("%s%s(X, Y, W, H, L)\n{\n", indent(1), c); } @@ -1698,7 +1705,10 @@ void Fl_Widget_Class_Type::write_code1() { void Fl_Widget_Class_Type::write_code2() { write_extra_code(); - if (wc_relative) write_c("%sposition(X, Y);\n", indent()); + if (wc_relative==1) + write_c("%sposition(X, Y);\n", indent()); + else if (wc_relative==2) + write_c("%sresize(X, Y, W, H);\n", indent()); if (modal) write_c("%sset_modal();\n", indent()); else if (non_modal) write_c("%sset_non_modal();\n", indent()); if (!((Fl_Window*)o)->border()) write_c("%sclear_border();\n", indent()); |
