From 82b7d21f6e24c81160e035899e1d95f5e4487ac3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 3 Oct 2014 16:19:34 +0200 Subject: [PATCH] print: Add a .paper style class ... and use it in the print preview. --- docs/reference/gtk/gtk3-sections.txt | 1 + gtk/gtkprintunixdialog.c | 2 ++ gtk/gtkstylecontext.h | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index 9058cd7172..de04e7ff52 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -6013,6 +6013,7 @@ GTK_STYLE_CLASS_NOTEBOOK GTK_STYLE_CLASS_OSD GTK_STYLE_CLASS_OVERSHOOT GTK_STYLE_CLASS_PANE_SEPARATOR +GTK_STYLE_CLASS_PAPER GTK_STYLE_CLASS_POPUP GTK_STYLE_CLASS_PRIMARY_TOOLBAR GTK_STYLE_CLASS_PROGRESSBAR diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 277b28a668..fe62c2d775 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -2212,6 +2212,7 @@ paint_page (GtkWidget *widget, gtk_style_context_save (context); gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_PAPER); gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW); gtk_render_background (context, cr, x, y, width, height); @@ -2750,6 +2751,7 @@ draw_page_cb (GtkWidget *widget, context = gtk_widget_get_style_context (widget); gtk_style_context_save (context); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_PAPER); gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW); pos_x = (width - w) / 2; diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 6184d84096..b2a4c3e787 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -873,6 +873,17 @@ struct _GtkStyleContextClass */ #define GTK_STYLE_CLASS_OVERSHOOT "overshoot" +/* + * GTK_STYLE_CLASS_PAPER: + * A CSS class that is added to areas that should look like paper. + * + * This is used in print previews and themes are encouraged to + * style it as black text on white background. + * + * Since: 3.16 + */ +#define GTK_STYLE_CLASS_PAPER "paper" + /** * GTK_STYLE_REGION_ROW: *