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.

  • ptr

    Untyped pointer to the underlying GtkPrintOperationPreview instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • print_operation_preview_ptr Default implementation

    Typed 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)

PrintOperationPreview signals

  • Connect a Swift signal handler to the given, typed PrintOperationPreviewSignalName signal

    Declaration

    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 by userData

    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 a C signal handler to the given, typed PrintOperationPreviewSignalName signal

    Declaration

    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 by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Emitted once for each page that gets rendered to the preview.

    A handler for this signal should update the context according to page_setup and set up a suitable cairo context, using [methodGtk.PrintContext.set_cairo_context].

    Note

    This represents the underlying got-page-size signal

    Declaration

    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 page

    handler

    The signal handler to call Run the given callback whenever the gotPageSize signal is emitted

  • gotPageSizeSignal Extension method

    Typed got-page-size signal for using the connect(signal:) methods

    Declaration

    Swift

    static var gotPageSizeSignal: PrintOperationPreviewSignalName { get }
  • onReady(flags:handler:) Extension method

    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 underlying ready signal

    Declaration

    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 method

    Typed ready signal for using the connect(signal:) methods

    Declaration

    Swift

    static var readySignal: PrintOperationPreviewSignalName { get }

PrintOperationPreview Interface: PrintOperationPreviewProtocol extension (methods and fields)

  • endPreview() Extension method

    Ends 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 [signalGtk.PrintOperation::preview] handler together with preview.

    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)