Can I wrap a label when it exceeds the width of parent?

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

 



Hello,

for the file manager http://segusoland.sourceforge.net (see screenshots), I 
have the following widget hierarchy:

scrolled window
--viewport
----vbox1
------hbox1
--------eventbox
-------------hbox2
----------------image1
----------------vbox2
--------------------label_name
--------------------label_dir
--------------------label_size
--------------------label_date
--------button1  (the GO button)
     ....

Unfortunately, the scrolledwindow (and therefore also the viewport and vbox1) 
is very narrow horizontally, and the filenames are very long.

So I need to wrap the filenames: I need to add newlines to label_name so it 
does not cross the right boundary of the scrolledwindow.

(TextViews are way too slow, tested. And the wrap option of labels wraps at a 
fixed size, hardcoded, so it is useless for me)

Currently I do a brutal wrapping of the label at character 26 (hardcoded). But 
if the font/resolution/window-size changes, this is obviously wrong.

In order to wrap correctly, I believe I must use pango somehow, and take into 
account:
1) the width of image1
2) the width of button1 (which can also be hidden!)
3) the current font width, and the width of a string with a given font
4) the width of the scrolledwindow//viewport/vbox1 

But I don't know how.


In other words, I must calculate the child size given the parent size. I don't 
even know if this is possible with gtk, which generally seems to calculate 
the parent size given the child size, not viceversa.

I beg your help,

Maurizio

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux