PageSetupRef
public struct PageSetupRef : PageSetupProtocol, GWeakCapturing
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 PageSetupRef
type acts as a lightweight Swift reference to an underlying GtkPageSetup
instance.
It exposes methods that can operate on this data type through PageSetupProtocol
conformance.
Use PageSetupRef
only as an unowned
reference to an existing GtkPageSetup
instance.
-
Untyped pointer to the underlying `GtkPageSetup` instance.
For type-safe access, use the generated, typed pointer
page_setup_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkPageSetup>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkPageSetup>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkPageSetup>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkPageSetup>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
PageSetupProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : PageSetupProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> PageSetupRef where T : PageSetupProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PageSetupProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PageSetupProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PageSetupProtocol
.Declaration
Swift
@inlinable init(mutating 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 init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PageSetupProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a new
GtkPageSetup
.Declaration
Swift
@inlinable init()
-
Reads the page setup from the file
file_name
.Returns a new
GtkPageSetup
object with the restored page setup, ornil
if an error occurred. See [methodGtk.PageSetup.to_file
].Declaration
Swift
@inlinable init(file fileName: UnsafePointer<CChar>!) throws
-
Desrialize a page setup from an a{sv} variant.
The variant must be in the format produced by [method
Gtk.PageSetup.to_gvariant
].Declaration
Swift
@inlinable init<VariantT>(gvariant variant: VariantT) where VariantT : VariantProtocol
-
Reads the page setup from the group
group_name
in the key filekey_file
.Returns a new
GtkPageSetup
object with the restored page setup, ornil
if an error occurred.Declaration
Swift
@inlinable 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, ornil
if an error occurred. See [methodGtk.PageSetup.to_file
].Declaration
Swift
@inlinable static func newFrom(file fileName: UnsafePointer<CChar>!) throws -> PageSetupRef!
-
Desrialize a page setup from an a{sv} variant.
The variant must be in the format produced by [method
Gtk.PageSetup.to_gvariant
].Declaration
Swift
@inlinable static func newFromG<VariantT>(gvariant variant: VariantT) -> PageSetupRef! where VariantT : VariantProtocol
-
Reads the page setup from the group
group_name
in the key filekey_file
.Returns a new
GtkPageSetup
object with the restored page setup, ornil
if an error occurred.Declaration
Swift
@inlinable static func newFrom<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<CChar>? = nil) throws -> PageSetupRef! where KeyFileT : KeyFileProtocol