[gnumeric] Improve printing of combo boxes
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve printing of combo boxes
- Date: Wed, 29 Sep 2010 20:56:54 +0000 (UTC)
commit c47205d51db55f84cd91f5d7ec2143d3aac6a432
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Sep 29 14:56:04 2010 -0600
Improve printing of combo boxes
2010-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c (sheet_widget_combo_draw_cairo): new
(sheet_widget_combo_class_init): connect the above
ChangeLog | 5 ++++
src/sheet-object-widget.c | 54 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9a2cabf..703a12a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/sheet-object-widget.c (sheet_widget_combo_draw_cairo): new
+ (sheet_widget_combo_class_init): connect the above
+
+2010-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/sheet-object-widget.c (sheet_widget_button_draw_cairo): new
2010-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index efc0099..8f7027c 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -3680,8 +3680,62 @@ sheet_widget_combo_create_widget (SheetObjectWidget *sow)
}
static void
+sheet_widget_combo_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetWidgetListBase *swl = SHEET_WIDGET_LIST_BASE (so);
+ double halfheight = height/2;
+
+ cairo_save (cr);
+ cairo_set_line_width (cr, 0.5);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, 0, 0);
+ cairo_line_to (cr, width, 0);
+ cairo_line_to (cr, width, height);
+ cairo_line_to (cr, 0, height);
+ cairo_close_path (cr);
+ cairo_stroke (cr);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, width - 10, 0);
+ cairo_rel_line_to (cr, 0, height);
+ cairo_stroke (cr);
+
+ cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, width - 5 -3, halfheight - 4);
+ cairo_rel_line_to (cr, 6, 0);
+ cairo_rel_line_to (cr, -3, 8);
+ cairo_close_path (cr);
+ cairo_fill (cr);
+
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_move_to (cr, 4., halfheight);
+
+ if (swl->model != NULL) {
+ GtkTreeIter iter;
+ if (gtk_tree_model_iter_nth_child (swl->model, &iter, NULL,
+ swl->selection - 1)) {
+ char *str = NULL;
+ gtk_tree_model_get (swl->model, &iter, 0, &str, -1);
+ draw_cairo_text (cr, str, NULL, NULL, TRUE);
+ g_free (str);
+ }
+ }
+
+ cairo_new_path (cr);
+ cairo_restore (cr);
+}
+
+static void
sheet_widget_combo_class_init (SheetObjectWidgetClass *sow_class)
{
+ SheetObjectClass *so_class = SHEET_OBJECT_CLASS (sow_class);
+
+ so_class->draw_cairo = &sheet_widget_combo_draw_cairo;
sow_class->create_widget = &sheet_widget_combo_create_widget;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]