calculating the width of an unshow widget
- From: Timothy Flechtner <Timothy Flechtner tellabs com>
- To: gtk-list gnome org
- Subject: calculating the width of an unshow widget
- Date: Wed, 14 Feb 2001 17:55:08 -0600
hi all,
i've been shuffling (ok, maybe staggering) around this wild, wacky
widget set , and am slowly beginning to figure out how much i don't yet
understand (yay!). anyway, i was trying to account for the width of one
of my widgets. i have a label inside a frame, the frame has border type
GTK_SHADOW_IN and a border width of 0, the label has an x_padding value
of 5. my best guess for calculating the width desired by the frame is
(sorry its in gtkmm):
string s = "Gtk+"
Frame* f = manage( new Frame() );
f->set_shadow_type(GTK_SHADOW_IN);
f->set_border_width(0);
Label* a_name = manage( new Label(def[i].get_name()) );
a_name->set_padding(5, 5);
Style* style = a_name->get_style();
Gdk_Font font = style->get_font();
// width should be a_name->get_style()->get_font().string_width(s) +
(2 * a_name->get_xpad())
but. . . it seems like i'm off by 4 (4 too little). can anyone tell me
what accounts for the extra 4?
thanks!
-tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]