Re: Labels and line-wrapping
- From: Tristan Van Berkom <tvb gnome org>
- To: Jeroen Hoek <mail jeroenhoek nl>
- Cc: gtk-list gnome org
- Subject: Re: Labels and line-wrapping
- Date: Sun, 1 Feb 2009 11:34:21 -0500
On Sun, Feb 1, 2009 at 1:45 AM, Jeroen Hoek <mail jeroenhoek nl> wrote:
[...]
> What happens is that the Label's line-wrapping cuts of the lines way
> before running out of horizontal space. What I want is a widget that
> uses the horizontal space it got, and wraps accordingly.
>
> I could write my own widget to do this, but wouldn't I be re-inventing
> the wheel? Is there an easier way? If I do write my own line-wrapping
> label, how can I find the default font, color and font-size that a
> normal label would use?
>
> Any tips or suggestions are welcome.
>
What I did was:
- Connect to size-request for the label and return a small width
- Connect to size-allocate for the labels parent container with the
connect_after flag/api
- In the size allocate, allocate the right amount of space for the label
(usually thats just allocation.width - border_width * 2)
This little trick gives you wrappy and growy labels.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]