PageSetup

open class PageSetup : GLibObject.Object, PageSetupProtocol

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 PageSetup type acts as a reference-counted owner of an underlying GtkPageSetup instance. It provides the methods that can operate on this data type through PageSetupProtocol conformance. Use PageSetup as a strong reference or owner of a GtkPageSetup instance.

  • Designated initialiser from the underlying `C` data type.
    

    This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GtkPageSetup>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GtkPageSetup>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    override public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    override public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GtkPageSetup>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GtkPageSetup>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GtkPageSetup. i.e., ownership is transferred to the PageSetup instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GtkPageSetup>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements PageSetupProtocol Will retain GtkPageSetup.

    Declaration

    Swift

    @inlinable
    public init<T>(pageSetup other: T) where T : PageSetupProtocol

    Parameters

    other

    an instance of a related type that implements PageSetupProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    required public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PageSetupProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates a new GtkPageSetup.

    Declaration

    Swift

    @inlinable
    public init()
  • Reads the page setup from the file file_name.

    Returns a new GtkPageSetup object with the restored page setup, or nil if an error occurred. See [methodGtk.PageSetup.to_file].

    Declaration

    Swift

    @inlinable
    public init(file fileName: UnsafePointer<CChar>!) throws
  • Desrialize a page setup from an a{sv} variant.

    The variant must be in the format produced by [methodGtk.PageSetup.to_gvariant].

    Declaration

    Swift

    @inlinable
    public init<VariantT>(gvariant variant: VariantT) where VariantT : VariantProtocol
  • 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 nil if an error occurred.

    Declaration

    Swift

    @inlinable
    public init<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<CChar>? = nil) throws where KeyFileT : KeyFileProtocol
  • Reads the page setup from the file file_name.

    Returns a new GtkPageSetup object with the restored page setup, or nil if an error occurred. See [methodGtk.PageSetup.to_file].

    Declaration

    Swift

    @inlinable
    public static func newFrom(file fileName: UnsafePointer<CChar>!) throws -> PageSetup!
  • Desrialize a page setup from an a{sv} variant.

    The variant must be in the format produced by [methodGtk.PageSetup.to_gvariant].

    Declaration

    Swift

    @inlinable
    public static func newFromG<VariantT>(gvariant variant: VariantT) -> PageSetup! where VariantT : VariantProtocol
  • 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 nil if an error occurred.

    Declaration

    Swift

    @inlinable
    public static func newFrom<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<CChar>? = nil) throws -> PageSetup! where KeyFileT : KeyFileProtocol