summaryrefslogtreecommitdiff
path: root/gtk/gtkprinter.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2018-04-12 11:31:37 +0200
committerMarek Kasik <mkasik@redhat.com>2018-04-26 14:19:55 +0200
commitb0bb7f3da4b174edc6e3e080849bf1ab950c3818 (patch)
tree3a17077fe948cd0fbff883341a3e7c23d12f944a /gtk/gtkprinter.c
parent9774b9fabd0eb6a07c50ef77e2045c6ae8d19837 (diff)
downloadgtk+-b0bb7f3da4b174edc6e3e080849bf1ab950c3818.tar.gz
Add gtk_printer_get_hard_margins_for_paper_size
to retreive paper size specific hard margins and use this to set the hard margins in the print context. (modified by Marek Kasik <mkasik@redhat.com>) https://bugzilla.gnome.org/show_bug.cgi?id=686109
Diffstat (limited to 'gtk/gtkprinter.c')
-rw-r--r--gtk/gtkprinter.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c
index 8339b5bd7a..d9ce1efadd 100644
--- a/gtk/gtkprinter.c
+++ b/gtk/gtkprinter.c
@@ -970,6 +970,37 @@ gtk_printer_get_hard_margins (GtkPrinter *printer,
}
/**
+ * gtk_printer_get_hard_margins_for_paper_size:
+ * @printer: a #GtkPrinter
+ * @paper_size: a #GtkPaperSize
+ * @top: (out): a location to store the top margin in
+ * @bottom: (out): a location to store the bottom margin in
+ * @left: (out): a location to store the left margin in
+ * @right: (out): a location to store the right margin in
+ *
+ * Retrieve the hard margins of @printer for @paper_size, i.e. the
+ * margins that define the area at the borders of the paper that the
+ * printer cannot print to.
+ *
+ * Note: This will not succeed unless the printer's details are available,
+ * see gtk_printer_has_details() and gtk_printer_request_details().
+ *
+ * Return value: %TRUE iff the hard margins were retrieved
+ */
+gboolean
+gtk_printer_get_hard_margins_for_paper_size (GtkPrinter *printer,
+ GtkPaperSize *paper_size,
+ gdouble *top,
+ gdouble *bottom,
+ gdouble *left,
+ gdouble *right)
+{
+ GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
+
+ return backend_class->printer_get_hard_margins_for_paper_size (printer, paper_size, top, bottom, left, right);
+}
+
+/**
* gtk_printer_get_capabilities:
* @printer: a #GtkPrinter
*