Struct gtk4::PageSetup[][src]

pub struct PageSetup(_);
Expand description

A PageSetup 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 PrintOperation when printing. The benefit of splitting this out of the PrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints.

Margins

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 PageSetup use new() to get the defaults, or use print_run_page_setup_dialog() to show the page setup dialog and receive the resulting page setup.

A page setup dialog

⚠️ The following code is in c ⚠️

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;
}

Implements

glib::ObjectExt

Implementations

Creates a new PageSetup.

Returns

a new PageSetup.

Reads the page setup from the file file_name.

Returns a new PageSetup object with the restored page setup, or None if an error occurred. See to_file().

file_name

the filename to read the page setup from

Returns

the restored PageSetup

Desrialize a page setup from an a{sv} variant.

The variant must be in the format produced by to_gvariant().

variant

an a{sv} GVariant

Returns

a new PageSetup object

Reads the page setup from the group group_name in the key file key_file.

Returns a new PageSetup object with the restored page setup, or None 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 to use the default name “Page Setup”

Returns

the restored PageSetup

Copies a PageSetup.

Returns

a copy of self

Gets the bottom margin in units of unit.

unit

the unit for the return value

Returns

the bottom margin

Gets the left margin in units of unit.

unit

the unit for the return value

Returns

the left margin

Gets the page orientation of the PageSetup.

Returns

the page orientation

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See paper_height().

unit

the unit for the return value

Returns

the page height.

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See paper_width().

unit

the unit for the return value

Returns

the page width.

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See page_height().

unit

the unit for the return value

Returns

the paper height.

Gets the paper size of the PageSetup.

Returns

the paper size

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See page_width().

unit

the unit for the return value

Returns

the paper width.

Gets the right margin in units of unit.

unit

the unit for the return value

Returns

the right margin

Gets the top margin in units of unit.

unit

the unit for the return value

Returns

the top margin

Reads the page setup from the file file_name.

See to_file().

file_name

the filename to read the page setup from

Returns

true on success

Reads the page setup from the group group_name in the key file key_file.

key_file

the GKeyFile to retrieve the page_setup from

group_name

the name of the group in the key_file to read to use the default name “Page Setup”

Returns

true on success

Sets the bottom margin of the PageSetup.

margin

the new bottom margin in units of unit

unit

the units for margin

Sets the left margin of the PageSetup.

margin

the new left margin in units of unit

unit

the units for margin

Sets the page orientation of the PageSetup.

orientation

a PageOrientation value

Sets the paper size of the PageSetup without changing the margins.

See set_paper_size_and_default_margins().

size

a PaperSize

Sets the paper size of the PageSetup and modifies the margins according to the new paper size.

size

a PaperSize

Sets the right margin of the PageSetup.

margin

the new right margin in units of unit

unit

the units for margin

Sets the top margin of the PageSetup.

margin

the new top margin in units of unit

unit

the units for margin

This function saves the information from self to file_name.

file_name

the file to save to

Returns

true on success

Serialize page setup to an a{sv} variant.

Returns

a new, floating, GVariant

This function adds the page setup from self to key_file.

key_file

the GKeyFile to save the page setup to

group_name

the group to add the settings to in key_file, or None to use the default name “Page Setup”

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Same as emit but takes Value for the arguments.

Emit signal by its name.

Same as emit_by_name but takes Value for the arguments.

Emit signal with details by signal id.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.