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 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.
A page setup dialog
(C Language Example):
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.
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.
-
Untyped pointer to the underlying
GtkPageSetup
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
page_setup_ptr
Default implementationTyped 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)
-
copy()
Extension methodCopies 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) -> Double
-
getLeftMargin(unit:
Extension method) Gets the left margin in units of
unit
.Declaration
Swift
@inlinable func getLeftMargin(unit: GtkUnit) -> Double
-
getOrientation()
Extension methodGets 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
gtk_page_setup_get_paper_height()
.Declaration
Swift
@inlinable func getPageHeight(unit: GtkUnit) -> Double
-
getPageWidth(unit:
Extension method) 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()
.Declaration
Swift
@inlinable func getPageWidth(unit: GtkUnit) -> Double
-
getPaperHeight(unit:
Extension method) 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()
.Declaration
Swift
@inlinable func getPaperHeight(unit: GtkUnit) -> Double
-
getPaperSize()
Extension methodGets 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
gtk_page_setup_get_page_width()
.Declaration
Swift
@inlinable func getPaperWidth(unit: GtkUnit) -> Double
-
getRightMargin(unit:
Extension method) Gets the right margin in units of
unit
.Declaration
Swift
@inlinable func getRightMargin(unit: GtkUnit) -> Double
-
getTopMargin(unit:
Extension method) Gets the top margin in units of
unit
.Declaration
Swift
@inlinable func getTopMargin(unit: GtkUnit) -> Double
-
loadFile(fileName:
Extension method) Reads the page setup from the file
file_name
. Seegtk_page_setup_to_file()
.Declaration
Swift
@inlinable func loadFile(fileName: UnsafePointer<CChar>!) throws -> Bool
-
load(keyFile:
Extension methodgroupName: ) Reads the page setup from the group
group_name
in the key filekey_file
.Declaration
Swift
@inlinable func load<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<gchar>? = nil) throws -> Bool where KeyFileT : KeyFileProtocol
-
setBottom(margin:
Extension methodunit: ) Sets the bottom margin of the
GtkPageSetup
.Declaration
Swift
@inlinable func setBottom(margin: Double, unit: GtkUnit)
-
setLeft(margin:
Extension methodunit: ) Sets the left margin of the
GtkPageSetup
.Declaration
Swift
@inlinable func setLeft(margin: Double, 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. Seegtk_page_setup_set_paper_size_and_default_margins()
.Declaration
Swift
@inlinable func setPaper<PaperSizeT>(size: PaperSizeT) where PaperSizeT : PaperSizeProtocol
-
setPaperSizeAndDefaultMargins(size:
Extension method) 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:
Extension methodunit: ) Sets the right margin of the
GtkPageSetup
.Declaration
Swift
@inlinable func setRight(margin: Double, unit: GtkUnit)
-
setTop(margin:
Extension methodunit: ) Sets the top margin of the
GtkPageSetup
.Declaration
Swift
@inlinable func setTop(margin: Double, unit: GtkUnit)
-
toFile(fileName:
Extension method) This function saves the information from
setup
tofile_name
.Declaration
Swift
@inlinable func toFile(fileName: UnsafePointer<CChar>!) throws -> Bool
-
toGvariant()
Extension methodSerialize page setup to an a{sv} variant.
Declaration
Swift
@inlinable func toGvariant() -> GLib.VariantRef!
-
to(keyFile:
Extension methodgroupName: ) This function adds the page setup from
setup
tokey_file
.Declaration
Swift
@inlinable func to<KeyFileT>(keyFile: KeyFileT, groupName: UnsafePointer<gchar>? = nil) where KeyFileT : KeyFileProtocol
-
printRunPageSetupDialog(parent:
Extension methodsettings: ) Runs a page setup dialog, letting the user modify the values from
page_setup
. If the user cancels the dialog, the returnedGtkPageSetup
is identical to the passed inpage_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
-
printRunPageSetupDialog(parent:
Extension methodsettings: ) Runs a page setup dialog, letting the user modify the values from
page_setup
. If the user cancels the dialog, the returnedGtkPageSetup
is identical to the passed inpage_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
-
printRunPageSetupDialogAsync(parent:
Extension methodsettings: doneCb: data: ) 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 callsdone_cb
from a signal handler for theresponse
signal of the dialog.Declaration
Swift
@inlinable func printRunPageSetupDialogAsync<PrintSettingsT>(parent: WindowRef? = nil, settings: PrintSettingsT, doneCb: GtkPageSetupDoneFunc?, data: gpointer! = nil) where PrintSettingsT : PrintSettingsProtocol
-
printRunPageSetupDialogAsync(parent:
Extension methodsettings: doneCb: data: ) 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 callsdone_cb
from a signal handler for theresponse
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 methodGets the page orientation of the
GtkPageSetup
.Declaration
Swift
@inlinable var orientation: GtkPageOrientation { get nonmutating set }
-
paperSize
Extension methodGets the paper size of the
GtkPageSetup
.Declaration
Swift
@inlinable var paperSize: PaperSizeRef! { get nonmutating set }