Class PrintUnixDialog

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, Proxy

@Generated("org.javagi.JavaGI") public class PrintUnixDialog extends Dialog implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager

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 PrintOperation.

In order to print something with GtkPrintUnixDialog, you need to use getSelectedPrinter() to obtain a Printer object and use it to construct a PrintJob using PrintJob().

GtkPrintUnixDialog uses the following response values:

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.

  • Constructor Details

    • PrintUnixDialog

      public PrintUnixDialog(MemorySegment address)
      Create a PrintUnixDialog instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • PrintUnixDialog

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

      public PrintUnixDialog()
      Create a new PrintUnixDialog.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the PrintUnixDialog class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected PrintUnixDialog asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Dialog
      Returns:
      the instance as if it were its parent type
    • addCustomTab

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

      public int getCurrentPage()
      Gets the current page of the GtkPrintUnixDialog.
      Returns:
      the current page of this PrintUnixDialog
    • 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 Set<PrintCapabilities> 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 @Nullable Printer getSelectedPrinter()
      Gets the currently selected printer.
      Returns:
      the currently selected printer
    • getPrintSettings

      public PrintSettings getPrintSettings()

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

      Note that this creates a new object, and you need to unref it if don’t want to keep it.

      Returns:
      a new GtkPrintSettings object with the values from this PrintUnixDialog
    • 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 currentPage)

      Sets the current page number.

      If currentPage is not -1, this enables the current page choice for the range of pages to print.

      Parameters:
      currentPage - 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 hasSelection)
      Sets whether a selection exists.
      Parameters:
      hasSelection - true indicates that a selection exists
    • setManualCapabilities

      public void setManualCapabilities(Set<PrintCapabilities> capabilities)

      This lets you specify the printing capabilities your application supports.

      For instance, if you can handle scaling the output then you pass PrintCapabilities.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
    • setManualCapabilities

      public void setManualCapabilities(PrintCapabilities... capabilities)

      This lets you specify the printing capabilities your application supports.

      For instance, if you can handle scaling the output then you pass PrintCapabilities.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(PageSetup pageSetup)
      Sets the page setup of the GtkPrintUnixDialog.
      Parameters:
      pageSetup - 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 supportSelection)
      Sets whether the print dialog allows user to print a selection.
      Parameters:
      supportSelection - true to allow print selection
    • builder

      public static PrintUnixDialog.Builder<? extends PrintUnixDialog.Builder> builder()
      A PrintUnixDialog.Builder object constructs a PrintUnixDialog with the specified properties. Use the various set...() methods to set properties, and finish construction with PrintUnixDialog.Builder.build().
      Returns:
      the builder object