diff options
Diffstat (limited to 'widgets/table/e-cell.h')
-rw-r--r-- | widgets/table/e-cell.h | 340 |
1 files changed, 209 insertions, 131 deletions
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index f38e47bfc4..111736f41c 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -27,14 +27,33 @@ #include <gtk/gtk.h> #include <table/e-table-model.h> +/* Standard GObject macros */ +#define E_TYPE_CELL \ + (e_cell_get_type ()) +#define E_CELL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL, ECell)) +#define E_CELL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL, ECellClass)) +#define E_CELL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL, ECellClass)) +#define E_IS_CELL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL)) +#define E_IS_CELL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL)) +#define E_CELL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL, ECellClass)) + G_BEGIN_DECLS -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_CELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) +typedef struct _ECell ECell; +typedef struct _ECellClass ECellClass; +typedef struct _ECellView ECellView; typedef gboolean (*ETableSearchFunc) (gconstpointer haystack, const gchar *needle); @@ -65,11 +84,7 @@ typedef enum { E_CELL_UNGRAB = 1 << 1 } ECellActions; -typedef struct { - GObject parent; -} ECell; - -typedef struct _ECellView { +struct _ECellView { ECell *ecell; ETableModel *e_table_model; void *e_table_item_view; @@ -79,137 +94,200 @@ typedef struct _ECellView { void (*kill_view_cb) (struct _ECellView*, gpointer ); GList *kill_view_cb_data; -} ECellView; +}; #define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1) -typedef struct { +struct _ECell { + GObject parent; +}; + +struct _ECellClass { GObjectClass parent_class; - ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, gpointer e_table_item_view); - void (*kill_view) (ECellView *ecell_view); - - void (*realize) (ECellView *ecell_view); - void (*unrealize) (ECellView *ecell_view); - - void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, - gint model_col, gint view_col, gint row, - ECellFlags flags, gint x1, gint y1, gint x2, gint y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col, gint row, ECellFlags flags, ECellActions *actions); - void (*focus) (ECellView *ecell_view, gint model_col, gint view_col, - gint row, gint x1, gint y1, gint x2, gint y2); - void (*unfocus) (ECellView *ecell_view); - gint (*height) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - - void *(*enter_edit) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - void (*leave_edit) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context); - void *(*save_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context); - void (*load_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context, gpointer save_state); - void (*free_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer save_state); - void (*print) (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, gint view_col, gint row, - gdouble width, gdouble height); - gdouble (*print_height) (ECellView *ecell_view,GtkPrintContext *context, - gint model_col, gint view_col, gint row, gdouble width); - gint (*max_width) (ECellView *ecell_view, gint model_col, gint view_col); - gint (*max_width_by_row) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - gchar *(*get_bg_color) (ECellView *ecell_view, gint row); - - void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style); -} ECellClass; - -GType e_cell_get_type (void); + ECellView * (*new_view) (ECell *ecell, + ETableModel *table_model, + gpointer e_table_item_view); + void (*kill_view) (ECellView *ecell_view); + + void (*realize) (ECellView *ecell_view); + void (*unrealize) (ECellView *ecell_view); + + void (*draw) (ECellView *ecell_view, + GdkDrawable *drawable, + gint model_col, + gint view_col, gint row, + ECellFlags flags, + gint x1, + gint y1, + gint x2, + gint y2); + gint (*event) (ECellView *ecell_view, + GdkEvent *event, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + ECellActions *actions); + void (*focus) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gint x1, + gint y1, + gint x2, + gint y2); + void (*unfocus) (ECellView *ecell_view); + gint (*height) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + + gpointer (*enter_edit) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + void (*leave_edit) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context); + gpointer (*save_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context); + void (*load_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context, + gpointer save_state); + void (*free_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer save_state); + void (*print) (ECellView *ecell_view, + GtkPrintContext *context, + gint model_col, + gint view_col, + gint row, + gdouble width, + gdouble height); + gdouble (*print_height) (ECellView *ecell_view, + GtkPrintContext *context, + gint model_col, + gint view_col, + gint row, + gdouble width); + gint (*max_width) (ECellView *ecell_view, + gint model_col, + gint view_col); + gint (*max_width_by_row) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + gchar * (*get_bg_color) (ECellView *ecell_view, + gint row); + + void (*style_set) (ECellView *ecell_view, + GtkStyle *previous_style); +}; + +GType e_cell_get_type (void) G_GNUC_CONST; /* View creation methods. */ -ECellView *e_cell_new_view (ECell *ecell, - ETableModel *table_model, - void *e_table_item_view); -void e_cell_kill_view (ECellView *ecell_view); +ECellView * e_cell_new_view (ECell *ecell, + ETableModel *table_model, + gpointer e_table_item_view); +void e_cell_kill_view (ECellView *ecell_view); /* Cell View methods. */ -gint e_cell_event (ECellView *ecell_view, - GdkEvent *event, - gint model_col, - gint view_col, - gint row, - ECellFlags flags, - ECellActions *actions); -void e_cell_realize (ECellView *ecell_view); -void e_cell_unrealize (ECellView *ecell_view); -void e_cell_draw (ECellView *ecell_view, - GdkDrawable *drawable, - gint model_col, - gint view_col, - gint row, - ECellFlags flags, - gint x1, - gint y1, - gint x2, - gint y2); -void e_cell_print (ECellView *ecell_view, +gint e_cell_event (ECellView *ecell_view, + GdkEvent *event, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + ECellActions *actions); +void e_cell_realize (ECellView *ecell_view); +void e_cell_unrealize (ECellView *ecell_view); +void e_cell_draw (ECellView *ecell_view, + GdkDrawable *drawable, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + gint x1, + gint y1, + gint x2, + gint y2); +void e_cell_print (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, - gint view_col, - gint row, - gdouble width, - gdouble height); -gdouble e_cell_print_height (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gdouble width, + gdouble height); +gdouble e_cell_print_height (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, - gint view_col, - gint row, - gdouble width); -gint e_cell_max_width (ECellView *ecell_view, - gint model_col, - gint view_col); -gint e_cell_max_width_by_row (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view); -gchar *e_cell_get_bg_color (ECellView *ecell_view, - gint row); -void e_cell_style_set (ECellView *ecell_view, - GtkStyle *previous_style); - -void e_cell_focus (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - gint x1, - gint y1, - gint x2, - gint y2); -void e_cell_unfocus (ECellView *ecell_view); -gint e_cell_height (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -void *e_cell_enter_edit (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -void e_cell_leave_edit (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context); -void *e_cell_save_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context); -void e_cell_load_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context, - void *state); -void e_cell_free_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *state); + gint model_col, + gint view_col, + gint row, + gdouble width); +gint e_cell_max_width (ECellView *ecell_view, + gint model_col, + gint view_col); +gint e_cell_max_width_by_row (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +gboolean e_cell_max_width_by_row_implemented + (ECellView *ecell_view); +gchar * e_cell_get_bg_color (ECellView *ecell_view, + gint row); +void e_cell_style_set (ECellView *ecell_view, + GtkStyle *previous_style); + +void e_cell_focus (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gint x1, + gint y1, + gint x2, + gint y2); +void e_cell_unfocus (ECellView *ecell_view); +gint e_cell_height (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +gpointer e_cell_enter_edit (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +void e_cell_leave_edit (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context); +gpointer e_cell_save_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context); +void e_cell_load_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context, + gpointer state); +void e_cell_free_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer state); G_END_DECLS |