Class PrintUnixDialog

All Implemented Interfaces:
PointerInterface

public class PrintUnixDialog extends Dialog
`GtkPrintUnixDialog` implements a print dialog for platforms
which don’t provide a native print dialog, like Unix.

![An example GtkPrintUnixDialog](printdialog.png)

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:

```xml
<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.

https://docs.gtk.org/gtk4/class.PrintUnixDialog.html

  • Constructor Details

    • PrintUnixDialog

      public PrintUnixDialog(PointerContainer pointer)
    • PrintUnixDialog

      public PrintUnixDialog(@Nullable Str title, @Nullable Window parent)
      Creates a new `GtkPrintUnixDialog`.
      Parameters:
      title - Title of the dialog
      parent - Transient parent of the dialog
    • PrintUnixDialog

      public PrintUnixDialog(String title, @Nullable Window parent)
      Creates a new `GtkPrintUnixDialog`.
      Parameters:
      title - Title of the dialog
      parent - Transient parent of the dialog
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addCustomTab

      public void addCustomTab(@Nonnull Widget child, @Nonnull Widget tab_label)
      Adds a custom tab to the print dialog.
      Parameters:
      child - the widget to put in the custom tab
      tab_label - the widget to use as tab label
    • getCurrentPage

      public int getCurrentPage()
      Gets the current page of the `GtkPrintUnixDialog`.
      Returns:
      the current page of @dialog
    • getEmbedPageSetup

      public boolean getEmbedPageSetup()
      Gets whether to embed the page setup.
      Returns:
      whether to embed the page setup
    • getHasSelection

      public boolean getHasSelection()
      Gets whether there is a selection.
      Returns:
      whether there is a selection
    • getManualCapabilities

      public int getManualCapabilities()
      Gets the capabilities that have been set on this `GtkPrintUnixDialog`.
      Returns:
      the printing capabilities
    • getPageSetup

      public PageSetup getPageSetup()
      Gets the page setup that is used by the `GtkPrintUnixDialog`.
      Returns:
      the page setup of @dialog.
    • getPageSetupSet

      public boolean getPageSetupSet()
      Gets whether a page setup was set by the user.
      Returns:
      whether a page setup was set by user.
    • getSelectedPrinter

      public Printer getSelectedPrinter()
      Gets the currently selected printer.
      Returns:
      the currently selected printer
    • getSupportSelection

      public boolean getSupportSelection()
      Gets whether the print dialog allows user to print a selection.
      Returns:
      whether the application supports print of selection
    • setCurrentPage

      public void setCurrentPage(int current_page)
      Sets the current page number.

      If @current_page is not -1, this enables the current page choice
      for the range of pages to print.
      Parameters:
      current_page - the current page number.
    • setEmbedPageSetup

      public void setEmbedPageSetup(boolean embed)
      Embed page size combo box and orientation combo box into page setup page.
      Parameters:
      embed - embed page setup selection
    • setHasSelection

      public void setHasSelection(boolean has_selection)
      Sets whether a selection exists.
      Parameters:
      has_selection - %TRUE indicates that a selection exists
    • setManualCapabilities

      public void setManualCapabilities(int capabilities)
      This lets you specify the printing capabilities your application
      supports.

      For instance, if you can handle scaling the output then you pass
      %GTK_PRINT_CAPABILITY_SCALE. If you don’t pass that, then the dialog
      will only let you select the scale if the printing system automatically
      handles scaling.
      Parameters:
      capabilities - the printing capabilities of your application
    • setPageSetup

      public void setPageSetup(@Nonnull PageSetup page_setup)
      Sets the page setup of the `GtkPrintUnixDialog`.
      Parameters:
      page_setup - a `GtkPageSetup`
    • setSettings

      public void setSettings(@Nullable PrintSettings settings)
      Sets the `GtkPrintSettings` for the `GtkPrintUnixDialog`.

      Typically, this is used to restore saved print settings
      from a previous print operation before the print dialog
      is shown.
      Parameters:
      settings - a `GtkPrintSettings`
    • setSupportSelection

      public void setSupportSelection(boolean support_selection)
      Sets whether the print dialog allows user to print a selection.
      Parameters:
      support_selection - %TRUE to allow print selection
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Dialog
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Dialog
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Dialog
      Returns:
      ConstraintTarget
    • asNative

      public Native asNative()
      Implements interface Native. Call this to get access to interface functions.
      Overrides:
      asNative in class Dialog
      Returns:
      Native
    • asRoot

      public Root asRoot()
      Implements interface Root. Call this to get access to interface functions.
      Overrides:
      asRoot in class Dialog
      Returns:
      Root
    • asShortcutManager

      public ShortcutManager asShortcutManager()
      Implements interface ShortcutManager. Call this to get access to interface functions.
      Overrides:
      asShortcutManager in class Dialog
      Returns:
      ShortcutManager
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()