diff options
author | Miguel de Icaza <miguel@gnu.org> | 1999-12-31 10:23:37 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-12-31 10:23:37 +0800 |
commit | f55c64565cd6b2820652b09cd647581067e4c188 (patch) | |
tree | d7c39cd75444e9454480d84662ffb76ed9949d9a /widgets/table/e-cell-toggle.c | |
parent | d0606659a4bb08bdb635fea2b702856b2fabb480 (diff) | |
download | gsoc2013-evolution-f55c64565cd6b2820652b09cd647581067e4c188.tar.gz gsoc2013-evolution-f55c64565cd6b2820652b09cd647581067e4c188.tar.zst gsoc2013-evolution-f55c64565cd6b2820652b09cd647581067e4c188.zip |
Ok, the restructuring of ETableItem to compute its size without hacks is
Ok, the restructuring of ETableItem to compute its size without hacks is
in now. I am feeling better now.
1999-12-30 Miguel de Icaza <miguel@gnu.org>
* e-table-item.c (eti_attach_cell_views): New routine, creates the
cell views.
(eti_detach_cell_views): Detaches the cell_views from the
ETableItem.
(eti_realize_cell_views, eti_unrealize_cell_views): Simplified to
just do realize/unrealize notification.
(eti_add_table_model): Only attach the cells when we have both the
table model and the header model.
* e-cell.h (ECellClass): Added two new methods: new_view and
kill_view which drive the view process (instead of putting that on
realize/unrealize).
* e-cell.c: Adapt the code to use the new scheme for view
instantiation.
* e-cell-text.c, e-cell-toggle.c: Adapted to the new class
changes.
svn path=/trunk/; revision=1523
Diffstat (limited to 'widgets/table/e-cell-toggle.c')
-rw-r--r-- | widgets/table/e-cell-toggle.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index dbe5fe5cbd..6ea181ea40 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -23,7 +23,6 @@ typedef struct { ECellView cell_view; GdkGC *gc; GnomeCanvas *canvas; - ETableItem *eti; } ECellToggleView; static ECellClass *parent_class; @@ -31,28 +30,43 @@ static ECellClass *parent_class; static void etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row) { - e_table_item_redraw_range (text_view->eti, view_col, view_row, view_col, view_row); + e_table_item_redraw_range ( + text_view->cell_view.e_table_item_view, + view_col, view_row, view_col, view_row); } /* * ECell::realize method */ static ECellView * -etog_realize (ECell *ecell, ETableModel *table_model, void *view) +etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) { ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1); - ETableItem *eti = E_TABLE_ITEM (view); + ETableItem *eti = E_TABLE_ITEM (e_table_item_view); GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; toggle_view->cell_view.ecell = ecell; - toggle_view->cell_view.table_model = table_model; - toggle_view->eti = eti; + toggle_view->cell_view.e_table_model = table_model; + toggle_view->cell_view.e_table_item_view = e_table_item_view; toggle_view->canvas = canvas; - toggle_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window); return (ECellView *) toggle_view; } +static void +etog_kill_view (ECellView *ecell_view) +{ + g_free (ecell_view); +} + +static void +etog_realize (ECellView *ecell_view) +{ + ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; + + toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window); +} + /* * ECell::unrealize method */ @@ -63,8 +77,6 @@ etog_unrealize (ECellView *ecv) gdk_gc_unref (toggle_view->gc); toggle_view->gc = NULL; - - g_free (toggle_view); } /* @@ -81,7 +93,7 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable, ArtPixBuf *art; int x, y, width, height; const int value = GPOINTER_TO_INT ( - e_table_model_value_at (ecell_view->table_model, model_col, row)); + e_table_model_value_at (ecell_view->e_table_model, model_col, row)); if (value >= toggle->n_states){ g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", @@ -173,7 +185,7 @@ etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int r if (value >= toggle->n_states) value = 0; - e_table_model_set_value_at (toggle_view->cell_view.table_model, + e_table_model_set_value_at (toggle_view->cell_view.e_table_model, model_col, row, GINT_TO_POINTER (value)); etog_queue_redraw (toggle_view, view_col, row); } @@ -185,7 +197,7 @@ static gint etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) { ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - void *_value = e_table_model_value_at (ecell_view->table_model, model_col, row); + void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); const int value = GPOINTER_TO_INT (_value); switch (event->type){ @@ -237,7 +249,9 @@ e_cell_toggle_class_init (GtkObjectClass *object_class) ECellClass *ecc = (ECellClass *) object_class; object_class->destroy = etog_destroy; - + + ecc->new_view = etog_new_view; + ecc->kill_view = etog_kill_view; ecc->realize = etog_realize; ecc->unrealize = etog_unrealize; ecc->draw = etog_draw; |