Index

Package: Print_Operation

Description

package Gtk.Print_Operation is

GtkPrintOperation is the high-level, portable printing API. It looks a bit different than other GTK+ dialogs such as the Gtk.File_Chooser.Gtk_File_Chooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, GtkPrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see Gtk_Print_Unix_Dialog.

The typical way to use the high-level printing API is to create a GtkPrintOperation object with Gtk.Print_Operation.Gtk_New when the user selects to print. Then you set some properties on it, e.g. the page size, any Gtk.Print_Settings.Gtk_Print_Settings from previous print operations, the number of pages, the current page, etc.

Then you start the print operation by calling Gtk.Print_Operation.Run. It will then show a dialog, let the user select a printer and options. When the user finished the dialog various signals will be emitted on the Gtk.Print_Operation.Gtk_Print_Operation, the main one being Gtk.Print_Operation.Gtk_Print_Operation::draw-page, which you are supposed to catch and render the page on the provided Gtk.Print_Context.Gtk_Print_Context using Cairo. == The high-level printing API == static GtkPrintSettings *settings = NULL; static void do_print (void) { GtkPrintOperation *print; GtkPrintOperationResult res; print = gtk_print_operation_new (); if (settings != NULL) gtk_print_operation_set_print_settings (print, settings); g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL); g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL); res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (main_window), NULL); if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != NULL) g_object_unref (settings); settings = g_object_ref (gtk_print_operation_get_print_settings (print)); } g_object_unref (print); } By default GtkPrintOperation uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions Gtk.Print_Operation_Preview.Render_Page, Gtk.Print_Operation_Preview.End_Preview and Gtk.Print_Operation_Preview.Is_Selected are useful when implementing a print preview.

Packages

Gtk_Print_Status_Properties (new Glib.Generic_Properties.Generic_Internal_Discrete_Property)

package Gtk_Print_Status_Properties is
      new Generic_Internal_Discrete_Property (Gtk_Print_Status);

Gtk_Print_Operation_Result_Properties (new Glib.Generic_Properties.Generic_Internal_Discrete_Property)

package Gtk_Print_Operation_Result_Properties is
      new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Result);

Gtk_Print_Operation_Action_Properties (new Glib.Generic_Properties.Generic_Internal_Discrete_Property)

package Gtk_Print_Operation_Action_Properties is
      new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Action);

Gtk_Print_Error_Properties (new Glib.Generic_Properties.Generic_Internal_Discrete_Property)

package Gtk_Print_Error_Properties is
      new Generic_Internal_Discrete_Property (Gtk_Print_Error);

Implements_Gtk_Print_Operation_Preview (new Glib.Types.Implements)

Classes

Gtk_Print_Operation_Record

type Gtk_Print_Operation_Record is new GObject_Record with null record;

Ancestors:

Immediate Children:

Primitive operations:

Draw_Page_Finish
Get_Default_Page_Setup
Get_Embed_Page_Setup
Get_Has_Selection
Get_N_Pages_To_Print
Get_Print_Settings
Get_Status_String
Get_Support_Selection
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)
On_Begin_Print
On_Begin_Print
On_Create_Custom_Widget
On_Create_Custom_Widget
On_Custom_Widget_Apply
On_Custom_Widget_Apply
On_Draw_Page
On_Draw_Page
On_End_Print
On_End_Print
On_Request_Page_Setup
On_Request_Page_Setup
On_Status_Changed
On_Status_Changed
On_Update_Custom_Widget
On_Update_Custom_Widget
Set_Allow_Async
Set_Current_Page
Set_Custom_Tab_Label
Set_Default_Page_Setup
Set_Defer_Drawing
Set_Embed_Page_Setup
Set_Export_Filename
Set_Has_Selection
Set_Job_Name
Set_Print_Settings
Set_Show_Progress
Set_Support_Selection
Set_Track_Print_Status
Set_Use_Full_Page

Types

Gtk_Print_Operation

type Gtk_Print_Operation is access all Gtk_Print_Operation_Record'Class;

Gtk_Print_Status

type Gtk_Print_Status is (
      Status_Initial,
      Status_Preparing,
      Status_Generating_Data,
      Status_Sending_Data,
      Status_Pending,
      Status_Pending_Issue,
      Status_Printing,
      Status_Finished,
      Status_Finished_Aborted);

Gtk_Print_Operation_Result

type Gtk_Print_Operation_Result is (
      Result_Error,
      Result_Apply,
      Result_Cancel,
      Result_In_Progress);

Gtk_Print_Operation_Action

