aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-cell.c')
-rw-r--r--widgets/table/e-cell.c115
1 files changed, 95 insertions, 20 deletions
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 9a11c2362e..3045081cc4 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -28,6 +28,8 @@
#define PARENT_TYPE gtk_object_get_type ()
+#define ECVIEW_EC_CLASS(v) (E_CELL_CLASS (GTK_OBJECT ((v)->ecell)->klass))
+
static ECellView *
ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
{
@@ -104,6 +106,22 @@ ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void
{
}
+static void *
+ec_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context)
+{
+ return NULL;
+}
+
+static void
+ec_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state)
+{
+}
+
+static void
+ec_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
+{
+}
+
static void
ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip)
{
@@ -126,6 +144,9 @@ e_cell_class_init (GtkObjectClass *object_class)
ecc->height = ec_height;
ecc->enter_edit = ec_enter_edit;
ecc->leave_edit = ec_leave_edit;
+ ecc->save_state = ec_save_state;
+ ecc->load_state = ec_load_state;
+ ecc->free_state = ec_free_state;
ecc->print = NULL;
ecc->print_height = NULL;
ecc->max_width = NULL;
@@ -156,7 +177,7 @@ E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE)
gint
e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event (
+ return ECVIEW_EC_CLASS(ecell_view)->event (
ecell_view, event, model_col, view_col, row, flags, actions);
}
@@ -193,7 +214,7 @@ e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view
void
e_cell_realize (ECellView *ecell_view)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view);
+ ECVIEW_EC_CLASS(ecell_view)->realize (ecell_view);
}
/**
@@ -205,7 +226,7 @@ e_cell_realize (ECellView *ecell_view)
void
e_cell_kill_view (ECellView *ecell_view)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view);
+ ECVIEW_EC_CLASS(ecell_view)->kill_view (ecell_view);
}
/**
@@ -219,7 +240,7 @@ e_cell_kill_view (ECellView *ecell_view)
void
e_cell_unrealize (ECellView *ecell_view)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view);
+ ECVIEW_EC_CLASS(ecell_view)->unrealize (ecell_view);
}
/**
@@ -250,8 +271,7 @@ e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
g_return_if_fail (row >= 0);
g_return_if_fail (row < e_table_model_row_count(ecell_view->e_table_model));
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
- ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
+ ECVIEW_EC_CLASS(ecell_view)->draw (ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
}
/**
@@ -271,8 +291,7 @@ e_cell_print (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row,
double width, double height)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print
- (ecell_view, context, model_col, view_col, row, width, height);
+ ECVIEW_EC_CLASS(ecell_view)->print (ecell_view, context, model_col, view_col, row, width, height);
}
/**
@@ -285,8 +304,8 @@ e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row,
double width)
{
- if (E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height)
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height
+ if (ECVIEW_EC_CLASS(ecell_view)->print_height)
+ return ECVIEW_EC_CLASS(ecell_view)->print_height
(ecell_view, context, model_col, view_col, row, width);
else
return 0.0;
@@ -305,8 +324,7 @@ e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
int
e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height (
- ecell_view, model_col, view_col, row);
+ return ECVIEW_EC_CLASS(ecell_view)->height (ecell_view, model_col, view_col, row);
}
/**
@@ -322,8 +340,7 @@ e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
void *
e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit (
- ecell_view, model_col, view_col, row);
+ return ECVIEW_EC_CLASS(ecell_view)->enter_edit (ecell_view, model_col, view_col, row);
}
/**
@@ -340,8 +357,66 @@ e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
void
e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
- ecell_view, model_col, view_col, row, edit_context);
+ ECVIEW_EC_CLASS(ecell_view)->leave_edit (ecell_view, model_col, view_col, row, edit_context);
+}
+
+/**
+ * e_cell_save_state:
+ * @ecell_view: the ECellView to save
+ * @model_col: the column in the model
+ * @view_col: the column in the view
+ * @row: the row
+ * @edit_context: the editing context
+ *
+ * Returns: The save state.
+ *
+ * Requests that the ECellView return a void * representing the state
+ * of the ECell. This is primarily intended for things like selection
+ * or scrolling.
+ */
+void *
+e_cell_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
+{
+ if (ECVIEW_EC_CLASS(ecell_view)->save_state)
+ return ECVIEW_EC_CLASS(ecell_view)->save_state (ecell_view, model_col, view_col, row, edit_context);
+ else
+ return NULL;
+}
+
+/**
+ * e_cell_load_state:
+ * @ecell_view: the ECellView to load
+ * @model_col: the column in the model
+ * @view_col: the column in the view
+ * @row: the row
+ * @edit_context: the editing context
+ * @save_state: the save state to load from
+ *
+ * Requests that the ECellView load from the given save state.
+ */
+void
+e_cell_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context, void *save_state)
+{
+ if (ECVIEW_EC_CLASS(ecell_view)->load_state)
+ ECVIEW_EC_CLASS(ecell_view)->load_state (ecell_view, model_col, view_col, row, edit_context, save_state);
+}
+
+/**
+ * e_cell_load_state:
+ * @ecell_view: the ECellView
+ * @model_col: the column in the model
+ * @view_col: the column in the view
+ * @row: the row
+ * @edit_context: the editing context
+ * @save_state: the save state to free
+ *
+ * Requests that the ECellView free the given save state.
+ */
+void
+e_cell_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
+{
+ if (ECVIEW_EC_CLASS(ecell_view)->free_state)
+ ECVIEW_EC_CLASS(ecell_view)->free_state (ecell_view, model_col, view_col, row, save_state);
}
/**
@@ -356,7 +431,7 @@ e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row,
int
e_cell_max_width (ECellView *ecell_view, int model_col, int view_col)
{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->max_width
+ return ECVIEW_EC_CLASS(ecell_view)->max_width
(ecell_view, model_col, view_col);
}
@@ -364,15 +439,15 @@ void
e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col,
int row, int col_width, ETableTooltip *tooltip)
{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->show_tooltip
+ ECVIEW_EC_CLASS(ecell_view)->show_tooltip
(ecell_view, model_col, view_col, row, col_width, tooltip);
}
gchar *
e_cell_get_bg_color(ECellView *ecell_view, int row)
{
- if (E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->get_bg_color)
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->get_bg_color (ecell_view, row);
+ if (ECVIEW_EC_CLASS(ecell_view)->get_bg_color)
+ return ECVIEW_EC_CLASS(ecell_view)->get_bg_color (ecell_view, row);
else
return NULL;
}