PrintOperationPreviewProtocol
public protocol PrintOperationPreviewProtocol
GtkPrintOperationPreview
is the interface that is used to
implement print preview.
A GtkPrintOperationPreview
object is passed to the
[signalGtk.PrintOperation::preview
] signal by
[classGtk.PrintOperation
].
The PrintOperationPreviewProtocol
protocol exposes the methods and properties of an underlying GtkPrintOperationPreview
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 PrintOperationPreview
.
Alternatively, use PrintOperationPreviewRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkPrintOperationPreview
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
print_operation_preview_ptr
Default implementationTyped pointer to the underlying
GtkPrintOperationPreview
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkPrintOperationPreview
instance.Declaration
Swift
var print_operation_preview_ptr: UnsafeMutablePointer<GtkPrintOperationPreview>! { get }
-
Required Initialiser for types conforming to
PrintOperationPreviewProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
PrintOperationPreviewSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: PrintOperationPreviewSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
PrintOperationPreviewSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: PrintOperationPreviewSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onGotPageSize(flags:
Extension methodhandler: ) Emitted once for each page that gets rendered to the preview.
A handler for this signal should update the
context
according topage_setup
and set up a suitable cairo context, using [methodGtk.PrintContext.set_cairo_context
].Note
This represents the underlyinggot-page-size
signalDeclaration
Swift
@discardableResult @inlinable func onGotPageSize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: PrintOperationPreviewRef, _ context: PrintContextRef, _ pageSetup: PageSetupRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
context
the current
GtkPrintContext
pageSetup
the
GtkPageSetup
for the current pagehandler
The signal handler to call Run the given callback whenever the
gotPageSize
signal is emitted -
gotPageSizeSignal
Extension methodTyped
got-page-size
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var gotPageSizeSignal: PrintOperationPreviewSignalName { get }
-
onReady(flags:
Extension methodhandler: ) The
ready
signal gets emitted once per preview operation, before the first page is rendered.A handler for this signal can be used for setup tasks.
Note
This represents the underlyingready
signalDeclaration
Swift
@discardableResult @inlinable func onReady(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: PrintOperationPreviewRef, _ context: PrintContextRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
context
the current
GtkPrintContext
handler
The signal handler to call Run the given callback whenever the
ready
signal is emitted -
readySignal
Extension methodTyped
ready
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var readySignal: PrintOperationPreviewSignalName { get }
-
endPreview()
Extension methodEnds a preview.
This function must be called to finish a custom print preview.
Declaration
Swift
@inlinable func endPreview()
-
isSelected(pageNr:
Extension method) Returns whether the given page is included in the set of pages that have been selected for printing.
Declaration
Swift
@inlinable func isSelected(pageNr: Int) -> Bool
-
renderPage(pageNr:
Extension method) Renders a page to the preview.
This is using the print context that was passed to the [signal
Gtk.PrintOperation::preview
] handler together withpreview
.A custom print preview should use this function to render the currently selected page.
Note that this function requires a suitable cairo context to be associated with the print context.
Declaration
Swift
@inlinable func renderPage(pageNr: Int)