type Gtk_Print_Operation_Action is (
      Action_Print_Dialog,
      Action_Print,
      Action_Preview,
      Action_Export);

Gtk_Print_Error

type Gtk_Print_Error is (
      Error_General,
      Error_Internal_Error,
      Error_Nomem,
      Error_Invalid_File);

Property_Gtk_Print_Status

type Property_Gtk_Print_Status is new Gtk_Print_Status_Properties.Property;

Property_Gtk_Print_Operation_Result

type Property_Gtk_Print_Operation_Result is new Gtk_Print_Operation_Result_Properties.Property;

Property_Gtk_Print_Operation_Action

type Property_Gtk_Print_Operation_Action is new Gtk_Print_Operation_Action_Properties.Property;

Property_Gtk_Print_Error

type Property_Gtk_Print_Error is new Gtk_Print_Error_Properties.Property;

Cb_Gtk_Print_Operation_Gtk_Print_Context_Void

type Cb_Gtk_Print_Operation_Gtk_Print_Context_Void is not null access procedure
     (Self    : access Gtk_Print_Operation_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class);

Cb_GObject_Gtk_Print_Context_Void

type Cb_GObject_Gtk_Print_Context_Void is not null access procedure
     (Self    : access Glib.Object.GObject_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class);

Cb_Gtk_Print_Operation_GObject

