aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-04-20 04:22:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-04-20 04:22:24 +0800
commitc1f065e586d586c25c669e67d6b57b50804e243a (patch)
tree026454f56ee1b01c364f8b74715b88757615148c /widgets
parent562c2676e0752a30a3afd98e2c724405ce927782 (diff)
downloadgsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar.gz
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar.bz2
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar.lz
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar.xz
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.tar.zst
gsoc2013-evolution-c1f065e586d586c25c669e67d6b57b50804e243a.zip
print the cell in the allotted area (etog_print_height): return the print
2002-04-19 JP Rosevear <jpr@ximian.com> * e-cell-toggle.c (etog_print): print the cell in the allotted area (etog_print_height): return the print height svn path=/trunk/; revision=16536
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-cell-toggle.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 0961b077ba..af451c6b73 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -301,6 +301,61 @@ etog_height (ECellView *ecell_view, int model_col, int view_col, int row)
}
/*
+ * ECell::print method
+ */
+static void
+etog_print (ECellView *ecell_view, GnomePrintContext *context,
+ int model_col, int view_col, int row,
+ double width, double height)
+{
+ ECellToggle *toggle = E_CELL_TOGGLE(ecell_view->ecell);
+ GdkPixbuf *image;
+ int scale;
+ const int value = GPOINTER_TO_INT (
+ e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+
+ if (value >= toggle->n_states){
+ g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
+ value, toggle->n_states);
+ return;
+ }
+
+ gnome_print_gsave(context);
+
+ if (gnome_print_moveto(context, 2, 2) == -1)
+ /* FIXME */;
+ if (gnome_print_lineto(context, width - 2, 2) == -1)
+ /* FIXME */;
+ if (gnome_print_lineto(context, width - 2, height - 2) == -1)
+ /* FIXME */;
+ if (gnome_print_lineto(context, 2, height - 2) == -1)
+ /* FIXME */;
+ if (gnome_print_lineto(context, 2, 2) == -1)
+ /* FIXME */;
+ if (gnome_print_clip(context) == -1)
+ /* FIXME */;
+
+ image = toggle->images[value];
+ scale = MIN (width - 4, height - 4);
+
+ gnome_print_translate (context, 2, (height - scale) / 2);
+ gnome_print_scale (context, scale, scale);
+ gnome_print_pixbuf (context, image);
+
+ gnome_print_grestore(context);
+}
+
+static gdouble
+etog_print_height (ECellView *ecell_view, GnomePrintContext *context,
+ int model_col, int view_col, int row,
+ double width)
+{
+ ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
+
+ return toggle->height;
+}
+
+/*
* ECell::max_width method
*/
static int
@@ -367,6 +422,8 @@ e_cell_toggle_class_init (GtkObjectClass *object_class)
ecc->draw = etog_draw;
ecc->event = etog_event;
ecc->height = etog_height;
+ ecc->print = etog_print;
+ ecc->print_height = etog_print_height;
ecc->max_width = etog_max_width;
ecc->style_set = etog_style_set;