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
GtkPrintOperationPreviewinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
print_operation_preview_ptrDefault implementationTyped pointer to the underlying
GtkPrintOperationPreviewinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkPrintOperationPreviewinstance.Declaration
Swift
var print_operation_preview_ptr: UnsafeMutablePointer<GtkPrintOperationPreview>! { get } -
Required Initialiser for types conforming to
PrintOperationPreviewProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
PrintOperationPreviewSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: PrintOperationPreviewSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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
PrintOperationPreviewSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: PrintOperationPreviewSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe 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
contextaccording topage_setupand set up a suitable cairo context, using [methodGtk.PrintContext.set_cairo_context].Note
This represents the underlyinggot-page-sizesignalDeclaration
Swift
@discardableResult @inlinable func onGotPageSize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: PrintOperationPreviewRef, _ context: PrintContextRef, _ pageSetup: PageSetupRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
contextthe current
GtkPrintContextpageSetupthe
GtkPageSetupfor the current pagehandlerThe signal handler to call Run the given callback whenever the
gotPageSizesignal is emitted -
gotPageSizeSignalExtension methodTyped
got-page-sizesignal for using theconnect(signal:)methodsDeclaration
Swift
static var gotPageSizeSignal: PrintOperationPreviewSignalName { get } -
onReady(flags:Extension methodhandler: ) The
readysignal 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 underlyingreadysignalDeclaration
Swift
@discardableResult @inlinable func onReady(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: PrintOperationPreviewRef, _ context: PrintContextRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
contextthe current
GtkPrintContexthandlerThe signal handler to call Run the given callback whenever the
readysignal is emitted -
readySignalExtension methodTyped
readysignal 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)
View on GitHub
Install in Dash
PrintOperationPreviewProtocol Protocol Reference