type Cb_Gtk_Print_Operation_GObject is not null access function
     (Self : access Gtk_Print_Operation_Record'Class)
   return Glib.Object.GObject;

Cb_GObject_GObject

type Cb_GObject_GObject is not null access function
     (Self : access Glib.Object.GObject_Record'Class)
   return Glib.Object.GObject;

Cb_Gtk_Print_Operation_Gtk_Widget_Void

type Cb_Gtk_Print_Operation_Gtk_Widget_Void is not null access procedure
     (Self   : access Gtk_Print_Operation_Record'Class;
      Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class);

Cb_GObject_Gtk_Widget_Void

type Cb_GObject_Gtk_Widget_Void is not null access procedure
     (Self   : access Glib.Object.GObject_Record'Class;
      Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class);

Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void

type Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void is not null access procedure
     (Self   : access Gtk_Print_Operation_Record'Class;
      Result : Gtk_Print_Operation_Result);

Cb_GObject_Gtk_Print_Operation_Result_Void

type Cb_GObject_Gtk_Print_Operation_Result_Void is not null access procedure
     (Self   : access Glib.Object.GObject_Record'Class;
      Result : Gtk_Print_Operation_Result);

Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void

type Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void is not null access procedure
     (Self    : access Gtk_Print_Operation_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Page_Nr : Gint);

Cb_GObject_Gtk_Print_Context_Gint_Void

type Cb_GObject_Gtk_Print_Context_Gint_Void is not null access procedure
     (Self    : access Glib.Object.GObject_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Page_Nr : Gint);

Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean

type Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean is not null access function
     (Self    : access Gtk_Print_Operation_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class)
   return Boolean;

Cb_GObject_Gtk_Print_Context_Boolean

type Cb_GObject_Gtk_Print_Context_Boolean is not null access function
     (Self    : access Glib.Object.GObject_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class)
   return Boolean;

Cb_Gtk_Print_Operation_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean

type Cb_Gtk_Print_Operation_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean is not null access function
     (Self    : access Gtk_Print_Operation_Record'Class;
      Preview : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Parent  : access Gtk.Window.Gtk_Window_Record'Class)
   return Boolean;

Cb_GObject_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean

type Cb_GObject_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean is not null access function
     (Self    : access Glib.Object.GObject_Record'Class;
      Preview : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Parent  : access Gtk.Window.Gtk_Window_Record'Class)
   return Boolean;

Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void

type Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void is not null access procedure
     (Self    : access Gtk_Print_Operation_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Page_Nr : Gint;
      Setup   : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class);

Cb_GObject_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void

type Cb_GObject_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void is not null access procedure
     (Self    : access Glib.Object.GObject_Record'Class;
      Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class;
      Page_Nr : Gint;
      Setup   : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class);

Cb_Gtk_Print_Operation_Void

type Cb_Gtk_Print_Operation_Void is not null access procedure
     (Self : access Gtk_Print_Operation_Record'Class);

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
     (Self : access Glib.Object.GObject_Record'Class);

Cb_Gtk_Print_Operation_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void

type Cb_Gtk_Print_Operation_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void is not null access procedure
     (Self     : access Gtk_Print_Operation_Record'Class;
      Widget   : not null access Gtk.Widget.Gtk_Widget_Record'Class;
      Setup    : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class;
      Settings : not null access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class);

Cb_GObject_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void

type Cb_GObject_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void is not null access procedure
     (Self     : access Glib.Object.GObject_Record'Class;
      Widget   : not null access Gtk.Widget.Gtk_Widget_Record'Class;
      Setup    : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class;
      Settings : not null access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class);

Constants & Global variables

Allow_Async_Property (Glib.Properties.Property_Boolean)

Allow_Async_Property : constant Glib.Properties.Property_Boolean;
Determines whether the print operation may run asynchronously or not. Some systems don't support asynchronous printing, but those that do will return Gtk.Print_Operation.Result_In_Progress as the status, and emit the Gtk.Print_Operation.Gtk_Print_Operation::done signal when the operation is actually done. The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for Gtk.Print_Operation.Action_Export support asynchronous operation.

Current_Page_Property (Glib.Properties.Property_Int)

Current_Page_Property : constant Glib.Properties.Property_Int;
The current page in the document. If this is set before Gtk.Print_Operation.Run, the user will be able to select to print only the current page. Note that this only makes sense for pre-paginated documents.

Custom_Tab_Label_Property (Glib.Properties.Property_String)

Custom_Tab_Label_Property : constant Glib.Properties.Property_String;
Used as the label of the tab containing custom widgets. Note that this property may be ignored on some platforms. If this is null, GTK+ uses a default label.

Default_Page_Setup_Property (Glib.Properties.Property_Object)

Default_Page_Setup_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Page_Setup.Gtk_Page_Setup The Gtk.Page_Setup.Gtk_Page_Setup used by default. This page setup will be used by Gtk.Print_Operation.Run, but it can be overridden on a per-page basis by connecting to the Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup signal.

Embed_Page_Setup_Property (Glib.Properties.Property_Boolean)

Embed_Page_Setup_Property : constant Glib.Properties.Property_Boolean;
If True, page size combo box and orientation combo box are embedded into page setup page.

Export_Filename_Property (Glib.Properties.Property_String)

Export_Filename_Property : constant Glib.Properties.Property_String;
The name of a file to generate instead of showing the print dialog. Currently, PDF is the only supported format. The intended use of this property is for implementing "Export to PDF" actions. "Print to PDF" support is independent of this and is done by letting the user pick the "Print to PDF" item from the list of printers in the print dialog.

Has_Selection_Property (Glib.Properties.Property_Boolean)

Has_Selection_Property : constant Glib.Properties.Property_Boolean;
Determines whether there is a selection in your application. This can allow your application to print the selection. This is typically used to make a "Selection" button sensitive.

Job_Name_Property (Glib.Properties.Property_String)

Job_Name_Property : constant Glib.Properties.Property_String;
A string used to identify the job (e.g. in monitoring applications like eggcups). If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.

N_Pages_Property (Glib.Properties.Property_Int)

N_Pages_Property : constant Glib.Properties.Property_Int;
The number of pages in the document. This *must* be set to a positive number before the rendering starts. It may be set in a Gtk.Print_Operation.Gtk_Print_Operation::begin-print signal hander. Note that the page numbers passed to the Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup and Gtk.Print_Operation.Gtk_Print_Operation::draw-page signals are 0-based, i.e. if the user chooses to print all pages, the last ::draw-page signal will be for page N_Pages - 1.

N_Pages_To_Print_Property (Glib.Properties.Property_Int)

N_Pages_To_Print_Property : constant Glib.Properties.Property_Int;
The number of pages that will be printed. Note that this value is set during print preparation phase (Gtk.Print_Operation.Status_Preparing), so this value should never be get before the data generation phase (Gtk.Print_Operation.Status_Generating_Data). You can connect to the Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal and call Gtk.Print_Operation.Get_N_Pages_To_Print when print status is Gtk.Print_Operation.Status_Generating_Data. This is typically used to track the progress of print operation.

Print_Settings_Property (Glib.Properties.Property_Object)

Print_Settings_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Print_Settings.Gtk_Print_Settings The Gtk.Print_Settings.Gtk_Print_Settings used for initializing the dialog. Setting this property is typically used to re-establish print settings from a previous print operation, see Gtk.Print_Operation.Run.

Show_Progress_Property (Glib.Properties.Property_Boolean)

Show_Progress_Property : constant Glib.Properties.Property_Boolean;
Determines whether to show a progress dialog during the print operation.

Status_Property (Property_Gtk_Print_Status)

Type: Gtk_Print_Status The status of the print operation.

Status_String_Property (Glib.Properties.Property_String)

Status_String_Property : constant Glib.Properties.Property_String;
A string representation of the status of the print operation. The string is translated and suitable for displaying the print status e.g. in a Gtk.Status_Bar.Gtk_Status_Bar. See the Gtk.Print_Operation.Gtk_Print_Operation:status property for a status value that is suitable for programmatic use.

Support_Selection_Property (Glib.Properties.Property_Boolean)

Support_Selection_Property : constant Glib.Properties.Property_Boolean;
If True, the print operation will support print of selection. This allows the print dialog to show a "Selection" button.

Track_Print_Status_Property (Glib.Properties.Property_Boolean)

Track_Print_Status_Property : constant Glib.Properties.Property_Boolean;
If True, the print operation will try to continue report on the status of the print job in the printer queues and printer. This can allow your application to show things like "out of paper" issues, and when the print job actually reaches the printer. However, this is often implemented using polling, and should not be enabled unless needed.

Unit_Property (Gtk.Enums.Property_Gtk_Unit)

Unit_Property : constant Gtk.Enums.Property_Gtk_Unit;
The transformation for the cairo context obtained from Gtk.Print_Context.Gtk_Print_Context is set up in such a way that distances are measured in units of Unit.

Use_Full_Page_Property (Glib.Properties.Property_Boolean)

Use_Full_Page_Property : constant Glib.Properties.Property_Boolean;
If True, the transformation for the cairo context obtained from Gtk.Print_Context.Gtk_Print_Context puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Signal_Begin_Print (Glib.Signal_Name)

Signal_Begin_Print : constant Glib.Signal_Name := "begin-print";

Signal_Create_Custom_Widget (Glib.Signal_Name)

Signal_Create_Custom_Widget : constant Glib.Signal_Name := "create-custom-widget";

Signal_Custom_Widget_Apply (Glib.Signal_Name)

Signal_Custom_Widget_Apply : constant Glib.Signal_Name := "custom-widget-apply";

Signal_Done (Glib.Signal_Name)

Signal_Done : constant Glib.Signal_Name := "done";

Signal_Draw_Page (Glib.Signal_Name)

Signal_Draw_Page : constant Glib.Signal_Name := "draw-page";

Signal_End_Print (Glib.Signal_Name)

Signal_End_Print : constant Glib.Signal_Name := "end-print";

Signal_Paginate (Glib.Signal_Name)

Signal_Paginate : constant Glib.Signal_Name := "paginate";

Signal_Preview (Glib.Signal_Name)

Signal_Preview : constant Glib.Signal_Name := "preview";

Signal_Request_Page_Setup (Glib.Signal_Name)

Signal_Request_Page_Setup : constant Glib.Signal_Name := "request-page-setup";

Signal_Status_Changed (Glib.Signal_Name)

Signal_Status_Changed : constant Glib.Signal_Name := "status-changed";

Signal_Update_Custom_Widget (Glib.Signal_Name)

Signal_Update_Custom_Widget : constant Glib.Signal_Name := "update-custom-widget";

Subprograms & Entries

Gtk_New

procedure Gtk_New 
(Self: out Gtk_Print_Operation);

Initialize

procedure Initialize 
(Self: not null access Gtk_Print_Operation_Record'Class);
Creates a new Gtk.Print_Operation.Gtk_Print_Operation. Since: gtk+ 2.10

Gtk_Print_Operation_New

function Gtk_Print_Operation_New return Gtk_Print_Operation;
Creates a new Gtk.Print_Operation.Gtk_Print_Operation. Since: gtk+ 2.10

Get_Type

function Get_Type return Glib.GType;

Cancel

procedure Cancel 
(Self: not null access Gtk_Print_Operation_Record);
Cancels a running print operation. This function may be called from a Gtk.Print_Operation.Gtk_Print_Operation::begin-print, Gtk.Print_Operation.Gtk_Print_Operation::paginate or Gtk.Print_Operation.Gtk_Print_Operation::draw-page signal handler to stop the currently running print operation. Since: gtk+ 2.10

Draw_Page_Finish

procedure Draw_Page_Finish 
(Self: not null access Gtk_Print_Operation_Record);
Signalize that drawing of particular page is complete. It is called after completion of page drawing (e.g. drawing in another thread). If Gtk.Print_Operation.Set_Defer_Drawing was called before, then this function has to be called by application. In another case it is called by the library itself. Since: gtk+ 2.16

Get_Default_Page_Setup

function Get_Default_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record) return Gtk.Page_Setup.Gtk_Page_Setup;
Returns the default page setup, see Gtk.Print_Operation.Set_Default_Page_Setup. Since: gtk+ 2.10

Set_Default_Page_Setup

procedure Set_Default_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record;
Default_Page_Setup: access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class);
Makes Default_Page_Setup the default page setup for Op. This page setup will be used by Gtk.Print_Operation.Run, but it can be overridden on a per-page basis by connecting to the Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup signal. Since: gtk+ 2.10 "default_page_setup": a Gtk.Page_Setup.Gtk_Page_Setup, or null

Get_Embed_Page_Setup

function Get_Embed_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record) return Boolean;
Gets the value of Gtk.Print_Operation.Gtk_Print_Operation:embed-page-setup property. Since: gtk+ 2.18

Set_Embed_Page_Setup

procedure Set_Embed_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record;
Embed: Boolean);
Embed page size combo box and orientation combo box into page setup page. Selected page setup is stored as default page setup in Gtk.Print_Operation.Gtk_Print_Operation. Since: gtk+ 2.18 "embed": True to embed page setup selection in the Gtk_Print_Unix_Dialog

Get_Error

procedure Get_Error 
(Self: not null access Gtk_Print_Operation_Record);
Call this when the result of a print operation is Gtk.Print_Operation.Result_Error, either as returned by Gtk.Print_Operation.Run, or in the Gtk.Print_Operation.Gtk_Print_Operation::done signal handler. The returned Gerror.Gerror will contain more details on what went wrong. Since: gtk+ 2.10

Get_Has_Selection

function Get_Has_Selection 
(Self: not null access Gtk_Print_Operation_Record) return Boolean;
Gets the value of Gtk.Print_Operation.Gtk_Print_Operation:has-selection property. Since: gtk+ 2.18

Set_Has_Selection

procedure Set_Has_Selection 
(Self: not null access Gtk_Print_Operation_Record;
Has_Selection: Boolean);
Sets whether there is a selection to print. Application has to set number of pages to which the selection will draw by Gtk.Print_Operation.Set_N_Pages in a callback of Gtk.Print_Operation.Gtk_Print_Operation::begin-print. Since: gtk+ 2.18 "has_selection": True indicates that a selection exists

Get_N_Pages_To_Print

function Get_N_Pages_To_Print 
(Self: not null access Gtk_Print_Operation_Record) return Gint;
Returns the number of pages that will be printed. Note that this value is set during print preparation phase (Gtk.Print_Operation.Status_Preparing), so this function should never be called before the data generation phase (Gtk.Print_Operation.Status_Generating_Data). You can connect to the Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal and call Gtk.Print_Operation.Get_N_Pages_To_Print when print status is Gtk.Print_Operation.Status_Generating_Data. This is typically used to track the progress of print operation. Since: gtk+ 2.18

Get_Print_Settings

function Get_Print_Settings 
(Self: not null access Gtk_Print_Operation_Record) return Gtk.Print_Settings.Gtk_Print_Settings;
Returns the current print settings. Note that the return value is null until either Gtk.Print_Operation.Set_Print_Settings or Gtk.Print_Operation.Run have been called. Since: gtk+ 2.10

Set_Print_Settings

procedure Set_Print_Settings 
(Self: not null access Gtk_Print_Operation_Record;
Print_Settings: access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class);
Sets the print settings for Op. This is typically used to re-establish print settings from a previous print operation, see Gtk.Print_Operation.Run. Since: gtk+ 2.10 "print_settings": Gtk.Print_Settings.Gtk_Print_Settings

Get_Status

function Get_Status 
(Self: not null access Gtk_Print_Operation_Record) return Gtk_Print_Status;
Returns the status of the print operation. Also see Gtk.Print_Operation.Get_Status_String. Since: gtk+ 2.10

Get_Status_String

function Get_Status_String 
(Self: not null access Gtk_Print_Operation_Record) return UTF8_String;
Returns a string representation of the status of the print operation. The string is translated and suitable for displaying the print status e.g. in a Gtk.Status_Bar.Gtk_Status_Bar. Use Gtk.Print_Operation.Get_Status to obtain a status value that is suitable for programmatic use. Since: gtk+ 2.10

Get_Support_Selection

function Get_Support_Selection 
(Self: not null access Gtk_Print_Operation_Record) return Boolean;
Gets the value of Gtk.Print_Operation.Gtk_Print_Operation:support-selection property. Since: gtk+ 2.18

Set_Support_Selection

procedure Set_Support_Selection 
(Self: not null access Gtk_Print_Operation_Record;
Support_Selection: Boolean);
Sets whether selection is supported by Gtk.Print_Operation.Gtk_Print_Operation. Since: gtk+ 2.18 "support_selection": True to support selection

Is_Finished

function Is_Finished 
(Self: not null access Gtk_Print_Operation_Record) return Boolean;
A convenience function to find out if the print operation is finished, either successfully (Gtk.Print_Operation.Status_Finished) or unsuccessfully (Gtk.Print_Operation.Status_Finished_Aborted). Note: when you enable print status tracking the print operation can be in a non-finished state even after done has been called, as the operation status then tracks the print job status on the printer. Since: gtk+ 2.10

Run

function Run 
(Self: not null access Gtk_Print_Operation_Record;
Action: Gtk_Print_Operation_Action;
Parent: access Gtk.Window.Gtk_Window_Record'Class) return Gtk_Print_Operation_Result;
Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document. Normally that this function does not return until the rendering of all pages is complete. You can connect to the Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal on Op to obtain some information about the progress of the print operation. Furthermore, it may use a recursive mainloop to show the print dialog. If you call Gtk.Print_Operation.Set_Allow_Async or set the Gtk.Print_Operation.Gtk_Print_Operation:allow-async property the operation will run asynchronously if this is supported on the platform. The Gtk.Print_Operation.Gtk_Print_Operation::done signal will be emitted with the result of the operation when the it is done (i.e. when the dialog is canceled, or when the print succeeds or fails). |[ if (settings != NULL) gtk_print_operation_set_print_settings (print, settings); if (page_setup != NULL) gtk_print_operation_set_default_page_setup (print, page_setup); g_signal_connect (print, "begin-print", G_CALLBACK (begin_print), &data); g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), &data); res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, parent, &error); if (res == GTK_PRINT_OPERATION_RESULT_ERROR) { error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error printing file:\n%s", error->message); g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (error_dialog); g_error_free (error); } else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != NULL) g_object_unref (settings); settings = g_object_ref (gtk_print_operation_get_print_settings (print)); } ]| Note that Gtk.Print_Operation.Run can only be called once on a given Gtk.Print_Operation.Gtk_Print_Operation. Since: gtk+ 2.10 "action": the action to start "parent": Transient parent of the dialog

Set_Allow_Async

procedure Set_Allow_Async 
(Self: not null access Gtk_Print_Operation_Record;
Allow_Async: Boolean);
Sets whether the Gtk.Print_Operation.Run may return before the print operation is completed. Note that some platforms may not allow asynchronous operation. Since: gtk+ 2.10 "allow_async": True to allow asynchronous operation

Set_Current_Page

procedure Set_Current_Page 
(Self: not null access Gtk_Print_Operation_Record;
Current_Page: Gint);
Sets the current page. If this is called before Gtk.Print_Operation.Run, the user will be able to select to print only the current page. Note that this only makes sense for pre-paginated documents. Since: gtk+ 2.10 "current_page": the current page, 0-based

Set_Custom_Tab_Label

procedure Set_Custom_Tab_Label 
(Self: not null access Gtk_Print_Operation_Record;
Label: UTF8_String := "");
Sets the label for the tab holding custom widgets. Since: gtk+ 2.10 "label": the label to use, or null to use the default label

Set_Defer_Drawing

procedure Set_Defer_Drawing 
(Self: not null access Gtk_Print_Operation_Record);
Sets up the Gtk.Print_Operation.Gtk_Print_Operation to wait for calling of Gtk.Print_Operation.Draw_Page_Finish from application. It can be used for drawing page in another thread. This function must be called in the callback of "draw-page" signal. Since: gtk+ 2.16

Set_Export_Filename

procedure Set_Export_Filename 
(Self: not null access Gtk_Print_Operation_Record;
Filename: UTF8_String);
Sets up the Gtk.Print_Operation.Gtk_Print_Operation to generate a file instead of showing the print dialog. The indended use of this function is for implementing "Export to PDF" actions. Currently, PDF is the only supported format. "Print to PDF" support is independent of this and is done by letting the user pick the "Print to PDF" item from the list of printers in the print dialog. Since: gtk+ 2.10 "filename": the filename for the exported file

Set_Job_Name

procedure Set_Job_Name 
(Self: not null access Gtk_Print_Operation_Record;
Job_Name: UTF8_String);
Sets the name of the print job. The name is used to identify the job (e.g. in monitoring applications like eggcups). If you don't set a job name, GTK+ picks a default one by numbering successive print jobs. Since: gtk+ 2.10 "job_name": a string that identifies the print job

Set_N_Pages

procedure Set_N_Pages 
(Self: not null access Gtk_Print_Operation_Record;
N_Pages: Gint);
Sets the number of pages in the document. This *must* be set to a positive number before the rendering starts. It may be set in a Gtk.Print_Operation.Gtk_Print_Operation::begin-print signal hander. Note that the page numbers passed to the Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup and Gtk.Print_Operation.Gtk_Print_Operation::draw-page signals are 0-based, i.e. if the user chooses to print all pages, the last ::draw-page signal will be for page N_Pages - 1. Since: gtk+ 2.10 "n_pages": the number of pages

Set_Show_Progress

procedure Set_Show_Progress 
(Self: not null access Gtk_Print_Operation_Record;
Show_Progress: Boolean);
If Show_Progress is True, the print operation will show a progress dialog during the print operation. Since: gtk+ 2.10 "show_progress": True to show a progress dialog

Set_Track_Print_Status

procedure Set_Track_Print_Status 
(Self: not null access Gtk_Print_Operation_Record;
Track_Status: Boolean);
If track_status is True, the print operation will try to continue report on the status of the print job in the printer queues and printer. This can allow your application to show things like "out of paper" issues, and when the print job actually reaches the printer. This function is often implemented using some form of polling, so it should not be enabled unless needed. Since: gtk+ 2.10 "track_status": True to track status after printing

Set_Unit

procedure Set_Unit 
(Self: not null access Gtk_Print_Operation_Record;
Unit: Gtk.Enums.Gtk_Unit);
Sets up the transformation for the cairo context obtained from Gtk.Print_Context.Gtk_Print_Context in such a way that distances are measured in units of Unit. Since: gtk+ 2.10 "unit": the unit to use

Set_Use_Full_Page

procedure Set_Use_Full_Page 
(Self: not null access Gtk_Print_Operation_Record;
Full_Page: Boolean);
If Full_Page is True, the transformation for the cairo context obtained from Gtk.Print_Context.Gtk_Print_Context puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins). Since: gtk+ 2.10 "full_page": True to set up the Gtk.Print_Context.Gtk_Print_Context for the full page

End_Preview

procedure End_Preview 
(Preview: not null access Gtk_Print_Operation_Record);

Is_Selected

function Is_Selected 
(Preview: not null access Gtk_Print_Operation_Record;
Page_Nr: Gint) return Boolean;

Render_Page

procedure Render_Page 
(Preview: not null access Gtk_Print_Operation_Record;
Page_Nr: Gint);

On_Begin_Print

procedure On_Begin_Print 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Context_Void;
After: Boolean := False);

On_Begin_Print

procedure On_Begin_Print 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Context_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts. A typical use for ::begin-print is to use the parameters from the Gtk.Print_Context.Gtk_Print_Context and paginate the document accordingly, and then set the number of pages with Gtk.Print_Operation.Set_N_Pages.

On_Create_Custom_Widget

procedure On_Create_Custom_Widget 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_GObject;
After: Boolean := False);

