Re: Using a TextView as a sort of "Hbox with wrapping"
- From: Chris Angelico <rosuav gmail com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Using a TextView as a sort of "Hbox with wrapping"
- Date: Tue, 28 Jan 2014 03:08:32 +1100
On Tue, Jan 28, 2014 at 3:00 AM, Tristan Van Berkom
<tristan upstairslabs com> wrote:
Sorry I did not take into account that you were working with the
GTK+2 library and not GTK+3.
Ah, I should have mentioned, sorry. There has been talk of supporting
GTK3 in Pike, but I won't move to it till I can confidently expect
that my clients will have it. (It's kinda weird. I'm using a language
that's more designed for servers - web servers, MUD servers, and so on
- and writing a client in it. More often than you might think, I run
into Pike bugs and have to fix them before I can move on. Fortunately
it's an open source language!)
height for width is a geometry management system which says to
the widget:
o What is your minimum width and what is your natural width ?
o Oh... so you can fit into 40 pixels but you would prefer 80 !
o Ok I've decided that, taking into account all horizontal space, you
will receive 60 pixels in width, how much height do you need for
a width of 60 pixels ?
o Ah, you want 20 height ? we're done here, you will receive 60
pixels in width and 20 pixels in height.
This geometry management is more complex than just:
"what is your width & height"
but allows dynamic content such as wrapping labels to unwrap
and fit the window allocation, leaving more vertical space
for other widgets above or below a wrapping label which might
desire that space.
Ah, gotcha. That makes a lot of sense, since there'll be a good few
widgets that can wrap like that.
GtkTextView had it's own way of doing height-for-width internally,
insomuch that it would eventually ask for enough height to fit the
wrapping text into whatever width you had given it.
That's actually the exact behaviour I want here. The status bar will
fill whatever width the window is sized to, and then I want it to
claim as much or as little height as it needs. (The bulk of the
window's height is taken up with a ScrolledWindow, so it makes little
difference to the layout if there's another row of status.)
GTK+3 has this geometry management built-in, but GTK+2 does not
(so doing things like EggWrapBox with GTK+2 is more tricky).
If you are stuck with GTK+2, I suggest you take a look into
GtkToolPalette, you might be able to trick your statusbar
items into being GtkToolItems and use the wrapping behaviour
of GtkToolPalette to achieve the same effect (or at least use
some prior art in there, I think you are stuck with the
expanders if you use GtkToolPalette directly... GtkToolItemGroup
would have the precise code you are looking for).
Yeah, I looked into that, but wasn't able to make it do what I wanted.
I'll give that another shot tomorrow; it might be better suited to
what I'm trying to do (especially if it works properly on Windows and
Mac). It's called GTK2.Toolbar in Pike, but I'm assuming that's the
same thing as GtkToolPalette.
ChrisA
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]