CtkPrintUnixDialog: CTK+ 3 Reference Manual

## CtkPrintUnixDialog CtkPrintUnixDialog — A print dialog |

## Functions

CtkWidget * | ctk_print_unix_dialog_new ()
void | ctk_print_unix_dialog_set_page_setup ()
CtkPageSetup * | ctk_print_unix_dialog_get_page_setup ()
void | ctk_print_unix_dialog_set_current_page ()
gint | ctk_print_unix_dialog_get_current_page ()
void | ctk_print_unix_dialog_set_settings ()
CtkPrintSettings * | ctk_print_unix_dialog_get_settings ()
CtkPrinter * | ctk_print_unix_dialog_get_selected_printer ()
void | ctk_print_unix_dialog_add_custom_tab ()
void | ctk_print_unix_dialog_set_support_selection ()
gboolean | ctk_print_unix_dialog_get_support_selection ()
void | ctk_print_unix_dialog_set_has_selection ()
gboolean | ctk_print_unix_dialog_get_has_selection ()
void | ctk_print_unix_dialog_set_embed_page_setup ()
gboolean | ctk_print_unix_dialog_get_embed_page_setup ()
gboolean | ctk_print_unix_dialog_get_page_setup_set ()
void | ctk_print_unix_dialog_set_manual_capabilities ()
CtkPrintCapabilities | ctk_print_unix_dialog_get_manual_capabilities ()

## Properties

int | current-page | Read / Write
gboolean | embed-page-setup | Read / Write
gboolean | has-selection | Read / Write
CtkPrintCapabilities | manual-capabilities | Read / Write
CtkPageSetup * | page-setup | Read / Write
CtkPrintSettings * | print-settings | Read / Write
CtkPrinter * | selected-printer | Read
gboolean | support-selection | Read / Write

## Types and Values

struct | CtkPrintUnixDialog
enum | CtkPrintCapabilities

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── CtkWidget
                ╰── CtkContainer
                    ╰── CtkBin
                        ╰── CtkWindow
                            ╰── CtkDialog
                                ╰── CtkPrintUnixDialog

## Implemented Interfaces

CtkPrintUnixDialog implements AtkImplementorIface and CtkBuildable.

## Includes

    #include <ctk/ctkunixprint.h>

## Description

CtkPrintUnixDialog implements a print dialog for platforms which don’t provide a native print dialog, like Unix. It can be used very much like any other CTK+ dialog, at the cost of the portability offered by the high-level printing API

In order to print something with CtkPrintUnixDialog, you need to use `ctk_print_unix_dialog_get_selected_printer()` to obtain a CtkPrinter object and use it to construct a CtkPrintJob using `ctk_print_job_new()`.

CtkPrintUnixDialog uses the following response values:

- `CTK_RESPONSE_OK`: for the “Print” button

- `CTK_RESPONSE_APPLY`: for the “Preview” button

- `CTK_RESPONSE_CANCEL`: for the “Cancel” button

Printing support was added in CTK+ 2.10.

### CtkPrintUnixDialog as CtkBuildable

The CtkPrintUnixDialog implementation of the CtkBuildable interface exposes its `notebook` internal children with the name “notebook”.

An example of a CtkPrintUnixDialog UI definition fragment:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    <object class="CtkPrintUnixDialog" id="dialog1">
      <child internal-child="notebook">
        <object class="CtkNotebook" id="notebook">
          <child>
            <object class="CtkLabel" id="tabcontent">
            <property name="label">Content on notebook tab</property>
            </object>
          </child>
          <child type="tab">
            <object class="CtkLabel" id="tablabel">
              <property name="label">Tab label</property>
            </object>
            <packing>
              <property name="tab_expand">False</property>
              <property name="tab_fill">False</property>
            </packing>
          </child>
        </object>
      </child>
    </object>

### CSS nodes

CtkPrintUnixDialog has a single CSS node with name printdialog.

## Functions

### ctk_print_unix_dialog_new ()

    CtkWidget *
    ctk_print_unix_dialog_new (const gchar *title,
                               CtkWindow *parent);

Creates a new CtkPrintUnixDialog.

#### Parameters

title | Title of the dialog, or `NULL`. | [allow-none]
parent | Transient parent of the dialog, or `NULL`. | [allow-none]

#### Returns

a new CtkPrintUnixDialog

Since: 2.10

