diff options
author | Miguel de Icaza <miguel@gnu.org> | 1999-12-01 13:45:51 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-12-01 13:45:51 +0800 |
commit | 8fcf8db2b22d66d6984b0c12b4864f285f4531ad (patch) | |
tree | d58e5a9eb6ff793d28dd5ad1db798002cca35da5 /widgets/e-cell-checkbox.c | |
parent | 0177093e774a519891d4432bf87f5fa6e6c9656d (diff) | |
download | gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar.gz gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar.bz2 gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar.lz gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar.xz gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.tar.zst gsoc2013-evolution-8fcf8db2b22d66d6984b0c12b4864f285f4531ad.zip |
This one derives from e-cell-toggle.
1999-11-30 Miguel de Icaza <miguel@gnu.org>
* e-cell-checkbox.c (e_cell_checkbox_new): This one derives from
e-cell-toggle.
* check-emtpy.xpm, check-filled.xpm: new files.
* e-cell-toggle.c (etog_draw): Paint in white.
If we have transparency enabled, do the nice alpha computation.
* test-table.c, test-cols.c: new files; They implement the split
tests.
svn path=/trunk/; revision=1447
Diffstat (limited to 'widgets/e-cell-checkbox.c')
-rw-r--r-- | widgets/e-cell-checkbox.c | 157 |
1 files changed, 8 insertions, 149 deletions
diff --git a/widgets/e-cell-checkbox.c b/widgets/e-cell-checkbox.c index db74464d5c..73620b9ce4 100644 --- a/widgets/e-cell-checkbox.c +++ b/widgets/e-cell-checkbox.c @@ -17,169 +17,28 @@ #include "e-util.h" #include "e-table-item.h" -#define PARENT_TYPE e_cell_get_type() +#include "check-empty.xpm" +#include "check-filled.xpm" -typedef struct { - ECellView cell_view; - GdkGC *gc; - GnomeCanvas *canvas; - ETableItem *eti; -} ECellCheckboxView; +#define PARENT_TYPE e_cell_toggle_get_type() -static ECellClass *parent_class; - -static void -eccb_queue_redraw (ECellCheckboxView *text_view, int col, int row) -{ - e_table_item_redraw_range (text_view->eti, col, row, col, row); -} - -/* - * ECell::realize method - */ -static ECellView * -eecb_realize (ECell *ecell, void *view) -{ - ECellCheckbox *eccb = E_CELL_CHECKBOX (ecell); - ECellCheckboxView *check_view = g_new0 (ECellCheckboxView, 1); - ETableItem *eti = E_TABLE_ITEM (view); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; - - check_view->cell_view.ecell = ecell; - check_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window); - check_view->eti = eti; - check_view->canvas = canvas; - - return (ECellView *) check_view; -} - -/* - * ECell::unrealize method - */ -static void -eecb_unrealize (ECellView *ecv) -{ - ECellCheckboxView *check_view = (ECellCheckboxView *) ecv; - - gdk_gc_unref (check_view->gc); - text_view->gc = NULL; - - g_free (check_view); -} - -/* - * ECell::draw method - */ -static void -eecb_draw (ECellView *ecell_view, GdkDrawable *drawable, - int col, int row, gboolean selected, - int x1, int y1, int x2, int y2) -{ -} - -/* - * ECell::event method - */ -static gint -eecb_event (ECellView *ecell_view, GdkEvent *event, int col, int row) -{ - ECellCheckboxView *text_view = (ECellCheckboxView *) ecell_view; - - switch (event->type){ - case GDK_BUTTON_PRESS: - /* - * Adjust for the border we use - */ - event->button.x++; - - printf ("Button pressed at %g %g\n", event->button.x, event->button.y); - if (text_view->edit){ - printf ("FIXME: Should handle click here\n"); - } else - e_table_item_enter_edit (text_view->eti, col, row); - break; - - case GDK_BUTTON_RELEASE: - /* - * Adjust for the border we use - */ - event->button.x++; - printf ("Button released at %g %g\n", event->button.x, event->button.y); - return TRUE; - - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Escape){ - eecb_cancel_edit (text_view); - return TRUE; - } - - if (!text_view->edit){ - e_table_item_enter_edit (text_view->eti, col, row); - eecb_edit_seleecb_all (text_view); - } - - gtk_widget_event (GTK_WIDGET (text_view->edit->entry), event); - eecb_queue_redraw (text_view, col, row); - break; - - case GDK_KEY_RELEASE: - break; - - default: - return FALSE; - } - return TRUE; -} - -/* - * ECell::height method - */ -static int -eecb_height (ECellView *ecell_view, int col, int row) -{ - return 10; -} - -/* - * ECellView::enter_edit method - */ -static void * -eecb_enter_edit (ECellView *ecell_view, int col, int row) -{ -} - -/* - * ECellView::leave_edit method - */ -static void -eecb_leave_edit (ECellView *ecell_view, int col, int row, void *edit_context) -{ -} +static GdkPixbuf *checks [2]; static void e_cell_checkbox_class_init (GtkObjectClass *object_class) { - ECellClass *ecc = (ECellClass *) object_class; - - ecc->realize = eecb_realize; - ecc->unrealize = eecb_unrealize; - ecc->draw = eecb_draw; - ecc->event = eecb_event; - ecc->height = eecb_height; - ecc->enter_edit = eecb_enter_edit; - ecc->leave_edit = eecb_leave_edit; - - parent_class = gtk_type_class (PARENT_TYPE); + checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); + checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm); } -E_MAKE_TYPE(e_cell_text, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE); +E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE); ECell * e_cell_checkbox_new (ETableModel *etm) { ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ()); - E_CELL (eccb)->table_model = etm; + e_cell_toggle_construct (E_CELL_TOGGLE (eccb), etm, 2, 2, checks); return (ECell *) eccb; } |