Re: Using a TextView as a sort of "Hbox with wrapping"



On Mon, 2014-01-27 at 03:49 +1100, Chris Angelico wrote:
On Mon, Jan 27, 2014 at 3:43 AM, James Tappin <jtappin gmail com> wrote:
  If I interpret what you are trying to do correctly (not necessarily a
given), then I would have thought that GtkScrolledWindow (possibly in
conjunction with GtkViewport) would be the tool for the job.

Not scrolling, wrapping. The window might be large enough to hold all
the statusbar entries (and I expect that it normally will be), but if
it's not, I would prefer the more graceful degradation of doubling the
height of the status bar and moving the excess to a new row rather
than widening the window. Scrolling would force the user to
consciously manipulate the status bar, which is contrary to its goal
of being subtle and "just there". Suddenly expanding to double its
normal height isn't perfect either, but maybe someone will actually
want it to be taller, who knows.

I could use a Table, or a Vbox with multiple Hboxes in it, but then
I'd need to decide in advance which elements drop to the next row. I
want it to be automatic: if there's room, use one row, otherwise wrap
to a second (and third, and fourth, if necessary, but I would hope
that's never the case!).

You can get the behavior you are looking for with EggWrapBox:
  https://git.gnome.org/browse/libegg/tree/libegg/wrapbox

Just copy the eggwrapbox.[ch] and compile it as a part of your
code (or compile a libegg separately and link to it if LGPL is
a problem for you).

EggWrapBox has been modified and added to GTK+ as GtkFlowBox,
however the GTK+ version is lacking the primary feature that
you want, i.e. children do not wrap freely but instead they
are forced to appear in columns.

Perhaps if you use the EggWrapBox and prove to the GTK+ team
that the free-form wrapping is useful and important, we can
get the free flowing behavior back into GtkFlowBox.

FWIW I would certainly rather use the EggWrapBox widget for
the purpose you describe rather than to repurpose a GtkTextView
for that (the text view is much more complex for such a
simple purpose as wrapping widgets - also the EggWrapBox
handles height-for-width geometry well for it's children,
while textview itself does some height-for-width, I'm not
sure it is done well for embedded child widgets).

Cheers,
    -Tristan


ChrisA
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]