PrintUnixDialog

GtkPrintUnixDialog implements a print dialog for platforms which don’t provide a native print dialog, like Unix.

An example GtkPrintUnixDialog

It can be used very much like any other GTK dialog, at the cost of the portability offered by the high-level printing API with [class@Gtk.PrintOperation].

In order to print something with GtkPrintUnixDialog, you need to use [method@Gtk.PrintUnixDialog.get_selected_printer] to obtain a [class@Gtk.Printer] object and use it to construct a [class@Gtk.PrintJob] using [ctor@Gtk.PrintJob.new].

GtkPrintUnixDialog uses the following response values:

- %GTK_RESPONSE_OK: for the “Print” button - %GTK_RESPONSE_APPLY: for the “Preview” button - %GTK_RESPONSE_CANCEL: for the “Cancel” button

GtkPrintUnixDialog as GtkBuildable

The GtkPrintUnixDialog implementation of the GtkBuildable interface exposes its @notebook internal children with the name “notebook”.

An example of a GtkPrintUnixDialog UI definition fragment:

<object class="GtkPrintUnixDialog" id="dialog1">
<child internal-child="notebook">
<object class="GtkNotebook" id="notebook">
<child>
<object type="GtkNotebookPage">
<property name="tab_expand">False</property>
<property name="tab_fill">False</property>
<property name="tab">
<object class="GtkLabel" id="tablabel">
<property name="label">Tab label</property>
</object>
</property>
<property name="child">
<object class="GtkLabel" id="tabcontent">
<property name="label">Content on notebook tab</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>

CSS nodes

GtkPrintUnixDialog has a single CSS node with name window. The style classes dialog and print are added.

Constructors

this
this(GtkPrintUnixDialog* gtkPrintUnixDialog, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string title, Window parent)

Creates a new GtkPrintUnixDialog.

Members

Functions

addCustomTab
void addCustomTab(Widget child, Widget tabLabel)

Adds a custom tab to the print dialog.

getCurrentPage
int getCurrentPage()

Gets the current page of the GtkPrintUnixDialog.

getEmbedPageSetup
bool getEmbedPageSetup()

Gets whether to embed the page setup.

getHasSelection
bool getHasSelection()

Gets whether there is a selection.

getManualCapabilities
GtkPrintCapabilities getManualCapabilities()

Gets the capabilities that have been set on this GtkPrintUnixDialog.

getPageSetup
PageSetup getPageSetup()

Gets the page setup that is used by the GtkPrintUnixDialog.

getPageSetupSet
bool getPageSetupSet()

Gets whether a page setup was set by the user.

getPrintUnixDialogStruct
GtkPrintUnixDialog* getPrintUnixDialogStruct(bool transferOwnership)

Get the main Gtk struct

getSelectedPrinter
Printer getSelectedPrinter()

Gets the currently selected printer.

getSettings
Settings getSettings()

Gets a new GtkPrintSettings object that represents the current values in the print dialog.

getStruct
void* getStruct()

the main Gtk struct as a void*

getSupportSelection
bool getSupportSelection()

Gets whether the print dialog allows user to print a selection.

setCurrentPage
void setCurrentPage(int currentPage)

Sets the current page number.

setEmbedPageSetup
void setEmbedPageSetup(bool embed)

Embed page size combo box and orientation combo box into page setup page.

setHasSelection
void setHasSelection(bool hasSelection)

Sets whether a selection exists.

setManualCapabilities
void setManualCapabilities(GtkPrintCapabilities capabilities)

This lets you specify the printing capabilities your application supports.

setPageSetup
void setPageSetup(PageSetup pageSetup)

Sets the page setup of the GtkPrintUnixDialog.

setSettings
void setSettings(PrintSettings settings)

Sets the GtkPrintSettings for the GtkPrintUnixDialog.

setSupportSelection
void setSupportSelection(bool supportSelection)

Sets whether the print dialog allows user to print a selection.

Static functions

getType
GType getType()

Variables

gtkPrintUnixDialog
GtkPrintUnixDialog* gtkPrintUnixDialog;

the main Gtk struct

Inherited Members

From Dialog

gtkDialog
GtkDialog* gtkDialog;

the main Gtk struct

getDialogStruct
GtkDialog* getDialogStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

addButtons
void addButtons(string[] buttonsText, ResponseType[] responses)
getType
GType getType()
addActionWidget
void addActionWidget(Widget child, int responseId)

Adds an activatable widget to the action area of a GtkDialog.

addButton
Widget addButton(string buttonText, int responseId)

Adds a button with the given text.

getContentArea
Box getContentArea()

Returns the content area of @dialog.

getHeaderBar
HeaderBar getHeaderBar()

Returns the header bar of @dialog.

getResponseForWidget
int getResponseForWidget(Widget widget)

Gets the response id of a widget in the action area of a dialog.

getWidgetForResponse
Widget getWidgetForResponse(int responseId)

Gets the widget button that uses the given response ID in the action area of a dialog.

response
void response(int responseId)

Emits the ::response signal with the given response ID.

setDefaultResponse
void setDefaultResponse(int responseId)

Sets the default widget for the dialog based on the response ID.

setResponseSensitive
void setResponseSensitive(int responseId, bool setting)

A convenient way to sensitize/desensitize dialog buttons.

addOnClose
gulong addOnClose(void delegate(Dialog) dlg, ConnectFlags connectFlags)

Emitted when the user uses a keybinding to close the dialog.

addOnResponse
gulong addOnResponse(void delegate(int, Dialog) dlg, ConnectFlags connectFlags)

Emitted when an action widget is clicked.

Meta