From cad5e25f863f3bf643a2c7a7b4a77be0bc9db130 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 2 May 2002 18:45:19 +0000 Subject: Added horizontal dividers to this item when in table mode. 2002-05-02 Christopher James Lahey * e-table-click-to-add.c: Added horizontal dividers to this item when in table mode. * e-table.c, e-tree.c: Made the background be an e-canvas-background instead of a * e-tree.c, e-tree.h: Added a white_space_event for feature parity with ETable. svn path=/trunk/; revision=16667 --- widgets/table/e-table-click-to-add.c | 2 +- widgets/table/e-table.c | 17 ++--------------- widgets/table/e-tree.c | 34 ++++++++++++++++++++++++---------- widgets/table/e-tree.h | 1 + 4 files changed, 28 insertions(+), 26 deletions(-) (limited to 'widgets') diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 6e17ae8b32..db3ca1d944 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -362,7 +362,7 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) "ETableHeader", etcta->eth, "ETableModel", etcta->one, "minimum_width", etcta->width, - "horizontal_draw_grid", FALSE, + "horizontal_draw_grid", TRUE, "vertical_draw_grid", TRUE, "selection_model", etcta->selection, "cursor_mode", E_CURSOR_SPREADSHEET, diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index f80c2b6a04..8b2b6bd4cb 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -35,6 +35,7 @@ #include "gal/util/e-i18n.h" #include "gal/util/e-util.h" #include "gal/widgets/e-canvas.h" +#include "gal/widgets/e-canvas-background.h" #include "gal/widgets/e-canvas-vbox.h" #include "gal/widgets/e-unicode.h" #include "e-table.h" @@ -622,11 +623,6 @@ table_canvas_reflow_idle (ETable *e_table) 0, 0, width - 1, height - 1); set_header_canvas_width (e_table); } - gtk_object_set (GTK_OBJECT (e_table->white_item), - "y1", item_height, - "x2", width, - "y2", height, - NULL); e_table->reflow_idle_id = 0; return FALSE; } @@ -652,11 +648,6 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gtk_object_set (GTK_OBJECT (e_table->header), "width", width, NULL); - gtk_object_set (GTK_OBJECT (e_table->white_item), - "y1", item_height + 1, - "x2", width, - "y2", height, - NULL); if (e_table->reflow_idle_id) g_source_remove(e_table->reflow_idle_id); table_canvas_reflow_idle(e_table); @@ -1098,11 +1089,7 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h e_table->white_item = gnome_canvas_item_new( gnome_canvas_root(e_table->table_canvas), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, + e_canvas_background_get_type(), "fill_color_gdk", >K_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL], NULL); diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index e92254ce10..5e5c2d10da 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -33,6 +33,7 @@ #include "gal/util/e-i18n.h" #include #include +#include #include #include @@ -76,6 +77,7 @@ enum { KEY_PRESS, START_DRAG, STATE_CHANGE, + WHITE_SPACE_EVENT, TREE_DRAG_BEGIN, TREE_DRAG_END, @@ -697,11 +699,6 @@ tree_canvas_reflow_idle (ETree *e_tree) 0, 0, width - 1, height - 1); set_header_canvas_width (e_tree); } - gtk_object_set (GTK_OBJECT (e_tree->priv->white_item), - "y1", item_height, - "x2", width, - "y2", height, - NULL); e_tree->priv->reflow_idle_id = 0; return FALSE; } @@ -950,6 +947,16 @@ et_canvas_realize (GtkWidget *canvas, ETree *e_tree) NULL); } +static gint +white_item_event (GnomeCanvasItem *white_item, GdkEvent *event, ETree *e_tree) +{ + int return_val = 0; + gtk_signal_emit (GTK_OBJECT (e_tree), + et_signals [WHITE_SPACE_EVENT], + event, &return_val); + return return_val; +} + static gint et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETree *e_tree) { @@ -1046,14 +1053,12 @@ e_tree_setup_table (ETree *e_tree) e_tree->priv->white_item = gnome_canvas_item_new( gnome_canvas_root(e_tree->priv->table_canvas), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, + e_canvas_background_get_type(), "fill_color_gdk", >K_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL], NULL); + gtk_signal_connect (GTK_OBJECT (e_tree->priv->white_item), "event", + GTK_SIGNAL_FUNC (white_item_event), e_tree); gtk_signal_connect ( GTK_OBJECT(e_tree->priv->table_canvas), "realize", GTK_SIGNAL_FUNC(et_canvas_realize), e_tree); @@ -2969,6 +2974,7 @@ e_tree_class_init (ETreeClass *class) class->key_press = NULL; class->start_drag = et_real_start_drag; class->state_change = NULL; + class->white_space_event = NULL; class->tree_drag_begin = NULL; class->tree_drag_end = NULL; @@ -3052,6 +3058,14 @@ e_tree_class_init (ETreeClass *class) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + et_signals [WHITE_SPACE_EVENT] = + gtk_signal_new ("white_space_event", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETreeClass, white_space_event), + gtk_marshal_INT__POINTER, + GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT); + et_signals[TREE_DRAG_BEGIN] = gtk_signal_new ("tree_drag_begin", GTK_RUN_LAST, diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 2b74f3b8b0..56ad205f63 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -71,6 +71,7 @@ typedef struct { gint (*key_press) (ETree *et, int row, ETreePath path, int col, GdkEvent *event); gint (*start_drag) (ETree *et, int row, ETreePath path, int col, GdkEvent *event); gint (*state_change) (ETree *et); + gint (*white_space_event) (ETree *et, GdkEvent *event); void (*set_scroll_adjustments) (ETree *tree, GtkAdjustment *hadjustment, -- cgit v1.2.3