On_Create_Custom_Widget

procedure On_Create_Custom_Widget 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_GObject;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted when displaying the print dialog. If you return a widget in a handler for this signal it will be added to a custom tab in the print dialog. You typically return a container widget with multiple widgets in it. The print dialog owns the returned widget, and its lifetime is not controlled by the application. However, the widget is guaranteed to stay around until the Gtk.Print_Operation.Gtk_Print_Operation::custom-widget-apply signal is emitted on the operation. Then you can read out any information you need from the widgets. Callback parameters: -- Returns A custom widget that gets embedded in the print dialog, or null

On_Custom_Widget_Apply

procedure On_Custom_Widget_Apply 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Widget_Void;
After: Boolean := False);

On_Custom_Widget_Apply

procedure On_Custom_Widget_Apply 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Widget_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted right before Gtk.Print_Operation.Gtk_Print_Operation::begin-print if you added a custom widget in the Gtk.Print_Operation.Gtk_Print_Operation::create-custom-widget handler. When you get this signal you should read the information from the custom widgets, as the widgets are not guaraneed to be around at a later time.

On_Done

procedure On_Done 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void;
After: Boolean := False);

On_Done

procedure On_Done 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Operation_Result_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted when the print operation run has finished doing everything required for printing. Result gives you information about what happened during the run. If Result is Gtk.Print_Operation.Result_Error then you can call Gtk.Print_Operation.Get_Error for more information. If you enabled print status tracking then Gtk.Print_Operation.Is_Finished may still return False after Gtk.Print_Operation.Gtk_Print_Operation::done was emitted.

