Re: [gtk-list] Re: Window manager window placement and X modifiers/states
- From: Paul Barton-Davis <pbd op net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Window manager window placement and X modifiers/states
- Date: Wed, 15 Dec 1999 19:27:42 -0500
>> Let's say my app looks best when it's at 600x400. Is there some
>> other function/resource I should use?
>
>gtk_window_set_default_size(). However, you may want to check that the
>display is at least that large. :-)
>
>The other danger is that 600x400 is too small with some translations,
>themes, or theme-specified fonts. I'm not sure if set_default_size()
>will shrink beyond the size request though, in which case it would
>come out OK.
although i love GTK's adoption of the TeX glue+box model, the one area
where it falls down is in the domain of widgets that actually have to
be a certain size in order to work. when this size is a function of
the text that needs to be displayed in full, regardless of the font
specified by the style, things really get to be a pain.
the most egregious example of this is the GtkEntry widget used with a
GtkSpinButton. This often ends up being a completely useless size,
unrelated to the width necessary to display the value range of the
associated adjustment.
I got so fed up with this that i wrote the following utility function;
i use it for all widgets that display text and will be functionally
compromised if they are too small:
void
gtk_widget_set_usize_to_display_given_text (GtkWidget *w,
const gchar *text,
gint hpadding,
gint vpadding)
{
guint width;
guint lbearing;
guint rbearing;
guint ascent;
guint descent;
gdk_string_extents (w->style->font,
text,
&lbearing,
&rbearing,
&width,
&ascent,
&descent);
gtk_widget_set_usize (w, width+hpadding, ascent+descent+vpadding);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]