From 6d460ba3fe4d476c11423ae7c1639922b6ea1eac Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 21 Jun 2000 00:11:50 +0000 Subject: Built a system for doing selections and/or a cursor in canvas. 2000-06-20 Christopher James Lahey * e-canvas.c, e-canvas.h: Built a system for doing selections and/or a cursor in canvas. svn path=/trunk/; revision=3655 --- e-util/e-canvas.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'e-util/e-canvas.h') diff --git a/e-util/e-canvas.h b/e-util/e-canvas.h index f1ff1195c9..9e572a1179 100644 --- a/e-util/e-canvas.h +++ b/e-util/e-canvas.h @@ -41,6 +41,16 @@ extern "C" { typedef void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item, gint flags); +typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item, + gint flags, + gpointer user_data); +/* Returns the same as strcmp does. */ +typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item, + gpointer data1, + gpointer data2, + gint flags); + + typedef struct _ECanvas ECanvas; typedef struct _ECanvasClass ECanvasClass; @@ -50,11 +60,18 @@ enum { E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14 }; +enum { + E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */ + E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */ + E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2, +}; + struct _ECanvas { - GnomeCanvas parent; - - int idle_id; + GnomeCanvas parent; + + int idle_id; + GList *selection; }; struct _ECanvasClass @@ -76,6 +93,16 @@ void e_canvas_item_request_reflow (GnomeCanvasItem *item); void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item); void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func); +void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func); +void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func); + +void e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id); +void e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id); +void e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id); + +/* Not implemented yet. */ +void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id); + #ifdef __cplusplus } #endif /* __cplusplus */ -- cgit