Re: sizing a list
- From: Deborah Swayne <dfs research att com>
- To: gtk-app-devel-list gnome org
- Subject: Re: sizing a list
- Date: Thu, 19 Oct 2000 17:12:08 -0400
Is there a simple way to specify the number of rows
I want to be visible in a scrolled GtkCList?
Nobody replied to this, so maybe there's no terse
way to do this -- if there is, I'd still like to hear it.
If there isn't, though, and in case anybody's curious, here's
what I decided to do: I connect to the size_allocate signal, and
then execute the following:
#define CLIST_NROWS_VISIBLE 4
static gint
clist_size_alloc_cb (GtkWidget *w, GdkEvent *event, ggobid *gg)
{
if (!widget_initialized (w)) {
gint fheight;
gint lbearing, rbearing, width, ascent, descent;
GtkStyle *style;
GtkCList *clist = GTK_CLIST (w);
style = gtk_widget_get_style (w);
gdk_text_extents (style->font,
"arbitrary string", strlen ("arbitrary string"),
&lbearing, &rbearing, &width, &ascent, &descent);
fheight = ascent + descent;
gtk_widget_set_usize (w, -1,
CLIST_NROWS_VISIBLE * fheight +
(CLIST_NROWS_VISIBLE-1) * 1 + /*-- 1 = CELL_SPACING --*/
clist->column_title_area.height);
widget_initialize (w, true);
}
return true;
}
widget_initialize() and widget_initialized() are utilities that
protect me from the fact that gtk_widget_set_usize triggers yet
another size_allocate event.
Debby
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]