### ctk_print_unix_dialog_set_page_setup ()

    void
    ctk_print_unix_dialog_set_page_setup (CtkPrintUnixDialog *dialog,
                                          CtkPageSetup *page_setup);

Sets the page setup of the CtkPrintUnixDialog.

#### Parameters

dialog | a CtkPrintUnixDialog |
page_setup | a CtkPageSetup |

Since: 2.10

### ctk_print_unix_dialog_get_page_setup ()

    CtkPageSetup *
    ctk_print_unix_dialog_get_page_setup (CtkPrintUnixDialog *dialog);

Gets the page setup that is used by the CtkPrintUnixDialog.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

the page setup of `dialog` .

[transfer none]

Since: 2.10

### ctk_print_unix_dialog_set_current_page ()

    void
    ctk_print_unix_dialog_set_current_page
                                   (CtkPrintUnixDialog *dialog,
                                    gint 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

dialog | a CtkPrintUnixDialog |
current_page | the current page number. |

Since: 2.10

### ctk_print_unix_dialog_get_current_page ()

    gint
    ctk_print_unix_dialog_get_current_page
                                   (CtkPrintUnixDialog *dialog);

Gets the current page of the CtkPrintUnixDialog.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

the current page of `dialog`

Since: 2.10

### ctk_print_unix_dialog_set_settings ()

    void
    ctk_print_unix_dialog_set_settings (CtkPrintUnixDialog *dialog,
                                        CtkPrintSettings *settings);

Sets the CtkPrintSettings for the CtkPrintUnixDialog. Typically, this is used to restore saved print settings from a previous print operation before the print dialog is shown.

#### Parameters

dialog | a CtkPrintUnixDialog |
settings | a CtkPrintSettings, or `NULL`. | [allow-none]

Since: 2.10

### ctk_print_unix_dialog_get_settings ()

    CtkPrintSettings *
    ctk_print_unix_dialog_get_settings (CtkPrintUnixDialog *dialog);

Gets a new CtkPrintSettings 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.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

a new CtkPrintSettings object with the values from `dialog`

Since: 2.10

### ctk_print_unix_dialog_get_selected_printer ()

    CtkPrinter *
    ctk_print_unix_dialog_get_selected_printer
                                   (CtkPrintUnixDialog *dialog);

Gets the currently selected printer.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

the currently selected printer.

[transfer none]

Since: 2.10

### ctk_print_unix_dialog_add_custom_tab ()

    void
    ctk_print_unix_dialog_add_custom_tab (CtkPrintUnixDialog *dialog,
                                          CtkWidget *child,
                                          CtkWidget *tab_label);

Adds a custom tab to the print dialog.

#### Parameters

dialog | a CtkPrintUnixDialog |
child | the widget to put in the custom tab |
tab_label | the widget to use as tab label |

Since: 2.10

### ctk_print_unix_dialog_set_support_selection ()

    void
    ctk_print_unix_dialog_set_support_selection
                                   (CtkPrintUnixDialog *dialog,
                                    gboolean support_selection);

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

#### Parameters

dialog | a CtkPrintUnixDialog |
support_selection | `TRUE` to allow print selection |

Since: 2.18

### ctk_print_unix_dialog_get_support_selection ()

    gboolean
    ctk_print_unix_dialog_get_support_selection
                                   (CtkPrintUnixDialog *dialog);

Gets the value of “support-selection” property.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

whether the application supports print of selection

Since: 2.18

### ctk_print_unix_dialog_set_has_selection ()

    void
    ctk_print_unix_dialog_set_has_selection
                                   (CtkPrintUnixDialog *dialog,
                                    gboolean has_selection);

Sets whether a selection exists.

#### Parameters

dialog | a CtkPrintUnixDialog |
has_selection | `TRUE` indicates that a selection exists |

Since: 2.18

### ctk_print_unix_dialog_get_has_selection ()

    gboolean
    ctk_print_unix_dialog_get_has_selection
                                   (CtkPrintUnixDialog *dialog);

Gets the value of “has-selection” property.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

whether there is a selection

Since: 2.18

### ctk_print_unix_dialog_set_embed_page_setup ()

    void
    ctk_print_unix_dialog_set_embed_page_setup
                                   (CtkPrintUnixDialog *dialog,
                                    gboolean embed);

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

#### Parameters

dialog | a CtkPrintUnixDialog |
embed | embed page setup selection |

Since: 2.18

### ctk_print_unix_dialog_get_embed_page_setup ()

    gboolean
    ctk_print_unix_dialog_get_embed_page_setup
                                   (CtkPrintUnixDialog *dialog);

Gets the value of “embed-page-setup” property.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

whether there is a selection

Since: 2.18

### ctk_print_unix_dialog_get_page_setup_set ()

    gboolean
    ctk_print_unix_dialog_get_page_setup_set
                                   (CtkPrintUnixDialog *dialog);

Gets the page setup that is used by the CtkPrintUnixDialog.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

whether a page setup was set by user.

Since: 2.18

### ctk_print_unix_dialog_set_manual_capabilities ()

    void
    ctk_print_unix_dialog_set_manual_capabilities
                                   (CtkPrintUnixDialog *dialog,
                                    CtkPrintCapabilities capabilities);

This lets you specify the printing capabilities your application supports. For instance, if you can handle scaling the output then you pass CTK_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

dialog | a CtkPrintUnixDialog |
capabilities | the printing capabilities of your application |

Since: 2.10

### ctk_print_unix_dialog_get_manual_capabilities ()

    CtkPrintCapabilities
    ctk_print_unix_dialog_get_manual_capabilities
                                   (CtkPrintUnixDialog *dialog);

Gets the value of “manual-capabilities” property.

#### Parameters

dialog | a CtkPrintUnixDialog |

#### Returns

the printing capabilities

Since: 2.18

## Types and Values

### struct CtkPrintUnixDialog

    struct CtkPrintUnixDialog;

### enum CtkPrintCapabilities

An enum for specifying which features the print dialog should offer. If neither `CTK_PRINT_CAPABILITY_GENERATE_PDF` nor `CTK_PRINT_CAPABILITY_GENERATE_PS` is specified, CTK+ assumes that all formats are supported.

#### Members

CTK_PRINT_CAPABILITY_PAGE_SET | Print dialog will offer printing even/odd pages. |
CTK_PRINT_CAPABILITY_COPIES | Print dialog will allow to print multiple copies. |
CTK_PRINT_CAPABILITY_COLLATE | Print dialog will allow to collate multiple copies. |
CTK_PRINT_CAPABILITY_REVERSE | Print dialog will allow to print pages in reverse order. |
CTK_PRINT_CAPABILITY_SCALE | Print dialog will allow to scale the output. |
CTK_PRINT_CAPABILITY_GENERATE_PDF | The program will send the document to the printer in PDF format |
CTK_PRINT_CAPABILITY_GENERATE_PS | The program will send the document to the printer in Postscript format |
CTK_PRINT_CAPABILITY_PREVIEW | Print dialog will offer a preview |
CTK_PRINT_CAPABILITY_NUMBER_UP | Print dialog will offer printing multiple pages per sheet. Since 2.12 |
CTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT | Print dialog will allow to rearrange pages when printing multiple pages per sheet. Since 2.14 |

## Property Details

### The `“current-page”` property

      “current-page”             int

The current page in the document.

Owner: CtkPrintUnixDialog

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“embed-page-setup”` property

      “embed-page-setup”         gboolean

TRUE if page setup combos are embedded in CtkPrintUnixDialog.

Owner: CtkPrintUnixDialog

Flags: Read / Write

Default value: FALSE

### The `“has-selection”` property

      “has-selection”            gboolean

Whether the application has a selection.

Owner: CtkPrintUnixDialog

Flags: Read / Write

Default value: FALSE

### The `“manual-capabilities”` property

      “manual-capabilities”      CtkPrintCapabilities

Capabilities the application can handle.

Owner: CtkPrintUnixDialog

Flags: Read / Write

### The `“page-setup”` property

      “page-setup”               CtkPageSetup *

The CtkPageSetup to use.

Owner: CtkPrintUnixDialog

Flags: Read / Write

### The `“print-settings”` property

      “print-settings”           CtkPrintSettings *

The CtkPrintSettings used for initializing the dialog.

Owner: CtkPrintUnixDialog

Flags: Read / Write

### The `“selected-printer”` property

      “selected-printer”         CtkPrinter *

The CtkPrinter which is selected.

Owner: CtkPrintUnixDialog

Flags: Read

### The `“support-selection”` property

      “support-selection”        gboolean

Whether the dialog supports selection.

Owner: CtkPrintUnixDialog

Flags: Read / Write

Default value: FALSE

## See Also

CtkPageSetupUnixDialog, CtkPrinter, CtkPrintJob