On_Draw_Page

procedure On_Draw_Page 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void;
After: Boolean := False);

On_Draw_Page

procedure On_Draw_Page 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Context_Gint_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted for every page that is printed. The signal handler must render the Page_Nr's page onto the cairo context obtained from Context using Gtk.Print_Context.Get_Cairo_Context. |[ static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { cairo_t *cr; PangoLayout *layout; gdouble width, text_height; gint layout_height; PangoFontDescription *desc; cr = gtk_print_context_get_cairo_context (context); width = gtk_print_context_get_width (context); cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT); cairo_set_source_rgb (cr, 0.8, 0.8, 0.8); cairo_fill (cr); layout = gtk_print_context_create_pango_layout (context); desc = pango_font_description_from_string ("sans 14"); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); pango_layout_set_text (layout, "some text", -1); pango_layout_set_width (layout, width * PANGO_SCALE); pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); pango_layout_get_size (layout, NULL, &layout_height); text_height = (gdouble)layout_height / PANGO_SCALE; cairo_move_to (cr, width / 2, (HEADER_HEIGHT - text_height) / 2); pango_cairo_show_layout (cr, layout); g_object_unref (layout); } ]| Use Gtk.Print_Operation.Set_Use_Full_Page and Gtk.Print_Operation.Set_Unit before starting the print operation to set up the transformation of the cairo context according to your needs. Callback parameters: -- "context": the Gtk.Print_Context.Gtk_Print_Context for the current -- operation -- "page_nr": the number of the currently printed page (0-based)

