From 1d65e8b601afbdb5b6ce4586dbe5ceba6453a350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 15 Feb 2016 13:06:23 +0000 Subject: [PATCH] gtk-demo: add menu separator demo doesn't much look like the menu separator in a real menu though. https://bugzilla.gnome.org/show_bug.cgi?id=762080 --- demos/gtk-demo/foreigndrawing.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c index d3ee056f99..5488fce2d7 100644 --- a/demos/gtk-demo/foreigndrawing.c +++ b/demos/gtk-demo/foreigndrawing.c @@ -150,6 +150,7 @@ draw_menu (GtkWidget *widget, GtkStyleContext *checkmenuitem_context; GtkStyleContext *radiomenuitem_context; GtkStyleContext *disablemenuitem_context; + GtkStyleContext *separatormenuitem_context; /* This information is taken from the GtkMenu docs, see "CSS nodes" */ menu_context = get_style (gtk_widget_get_style_context(widget), "menu"); @@ -195,20 +196,25 @@ draw_menu (GtkWidget *widget, gtk_render_frame (checkmenuitem_context, cr, x + width - 18, y + 40, 16, 16); gtk_render_check (checkmenuitem_context, cr, x + width - 18, y + 40, 16, 16); - gtk_render_background (menuitem_context, cr, x, y + 60, width, 20); - gtk_render_frame (menuitem_context, cr, x, y + 60, width, 20); + /* draw separator */ + separatormenuitem_context = get_style (menuitem_context, "separator:disabled"); + gtk_render_line (separatormenuitem_context, cr, x + 1, y + 60, x + width - 2, y + 60); + + gtk_render_background (menuitem_context, cr, x, y + 70, width, 20); + gtk_render_frame (menuitem_context, cr, x, y + 70, width, 20); /* radio checked, sensitive */ radiomenuitem_context = get_style (menuitem_context, "radio:checked"); - gtk_render_frame (radiomenuitem_context, cr, x + 2, y + 60, 16, 16); - gtk_render_option (radiomenuitem_context, cr, x + 2, y + 60, 16, 16); + gtk_render_frame (radiomenuitem_context, cr, x + 2, y + 70, 16, 16); + gtk_render_option (radiomenuitem_context, cr, x + 2, y + 70, 16, 16); g_object_unref (radiomenuitem_context); /* radio unchecked, insensitive */ radiomenuitem_context = get_style (disablemenuitem_context, "radio"); - gtk_render_frame (radiomenuitem_context, cr, x + width - 18, y + 60, 16, 16); - gtk_render_option (radiomenuitem_context, cr, x + width - 18, y + 60, 16, 16); + gtk_render_frame (radiomenuitem_context, cr, x + width - 18, y + 70, 16, 16); + gtk_render_option (radiomenuitem_context, cr, x + width - 18, y + 70, 16, 16); + g_object_unref (separatormenuitem_context); g_object_unref (disablemenuitem_context); g_object_unref (radiomenuitem_context); g_object_unref (checkmenuitem_context); @@ -296,7 +302,6 @@ draw_notebook (GtkWidget *widget, g_object_unref (notebook_context); } - static void draw_horizontal_scrollbar (GtkWidget *widget, cairo_t *cr, @@ -568,11 +573,11 @@ draw_cb (GtkWidget *widget, draw_radio (widget, cr, 100, 130, GTK_STATE_FLAG_CHECKED); draw_progress (widget, cr, 10, 160, panewidth - 20, 6, 50); - draw_menu (widget, cr, 10 + panewidth, 10, panewidth - 20, 80); + draw_menu (widget, cr, 10 + panewidth, 10, panewidth - 20, 90); - draw_menubar (widget, cr, 10 + panewidth, 100, panewidth - 20, 20); + draw_menubar (widget, cr, 10 + panewidth, 110, panewidth - 20, 20); - draw_spinbutton (widget, cr, 10 + panewidth, 130, panewidth - 20); + draw_spinbutton (widget, cr, 10 + panewidth, 140, panewidth - 20); draw_notebook (widget, cr, 10, 200, panewidth - 20, 160);