diff options
-rw-r--r-- | widgets/e-table/ChangeLog | 4 | ||||
-rw-r--r-- | widgets/e-table/e-cell-text.c | 75 | ||||
-rw-r--r-- | widgets/e-table/e-cell-text.h | 2 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 75 | ||||
-rw-r--r-- | widgets/table/e-cell-text.h | 2 |
5 files changed, 154 insertions, 4 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 706a51cf35..53d7990c65 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,5 +1,9 @@ 2000-05-26 Christopher James Lahey <clahey@helixcode.com> + * e-cell-text.c, e-cell-text.h: Added "strikeout_column" argument. + +2000-05-26 Christopher James Lahey <clahey@helixcode.com> + * e-table-group-container.c, e-table-group-container.h, e-table-group-leaf.c, e-table-group-leaf.h, e-table.c, e-table.h: Made "drawgrid", "drawfocus", "spreadsheet", and diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c index 68d70b2fed..639abd8ca5 100644 --- a/widgets/e-table/e-cell-text.c +++ b/widgets/e-table/e-cell-text.c @@ -70,7 +70,8 @@ enum { ARG_TEXT_WIDTH, ARG_TEXT_HEIGHT, ARG_USE_ELLIPSIS, - ARG_ELLIPSIS + ARG_ELLIPSIS, + ARG_STRIKEOUT_COLUMN, }; @@ -550,6 +551,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, 1, height); } + if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { + gdk_draw_rectangle (drawable, + text_view->gc, + TRUE, + xpos + x1, ypos + y1 - (font->ascent / 2), + gdk_text_width (font, + lines->text, + lines->length), + 1); + } ypos += height; lines ++; } @@ -597,6 +608,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, lines->text, lines->length); } + if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { + gdk_draw_rectangle (drawable, + text_view->gc, + TRUE, + xpos + x1, ypos + y1 - (font->ascent / 2), + gdk_text_width (font, + lines->text, + lines->length), + 1); + } ypos += height; lines++; } @@ -1055,6 +1076,44 @@ ect_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } +/* Set_arg handler for the text item */ +static void +ect_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ECellText *text; + + text = E_CELL_TEXT (object); + + switch (arg_id) { + case ARG_STRIKEOUT_COLUMN: + if (text->strikeout_column != GTK_VALUE_INT (*arg)) { + text->strikeout_column = GTK_VALUE_INT (*arg); + } + break; + + default: + return; + } +} + +/* Get_arg handler for the text item */ +static void +ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ECellText *text; + + text = E_CELL_TEXT (object); + + switch (arg_id) { + case ARG_STRIKEOUT_COLUMN: + GTK_VALUE_INT (*arg) = text->strikeout_column; + break; + + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} static void e_cell_text_class_init (GtkObjectClass *object_class) @@ -1073,13 +1132,25 @@ e_cell_text_class_init (GtkObjectClass *object_class) ecc->enter_edit = ect_enter_edit; ecc->leave_edit = ect_leave_edit; + object_class->get_arg = ect_get_arg; + object_class->set_arg = ect_set_arg; + parent_class = gtk_type_class (PARENT_TYPE); + gtk_object_add_arg_type ("ECellText::strikeout_column", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_STRIKEOUT_COLUMN); + if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); } -E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE); +static void +e_cell_text_init (ECellText *ect) +{ + ect->strikeout_column = -1; +} + +E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE); ECell * e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify) diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h index ae80235cb6..c410c44cb5 100644 --- a/widgets/e-table/e-cell-text.h +++ b/widgets/e-table/e-cell-text.h @@ -47,6 +47,8 @@ typedef struct { char *ellipsis; /* The ellipsis characters. NULL = "...". */ guint use_ellipsis : 1; /* Whether to use the ellipsis. */ + + int strikeout_column; } ECellText; typedef struct { diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 68d70b2fed..639abd8ca5 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -70,7 +70,8 @@ enum { ARG_TEXT_WIDTH, ARG_TEXT_HEIGHT, ARG_USE_ELLIPSIS, - ARG_ELLIPSIS + ARG_ELLIPSIS, + ARG_STRIKEOUT_COLUMN, }; @@ -550,6 +551,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, 1, height); } + if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { + gdk_draw_rectangle (drawable, + text_view->gc, + TRUE, + xpos + x1, ypos + y1 - (font->ascent / 2), + gdk_text_width (font, + lines->text, + lines->length), + 1); + } ypos += height; lines ++; } @@ -597,6 +608,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, lines->text, lines->length); } + if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { + gdk_draw_rectangle (drawable, + text_view->gc, + TRUE, + xpos + x1, ypos + y1 - (font->ascent / 2), + gdk_text_width (font, + lines->text, + lines->length), + 1); + } ypos += height; lines++; } @@ -1055,6 +1076,44 @@ ect_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } +/* Set_arg handler for the text item */ +static void +ect_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ECellText *text; + + text = E_CELL_TEXT (object); + + switch (arg_id) { + case ARG_STRIKEOUT_COLUMN: + if (text->strikeout_column != GTK_VALUE_INT (*arg)) { + text->strikeout_column = GTK_VALUE_INT (*arg); + } + break; + + default: + return; + } +} + +/* Get_arg handler for the text item */ +static void +ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ECellText *text; + + text = E_CELL_TEXT (object); + + switch (arg_id) { + case ARG_STRIKEOUT_COLUMN: + GTK_VALUE_INT (*arg) = text->strikeout_column; + break; + + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} static void e_cell_text_class_init (GtkObjectClass *object_class) @@ -1073,13 +1132,25 @@ e_cell_text_class_init (GtkObjectClass *object_class) ecc->enter_edit = ect_enter_edit; ecc->leave_edit = ect_leave_edit; + object_class->get_arg = ect_get_arg; + object_class->set_arg = ect_set_arg; + parent_class = gtk_type_class (PARENT_TYPE); + gtk_object_add_arg_type ("ECellText::strikeout_column", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_STRIKEOUT_COLUMN); + if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); } -E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE); +static void +e_cell_text_init (ECellText *ect) +{ + ect->strikeout_column = -1; +} + +E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE); ECell * e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify) diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h index ae80235cb6..c410c44cb5 100644 --- a/widgets/table/e-cell-text.h +++ b/widgets/table/e-cell-text.h @@ -47,6 +47,8 @@ typedef struct { char *ellipsis; /* The ellipsis characters. NULL = "...". */ guint use_ellipsis : 1; /* Whether to use the ellipsis. */ + + int strikeout_column; } ECellText; typedef struct { |