On_End_Print

procedure On_End_Print 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Context_Void;
After: Boolean := False);

On_End_Print

procedure On_End_Print 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Context_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the Gtk.Print_Operation.Gtk_Print_Operation::begin-print handler.

On_Paginate

procedure On_Paginate 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean;
After: Boolean := False);

On_Paginate

procedure On_Paginate 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Context_Boolean;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted after the Gtk.Print_Operation.Gtk_Print_Operation::begin-print signal, but before the actual rendering starts. It keeps getting emitted until a connected signal handler returns True. The ::paginate signal is intended to be used for paginating a document in small chunks, to avoid blocking the user interface for a long time. The signal handler should update the number of pages using Gtk.Print_Operation.Set_N_Pages, and return True if the document has been completely paginated. If you don't need to do pagination in chunks, you can simply do it all in the ::begin-print handler, and set the number of pages from there. Callback parameters: -- "context": the Gtk.Print_Context.Gtk_Print_Context for the current -- operation -- Returns True if pagination is complete

On_Preview

procedure On_Preview 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean;
After: Boolean := False);

On_Preview

procedure On_Preview 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Gets emitted when a preview is requested from the native dialog. The default handler for this signal uses an external viewer application to preview. To implement a custom print preview, an application must return True from its handler for this signal. In order to use the provided Context for the preview implementation, it must be given a suitable cairo context with Gtk.Print_Context.Set_Cairo_Context. The custom preview implementation can use Gtk.Print_Operation_Preview.Is_Selected and Gtk.Print_Operation_Preview.Render_Page to find pages which are selected for print and render them. The preview must be finished by calling Gtk.Print_Operation_Preview.End_Preview (typically in response to the user clicking a close button). Callback parameters: -- "preview": the Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview -- for the current operation -- "context": the Gtk.Print_Context.Gtk_Print_Context that will be used -- "parent": the Gtk.Window.Gtk_Window to use as window parent, or null -- Returns True if the listener wants to take over control of the preview

