GtkPageSetup — Stores page setup information
GObject ╰── GtkPageSetup
#include <gtk/gtk.h>
A GtkPageSetup object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the GtkPrintOperation when printing. The benefit of splitting this out of the GtkPrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints.
The margins specified in this object are the “print margins”, i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.
To obtain a GtkPageSetup use gtk_page_setup_new()
to get the defaults, or use gtk_print_run_page_setup_dialog()
to show the page setup dialog and receive the resulting page setup.
static GtkPrintSettings *settings = NULL; static GtkPageSetup *page_setup = NULL; static void do_page_setup (void) { GtkPageSetup *new_page_setup; if (settings == NULL) settings = gtk_print_settings_new (); new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); if (page_setup) g_object_unref (page_setup); page_setup = new_page_setup; }
Printing support was added in GTK+ 2.10.
GtkPageSetup *
gtk_page_setup_new (void
);
Creates a new GtkPageSetup.
a new GtkPageSetup.
Since: 2.10
GtkPageSetup *
gtk_page_setup_copy (GtkPageSetup *other
);
Copies a GtkPageSetup.
other | the GtkPageSetup to copy |
a copy of other
.
[transfer full]
Since: 2.10
GtkPageOrientation
gtk_page_setup_get_orientation (GtkPageSetup *setup
);
Gets the page orientation of the GtkPageSetup.
setup |
the page orientation
Since: 2.10
void gtk_page_setup_set_orientation (GtkPageSetup *setup
,GtkPageOrientation orientation
);
Sets the page orientation of the GtkPageSetup.
setup | ||
orientation | a GtkPageOrientation value |
Since: 2.10
GtkPaperSize *
gtk_page_setup_get_paper_size (GtkPageSetup *setup
);
Gets the paper size of the GtkPageSetup.
setup |
the paper size.
[transfer none]
Since: 2.10
void gtk_page_setup_set_paper_size (GtkPageSetup *setup
,GtkPaperSize *size
);
Sets the paper size of the GtkPageSetup without changing the margins. See gtk_page_setup_set_paper_size_and_default_margins()
.
setup | ||
size |
Since: 2.10
gdouble gtk_page_setup_get_top_margin (GtkPageSetup *setup
,GtkUnit unit
);
Gets the top margin in units of unit
.
setup | ||
unit | the unit for the return value |
the top margin
Since: 2.10
void gtk_page_setup_set_top_margin (GtkPageSetup *setup
,gdouble margin
,GtkUnit unit
);
Sets the top margin of the GtkPageSetup.
setup | ||
margin | the new top margin in units of | |
unit | the units for |
Since: 2.10
gdouble gtk_page_setup_get_bottom_margin (GtkPageSetup *setup
,GtkUnit unit
);
Gets the bottom margin in units of unit
.
setup | ||
unit | the unit for the return value |
the bottom margin
Since: 2.10
void gtk_page_setup_set_bottom_margin (GtkPageSetup *setup
,gdouble margin
,GtkUnit unit
);
Sets the bottom margin of the GtkPageSetup.
setup | ||
margin | the new bottom margin in units of | |
unit | the units for |
Since: 2.10
gdouble gtk_page_setup_get_left_margin (GtkPageSetup *setup
,GtkUnit unit
);
Gets the left margin in units of unit
.
setup | ||
unit | the unit for the return value |
the left margin
Since: 2.10
void gtk_page_setup_set_left_margin (GtkPageSetup *setup
,gdouble margin
,GtkUnit unit
);
Sets the left margin of the GtkPageSetup.
setup | ||
margin | the new left margin in units of | |
unit | the units for |
Since: 2.10
gdouble gtk_page_setup_get_right_margin (GtkPageSetup *setup
,GtkUnit unit
);
Gets the right margin in units of unit
.
setup | ||
unit | the unit for the return value |
the right margin
Since: 2.10
void gtk_page_setup_set_right_margin (GtkPageSetup *setup
,gdouble margin
,GtkUnit unit
);
Sets the right margin of the GtkPageSetup.
setup | ||
margin | the new right margin in units of | |
unit | the units for |
Since: 2.10
void gtk_page_setup_set_paper_size_and_default_margins (GtkPageSetup *setup
,GtkPaperSize *size
);
Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.
setup | ||
size |
Since: 2.10
gdouble gtk_page_setup_get_paper_width (GtkPageSetup *setup
,GtkUnit unit
);
Returns the paper width in units of unit
.
Note that this function takes orientation, but not margins into consideration. See gtk_page_setup_get_page_width()
.
setup | ||
unit | the unit for the return value |
the paper width.
Since: 2.10
gdouble gtk_page_setup_get_paper_height (GtkPageSetup *setup
,GtkUnit unit
);
Returns the paper height in units of unit
.
Note that this function takes orientation, but not margins into consideration. See gtk_page_setup_get_page_height()
.
setup | ||
unit | the unit for the return value |
the paper height.
Since: 2.10
gdouble gtk_page_setup_get_page_width (GtkPageSetup *setup
,GtkUnit unit
);
Returns the page width in units of unit
.
Note that this function takes orientation and margins into consideration. See gtk_page_setup_get_paper_width()
.
setup | ||
unit | the unit for the return value |
the page width.
Since: 2.10
gdouble gtk_page_setup_get_page_height (GtkPageSetup *setup
,GtkUnit unit
);
Returns the page height in units of unit
.
Note that this function takes orientation and margins into consideration. See gtk_page_setup_get_paper_height()
.
setup | ||
unit | the unit for the return value |
the page height.
Since: 2.10
GtkPageSetup * gtk_page_setup_new_from_file (const gchar *file_name
,GError **error
);
Reads the page setup from the file file_name
. Returns a new GtkPageSetup object with the restored page setup, or NULL
if an error occurred. See gtk_page_setup_to_file()
.
file_name | the filename to read the page setup from. | [type filename] |
error | return location for an error, or | [allow-none] |
the restored GtkPageSetup
Since: 2.12
GtkPageSetup * gtk_page_setup_new_from_key_file (GKeyFile *key_file
,const gchar *group_name
,GError **error
);
Reads the page setup from the group group_name
in the key file key_file
. Returns a new GtkPageSetup object with the restored page setup, or NULL
if an error occurred.
key_file | the GKeyFile to retrieve the page_setup from | |
group_name | the name of the group in the key_file to read, or | [allow-none] |
error | return location for an error, or | [allow-none] |
the restored GtkPageSetup
Since: 2.12
GtkPageSetup *
gtk_page_setup_new_from_gvariant (GVariant *variant
);
Desrialize a page setup from an a{sv} variant in the format produced by gtk_page_setup_to_gvariant()
.
variant | an a{sv} GVariant |
Since: 3.22
gboolean gtk_page_setup_load_file (GtkPageSetup *setup
,const char *file_name
,GError **error
);
Reads the page setup from the file file_name
. See gtk_page_setup_to_file()
.
setup | ||
file_name | the filename to read the page setup from. | [type filename] |
error | return location for an error, or | [allow-none] |
TRUE
on success
Since: 2.14
gboolean gtk_page_setup_load_key_file (GtkPageSetup *setup
,GKeyFile *key_file
,const gchar *group_name
,GError **error
);
Reads the page setup from the group group_name
in the key file key_file
.
setup | ||
key_file | the GKeyFile to retrieve the page_setup from | |
group_name | the name of the group in the key_file to read, or | [allow-none] |
error | return location for an error, or | [allow-none] |
TRUE
on success
Since: 2.14
gboolean gtk_page_setup_to_file (GtkPageSetup *setup
,const char *file_name
,GError **error
);
This function saves the information from setup
to file_name
.
setup | ||
file_name | the file to save to. | [type filename] |
error | return location for errors, or | [allow-none] |
TRUE
on success
Since: 2.12
void gtk_page_setup_to_key_file (GtkPageSetup *setup
,GKeyFile *key_file
,const gchar *group_name
);
This function adds the page setup from setup
to key_file
.
setup | ||
key_file | the GKeyFile to save the page setup to | |
group_name | the group to add the settings to in | [nullable] |
Since: 2.12
GVariant *
gtk_page_setup_to_gvariant (GtkPageSetup *setup
);
Serialize page setup to an a{sv} variant.
Return: (transfer none): a new, floating, GVariant
setup |
Since: 3.22
typedef struct _GtkPageSetup GtkPageSetup;
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk3/3.24/GtkPageSetup.html