changing GtkTable homogeneous expand behaviour
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor gtk org>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: changing GtkTable homogeneous expand behaviour
- Date: Fri, 8 Feb 2002 15:48:16 +0100 (CET)
hi owen,
currently, a homogeneous table that is allocated more
space than it requested only fills the available area
if one of its children is packed with the EXPAND flag.
i think that should be change, so that homogeneous tables
always fill up the allocated space, since if the user chooses
a homogeneous table and packs it with expand behaviour into
its container (say a h/v box) he's probably not expecting the
table to change size dependend on how he packs children into
it (provided they fit of course).
the particular case i ran into is a widget that derives from
GtkTable and allowes DnD movement of its children. for the
case of a moving a single child, the table shrinks unexpectedly
upon draging and grows back upon dropping.
i can't imagine a case where anyone would rely on the current
(considerably broken) behaviour of homogeneous tables, so i'd like
to change:
static void
gtk_table_size_allocate_pass1 (GtkTable *table)
{
[...]
/* If we were allocated more space than we requested
* then we have to expand any expandable rows and columns
* to fill in the extra space.
*/
real_width = GTK_WIDGET (table)->allocation.width - GTK_CONTAINER (table)->border_width * 2;
real_height = GTK_WIDGET (table)->allocation.height - GTK_CONTAINER (table)->border_width * 2;
if (table->homogeneous)
{
nexpand = 0;
for (col = 0; col < table->ncols; col++)
if (table->cols[col].expand)
{
nexpand += 1;
break;
}
if (nexpand > 0)
{
width = real_width;
for (col = 0; col + 1 < table->ncols; col++)
width -= table->cols[col].spacing;
for (col = 0; col < table->ncols; col++)
{
extra = width / (table->ncols - col);
table->cols[col].allocation = MAX (1, extra);
width -= extra;
}
}
}
else
[...]
towards nexpand always being TRUE.
alternatively, we could add a property ::homogeneous_expand
that enforces this, but i don't see any practical uses in not
having that flag turned on.
as an aside, to make derivation from GtkTable less hacky, we should
really invoke the seperate size requisition and size allocation passes
through a class method pointer.
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]