aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-03-30 09:27:38 +0800
committerChris Lahey <clahey@src.gnome.org>2001-03-30 09:27:38 +0800
commit491523b07ca6d9b1264ff2f53760a580715f2db6 (patch)
tree32c42d340fb0b3b667f25982192d64b88675b6e2 /widgets/table/e-table.c
parent55c3dea8392096c85ab4bfcd7872b44bb1a3e16c (diff)
downloadgsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar.gz
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar.bz2
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar.lz
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar.xz
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.tar.zst
gsoc2013-evolution-491523b07ca6d9b1264ff2f53760a580715f2db6.zip
Updated to set the width of the header canvas to be equal to the width of
2001-03-29 Christopher James Lahey <clahey@ximian.com> * e-table.c, e-tree.c, e-tree.h: Updated to set the width of the header canvas to be equal to the width of the table canvas to avoid infinite loops. Added left arrow and right arrow as tree collapse and expand bindings. svn path=/trunk/; revision=9035
Diffstat (limited to 'widgets/table/e-table.c')
-rw-r--r--widgets/table/e-table.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 4a2edcb6f1..a61ec0fea9 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -257,12 +257,28 @@ et_focus (GtkContainer *container, GtkDirectionType direction)
}
static void
+set_header_canvas_width (ETable *e_table)
+{
+ double oldwidth, oldheight, width;
+
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
+ NULL, NULL, &width, NULL);
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->header_canvas),
+ NULL, NULL, &oldwidth, &oldheight);
+
+ if (oldwidth != width ||
+ oldheight != E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1)
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_table->header_canvas),
+ 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
+ E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1);
+
+}
+
+static void
header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
{
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->header_canvas),
- 0, 0, alloc->width - 1, /* COLUMN_HEADER_HEIGHT - 1 */
- E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1);
+ set_header_canvas_width (e_table);
/* When the header item is created ->height == 0,
as the font is only created when everything is realized.
@@ -321,6 +337,7 @@ table_canvas_reflow_idle (ETable *e_table)
{
gdouble height, width;
gdouble item_height;
+ gdouble oldheight, oldwidth;
GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation);
gtk_object_get (GTK_OBJECT (e_table->canvas_vbox),
@@ -331,11 +348,17 @@ table_canvas_reflow_idle (ETable *e_table)
height = MAX ((int)height, alloc->height);
width = MAX((int)width, alloc->width);
/* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->table_canvas),
- 0, 0, width - 1, height - 1);
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
+ NULL, NULL, &oldwidth, &oldheight);
+
+ if (oldwidth != width - 1 ||
+ oldheight != height - 1) {
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (e_table->table_canvas),
+ 0, 0, width - 1, height - 1);
+ set_header_canvas_width (e_table);
+ }
gtk_object_set (GTK_OBJECT (e_table->white_item),
- "y1", item_height + 1,
+ "y1", item_height,
"x2", width,
"y2", height,
NULL);