Hi all,
I used FLTK 1.1.x to make a simple taskbar for the Ratpoison window manager. 
It's hosted at http://github.com/dimatura/rpbar . It works fine, but it's still 
pretty beta.

One of the hacks in the code relates to the clipping behavior for the labels. 
I'll explain. Here's a screenshot: 
http://github.com/downloads/dimatura/rpbar/shot.png . rpbar is the little bar 
small in the bottom.
It's simply an Fl_pack with Fl_button's. The button labels are the window title 
of each running application.

Now, the labels are often too long to fit in the button, so I truncate them. 
What I'm doing to solve this right now is a pretty ugly hack: I'm estimating 
the maximum characters the button may have by dividing the button width in 
pixel by a hard coded "character width in pixels" value and truncating the 
string at that value. In practice this doesn't work too well, as you might 
imagine. I tried FL_ALIGN_CLIP, but it doesn't really do what I want.

So I'm wondering if there's a way to find out at runtime the width of a label 
in pixels so I can shave off letters from the text until it reaches the maximum 
width I want the label to have.

Or maybe there I should do something else, like subclassing the widget or 
making a new label type. Any suggestions?

thanks,
Daniel

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to