On_Request_Page_Setup

procedure On_Request_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void;
After: Boolean := False);

On_Request_Page_Setup

procedure On_Request_Page_Setup 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted once for every page that is printed, to give the application a chance to modify the page setup. Any changes done to Setup will be in force only for printing this page. Callback parameters: -- "context": the Gtk.Print_Context.Gtk_Print_Context for the current -- operation -- "page_nr": the number of the currently printed page (0-based) -- "setup": the Gtk.Page_Setup.Gtk_Page_Setup

On_Status_Changed

procedure On_Status_Changed 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Void;
After: Boolean := False);

On_Status_Changed

procedure On_Status_Changed 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted at between the various phases of the print operation. See Gtk.Print_Operation.Gtk_Print_Status for the phases that are being discriminated. Use Gtk.Print_Operation.Get_Status to find out the current status.

On_Update_Custom_Widget

procedure On_Update_Custom_Widget 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_Gtk_Print_Operation_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void;
After: Boolean := False);

On_Update_Custom_Widget

procedure On_Update_Custom_Widget 
(Self: not null access Gtk_Print_Operation_Record;
Call: Cb_GObject_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Emitted after change of selected printer. The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change. Callback parameters: -- "widget": the custom widget added in create-custom-widget -- "setup": actual page setup -- "settings": actual print settings