On 23.06.2014 21:47, Greg Ercolano wrote:
> Unless I'm missing something obvious:
> 1) It seems like Fl_Pack could use a few options to allow
> right vs left and bottom vs top justification.
> 2) I don't /think/ there are any tricks involving a combo of widgets
> to achieve this.. or are there?
> Looking for votes on #1, and input on #2 if there /is/ a trick
> to achieving, say, right-justified packing.
I'm late to the party, but just in case you're still waiting for votes:
+1 on adding right and bottom justification, although I don't think that
bottom justification would be very useful, but who knows...
That said, Fl_Pack resizes itself so that all widgets fit, so there is
probably no need to use right justification - it would just be a matter
of ordering the widgets. But then your given usage example wouldn't work
anyway. Or am I missing a point? As I see it, Fl_Pack only has a top
left coordinate (x,y) and either a height or width, depending on its
type and resizes itself (i.e. the missing width or height) depending on
its children. This is from the docs:
"If type() is Fl_Pack::HORIZONTAL all the children are resized to the
height of the Fl_Pack, and are moved next to each other horizontally. If
type() is not Fl_Pack::HORIZONTAL then the children are resized to the
width and are stacked below each other. Then the Fl_Pack resizes itself
to surround the child widgets."
IIRC there's an undocumented special feature with the resizable(), but
you would have to look at the code. The comment says:
"// Last child, if resizable, takes all remaining room".
That would maybe have to be interpreted as "First child, if resizable,
takes all remaining room", if ordering is reverse (from last child to
first child, starting at bottom or right border).
BTW: reading this again, this would mean: if the last child is the
resizable(), then Fl_Pack has a fixed _minimum_ size, as given with w()
or h() resp.: the last child will be resized, if the total size is
smaller than the given w() or h(). If the last child is not the
resizable, or if the total width/height of the children is bigger than
given, Fl_Pack will resize itself. Is this really what it does?
All that sounds weird and complicated, so I would personally not want to
touch it, but feel free to do it if you like.
Note: the current behavior WRT resizable() should probably be
documented. Any volunteers? If not, I may try to do it...