PageSetupProtocol

public protocol PageSetupProtocol : ObjectProtocol

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.

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 GtkPageSetup use [ctorGtk.PageSetup.new] to get the defaults, or use [funcGtk.print_run_page_setup_dialog] to show the page setup dialog and receive the resulting page setup.

A page setup dialog

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

The PageSetupProtocol protocol exposes the methods and properties of an underlying GtkPageSetup instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see PageSetup. Alternatively, use PageSetupRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkPageSetup instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • page_setup_ptr Default implementation

    Typed pointer to the underlying GtkPageSetup instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkPageSetup instance.

    Declaration

    Swift

    var page_setup_ptr: UnsafeMutablePointer<GtkPageSetup>! { get }
  • Required Initialiser for types conforming to PageSetupProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

PageSetup Class: PageSetupProtocol extension (methods and fields)

  • copy() Extension method

    Copies a GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func copy() -> PageSetupRef!
  • getBottomMargin(unit:) Extension method

    Gets the bottom margin in units of unit.

    Declaration

    Swift

    @inlinable
    func getBottomMargin(unit: GtkUnit) -> CDouble
  • getLeftMargin(unit:) Extension method

    Gets the left margin in units of unit.

    Declaration

    Swift

    @inlinable
    func getLeftMargin(unit: GtkUnit) -> CDouble
  • getOrientation() Extension method

    Gets the page orientation of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func getOrientation() -> GtkPageOrientation
  • getPageHeight(unit:) Extension method

    Returns the page height in units of unit.

    Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_height].

    Declaration

    Swift

    @inlinable
    func getPageHeight(unit: GtkUnit) -> CDouble
  • getPageWidth(unit:) Extension method

    Returns the page width in units of unit.

    Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_width].

    Declaration

    Swift

    @inlinable
    func getPageWidth(unit: GtkUnit) -> CDouble
  • getPaperHeight(unit:) Extension method

    Returns the paper height in units of unit.

    Note that this function takes orientation, but not margins into consideration. See [methodGtk.PageSetup.get_page_height].

    Declaration

    Swift

    @inlinable
    func getPaperHeight(unit: GtkUnit) -> CDouble
  • getPaperSize() Extension method

    Gets the paper size of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func getPaperSize() -> PaperSizeRef!
  • getPaperWidth(unit:) Extension method

    Returns the paper width in units of unit.

    Note that this function takes orientation, but not margins into consideration. See [methodGtk.PageSetup.get_page_width].

    Declaration

    Swift

    @inlinable
    func getPaperWidth(unit: GtkUnit) -> CDouble
  • getRightMargin(unit:) Extension method

    Gets the right margin in units of unit.

    Declaration

    Swift

    @inlinable
    func getRightMargin(unit: GtkUnit) -> CDouble
  • getTopMargin(unit:) Extension method

    Gets the top margin in units of unit.

    Declaration

    Swift

    @inlinable
    func getTopMargin(unit: GtkUnit) -> CDouble
  • loadFile(fileName:) Extension method

    Reads the page setup from the file file_name.

    See [methodGtk.PageSetup.to_file].

    Declaration

    Swift

    @inlinable
    func loadFile(fileName: UnsafePointer<CChar>!) throws -> Bool
  • load(keyFile:groupName:) Extension method

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

    Declaration

    Swift

    @inlinable
    func load<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<CChar>? = nil) throws -> Bool where KeyFileT : KeyFileProtocol
  • setBottom(margin:unit:) Extension method

    Sets the bottom margin of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func setBottom(margin: CDouble, unit: GtkUnit)
  • setLeft(margin:unit:) Extension method

    Sets the left margin of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func setLeft(margin: CDouble, unit: GtkUnit)
  • set(orientation:) Extension method

    Sets the page orientation of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func set(orientation: GtkPageOrientation)
  • setPaper(size:) Extension method

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

    See [methodGtk.PageSetup.set_paper_size_and_default_margins].

    Declaration

    Swift

    @inlinable
    func setPaper<PaperSizeT>(size: PaperSizeT) where PaperSizeT : PaperSizeProtocol
  • Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.

    Declaration

    Swift

    @inlinable
    func setPaperSizeAndDefaultMargins<PaperSizeT>(size: PaperSizeT) where PaperSizeT : PaperSizeProtocol
  • setRight(margin:unit:) Extension method

    Sets the right margin of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func setRight(margin: CDouble, unit: GtkUnit)
  • setTop(margin:unit:) Extension method

    Sets the top margin of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    func setTop(margin: CDouble, unit: GtkUnit)
  • toFile(fileName:) Extension method

    This function saves the information from setup to file_name.

    Declaration

    Swift

    @inlinable
    func toFile(fileName: UnsafePointer<CChar>!) throws -> Bool
  • toGvariant() Extension method

    Serialize page setup to an a{sv} variant.

    Declaration

    Swift

    @inlinable
    func toGvariant() -> GLib.VariantRef!
  • to(keyFile:groupName:) Extension method

    This function adds the page setup from setup to key_file.

    Declaration

    Swift

    @inlinable
    func to<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<CChar>? = nil) where KeyFileT : KeyFileProtocol
  • Runs a page setup dialog, letting the user modify the values from page_setup. If the user cancels the dialog, the returned GtkPageSetup is identical to the passed in page_setup, otherwise it contains the modifications done in the dialog.

    Note that this function may use a recursive mainloop to show the page setup dialog. See gtk_print_run_page_setup_dialog_async() if this is a problem.

    Declaration

    Swift

    @inlinable
    func printRunPageSetupDialog<PrintSettingsT>(parent: WindowRef? = nil, settings: PrintSettingsT) -> PageSetupRef! where PrintSettingsT : PrintSettingsProtocol
  • Runs a page setup dialog, letting the user modify the values from page_setup. If the user cancels the dialog, the returned GtkPageSetup is identical to the passed in page_setup, otherwise it contains the modifications done in the dialog.

    Note that this function may use a recursive mainloop to show the page setup dialog. See gtk_print_run_page_setup_dialog_async() if this is a problem.

    Declaration

    Swift

    @inlinable
    func printRunPageSetupDialog<PrintSettingsT, WindowT>(parent: WindowT?, settings: PrintSettingsT) -> PageSetupRef! where PrintSettingsT : PrintSettingsProtocol, WindowT : WindowProtocol
  • Runs a page setup dialog, letting the user modify the values from page_setup.

    In contrast to gtk_print_run_page_setup_dialog(), this function returns after showing the page setup dialog on platforms that support this, and calls done_cb from a signal handler for the response signal of the dialog.

    Declaration

    Swift

    @inlinable
    func printRunPageSetupDialogAsync<PrintSettingsT>(parent: WindowRef? = nil, settings: PrintSettingsT, doneCb: GtkPageSetupDoneFunc?, data: gpointer! = nil) where PrintSettingsT : PrintSettingsProtocol
  • Runs a page setup dialog, letting the user modify the values from page_setup.

    In contrast to gtk_print_run_page_setup_dialog(), this function returns after showing the page setup dialog on platforms that support this, and calls done_cb from a signal handler for the response signal of the dialog.

    Declaration

    Swift

    @inlinable
    func printRunPageSetupDialogAsync<PrintSettingsT, WindowT>(parent: WindowT?, settings: PrintSettingsT, doneCb: GtkPageSetupDoneFunc?, data: gpointer! = nil) where PrintSettingsT : PrintSettingsProtocol, WindowT : WindowProtocol
  • orientation Extension method

    Gets the page orientation of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    var orientation: GtkPageOrientation { get nonmutating set }
  • paperSize Extension method

    Gets the paper size of the GtkPageSetup.

    Declaration

    Swift

    @inlinable
    var paperSize: PaperSizeRef! { get nonmutating set }