|
|
A refined version of #477
When using widget_class, in containing window or Fl_Group, we put a Fl_Box as placeholder with a xywh .
And for the widget_class current fluid generates xywh , but when the width and height is bigger than Fl_Box's width and height, there is no auto-rescaling. then event like click outside Fl_Box's xywh get lost.
fluid currently has the reposition choice but which only handles xy of given xwyh , there is not rescaling to handle ``wh``` part.
This PR changes the Relative button into a choice with three option: None /Relative /Relative & Rescale .
When choose None or Relative , everything is same with previous version, but when choice Relative & Rescale , the generated code will hand the rescaling issue.
take following widget_class as example:
code generated with reposition, but no rescaling:
QD_CondChecker_hasItem::QD_CondChecker_hasItem(int X, int Y, int W, int H, const char *L)
: Fl_Group(0, 0, W, H, L) {
{ Fl_Box* o = new Fl_Box(0, 0, 115, 25, "Has");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ m_input = new Fl_Value_Input(115, 0, 45, 25);
m_input->labeltype(FL_NO_LABEL);
} // Fl_Value_Input* m_input
{ Fl_Box* o = new Fl_Box(160, 0, 50, 25, "Item");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Choice* o = new Fl_Choice(210, 0, 145, 25);
o->down_box(FL_BORDER_BOX);
o->labeltype(FL_NO_LABEL);
o->menu(menu_);
} // Fl_Choice* o
position(X, Y);
end();
resizable(this);
}
code generated with rescaling:
QD_CondChecker_hasItem::QD_CondChecker_hasItem(int X, int Y, int W, int H, const char *L) :
Fl_Group(0, 0, W, H, L)
{
{ Fl_Box* o = new Fl_Box(round(W*0.000000), round(H*0.000000), round(W*0.323944), round(H*1.000000), "Has");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ m_input = new Fl_Value_Input(round(W*0.323944), round(H*0.000000), round(W*0.126761), round(H*1.000000));
m_input->labeltype(FL_NO_LABEL);
} // Fl_Value_Input* m_input
{ Fl_Box* o = new Fl_Box(round(W*0.450704), round(H*0.000000), round(W*0.140845), round(H*1.000000), "Item");
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Choice* o = new Fl_Choice(round(W*0.591549), round(H*0.000000), round(W*0.408451), round(H*1.000000));
o->down_box(FL_BORDER_BOX);
o->labeltype(FL_NO_LABEL);
o->menu(menu_);
} // Fl_Choice* o
position(X, Y);
end();
resizable(this);
}
I use this change in my daily work, should be safe as a PR.
You can view, comment on, or merge this pull request online at:
https://github.com/fltk/fltk/pull/481
Commit Summary
- f6c1331 when widget_class in relative mode, this change helps to make all sub-widgets in widget_class automatically rescale
- 2d48ef1 keep compatibility for wc_relative
- ca12cd7 Merge branch 'fltk:master' into master
File Changes (7 files)
Patch Links:
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/pull/481@github.com>
[ Direct Link to Message ] | |
|
| |