package Gtk_Print_Status_Properties is new Generic_Internal_Discrete_Property (Gtk_Print_Status);
package Gtk_Print_Operation_Result_Properties is new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Result);
package Gtk_Print_Operation_Action_Properties is new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Action);
package Gtk_Print_Error_Properties is new Generic_Internal_Discrete_Property (Gtk_Print_Error);
package Implements_Gtk_Print_Operation_Preview is new Glib.Types.Implements (Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview, Gtk_Print_Operation_Record, Gtk_Print_Operation);
type Gtk_Print_Operation_Record is new GObject_Record with null record;
type Gtk_Print_Operation is access all Gtk_Print_Operation_Record'Class;
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);
type Gtk_Print_Operation_Result is ( Result_Error, Result_Apply, Result_Cancel, Result_In_Progress);
type Gtk_Print_Operation_Action is ( Action_Print_Dialog, Action_Print, Action_Preview, Action_Export);
type Gtk_Print_Error is ( Error_General, Error_Internal_Error, Error_Nomem, Error_Invalid_File);
type Property_Gtk_Print_Status is new Gtk_Print_Status_Properties.Property;
type Property_Gtk_Print_Operation_Result is new Gtk_Print_Operation_Result_Properties.Property;
type Property_Gtk_Print_Operation_Action is new Gtk_Print_Operation_Action_Properties.Property;
type Property_Gtk_Print_Error is new Gtk_Print_Error_Properties.Property;
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);
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);
type Cb_Gtk_Print_Operation_GObject is not null access function (Self : access Gtk_Print_Operation_Record'Class) return Glib.Object.GObject;
type Cb_GObject_GObject is not null access function (Self : access Glib.Object.GObject_Record'Class) return Glib.Object.GObject;
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);
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);
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);
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);
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);
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);
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;
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;
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;
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;
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);
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);
type Cb_Gtk_Print_Operation_Void is not null access procedure (Self : access Gtk_Print_Operation_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
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);
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);
Allow_Async_Property : constant Glib.Properties.Property_Boolean;
Current_Page_Property : constant Glib.Properties.Property_Int;
Custom_Tab_Label_Property : constant Glib.Properties.Property_String;
Default_Page_Setup_Property : constant Glib.Properties.Property_Object;
Embed_Page_Setup_Property : constant Glib.Properties.Property_Boolean;
Export_Filename_Property : constant Glib.Properties.Property_String;
Has_Selection_Property : constant Glib.Properties.Property_Boolean;
Job_Name_Property : constant Glib.Properties.Property_String;
N_Pages_Property : constant Glib.Properties.Property_Int;
N_Pages_To_Print_Property : constant Glib.Properties.Property_Int;
Print_Settings_Property : constant Glib.Properties.Property_Object;
Show_Progress_Property : constant Glib.Properties.Property_Boolean;
Status_Property : constant Gtk.Print_Operation.Property_Gtk_Print_Status;
Status_String_Property : constant Glib.Properties.Property_String;
Support_Selection_Property : constant Glib.Properties.Property_Boolean;
Track_Print_Status_Property : constant Glib.Properties.Property_Boolean;
Unit_Property : constant Gtk.Enums.Property_Gtk_Unit;
Use_Full_Page_Property : constant Glib.Properties.Property_Boolean;
Signal_Begin_Print : constant Glib.Signal_Name := "begin-print";
Signal_Create_Custom_Widget : constant Glib.Signal_Name := "create-custom-widget";
Signal_Custom_Widget_Apply : constant Glib.Signal_Name := "custom-widget-apply";
Signal_Done : constant Glib.Signal_Name := "done";
Signal_Draw_Page : constant Glib.Signal_Name := "draw-page";
Signal_End_Print : constant Glib.Signal_Name := "end-print";
Signal_Paginate : constant Glib.Signal_Name := "paginate";
Signal_Preview : constant Glib.Signal_Name := "preview";
Signal_Request_Page_Setup : constant Glib.Signal_Name := "request-page-setup";
Signal_Status_Changed : constant Glib.Signal_Name := "status-changed";
Signal_Update_Custom_Widget : constant Glib.Signal_Name := "update-custom-widget";
procedure Gtk_New
( | Self | : out Gtk_Print_Operation); |
procedure Initialize
( | Self | : not null access Gtk_Print_Operation_Record'Class); |
function Gtk_Print_Operation_New return Gtk_Print_Operation;
function Get_Type return Glib.GType;
procedure Cancel
( | Self | : not null access Gtk_Print_Operation_Record); |
procedure Draw_Page_Finish
( | Self | : not null access Gtk_Print_Operation_Record); |
function Get_Default_Page_Setup
( | Self | : not null access Gtk_Print_Operation_Record) return Gtk.Page_Setup.Gtk_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); |
function Get_Embed_Page_Setup
( | Self | : not null access Gtk_Print_Operation_Record) return Boolean; |
procedure Set_Embed_Page_Setup
( | Self | : not null access Gtk_Print_Operation_Record; |
Embed | : Boolean); |
procedure Get_Error
( | Self | : not null access Gtk_Print_Operation_Record); |
function Get_Has_Selection
( | Self | : not null access Gtk_Print_Operation_Record) return Boolean; |
procedure Set_Has_Selection
( | Self | : not null access Gtk_Print_Operation_Record; |
Has_Selection | : Boolean); |
function Get_N_Pages_To_Print
( | Self | : not null access Gtk_Print_Operation_Record) return Gint; |
function Get_Print_Settings
( | Self | : not null access Gtk_Print_Operation_Record) return Gtk.Print_Settings.Gtk_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); |
function Get_Status
( | Self | : not null access Gtk_Print_Operation_Record) return Gtk_Print_Status; |
function Get_Status_String
( | Self | : not null access Gtk_Print_Operation_Record) return UTF8_String; |
function Get_Support_Selection
( | Self | : not null access Gtk_Print_Operation_Record) return Boolean; |
procedure Set_Support_Selection
( | Self | : not null access Gtk_Print_Operation_Record; |
Support_Selection | : Boolean); |
function Is_Finished
( | Self | : not null access Gtk_Print_Operation_Record) return Boolean; |
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; |
procedure Set_Allow_Async
( | Self | : not null access Gtk_Print_Operation_Record; |
Allow_Async | : Boolean); |
procedure Set_Current_Page
( | Self | : not null access Gtk_Print_Operation_Record; |
Current_Page | : Gint); |
procedure Set_Custom_Tab_Label
( | Self | : not null access Gtk_Print_Operation_Record; |
Label | : UTF8_String := ""); |
procedure Set_Defer_Drawing
( | Self | : not null access Gtk_Print_Operation_Record); |
procedure Set_Export_Filename
( | Self | : not null access Gtk_Print_Operation_Record; |
Filename | : UTF8_String); |
procedure Set_Job_Name
( | Self | : not null access Gtk_Print_Operation_Record; |
Job_Name | : UTF8_String); |
procedure Set_N_Pages
( | Self | : not null access Gtk_Print_Operation_Record; |
N_Pages | : Gint); |
procedure Set_Show_Progress
( | Self | : not null access Gtk_Print_Operation_Record; |
Show_Progress | : Boolean); |
procedure Set_Track_Print_Status
( | Self | : not null access Gtk_Print_Operation_Record; |
Track_Status | : Boolean); |
procedure Set_Unit
( | Self | : not null access Gtk_Print_Operation_Record; |
Unit | : Gtk.Enums.Gtk_Unit); |
procedure Set_Use_Full_Page
( | Self | : not null access Gtk_Print_Operation_Record; |
Full_Page | : Boolean); |
procedure End_Preview
( | Preview | : not null access Gtk_Print_Operation_Record); |
function Is_Selected
( | Preview | : not null access Gtk_Print_Operation_Record; |
Page_Nr | : Gint) return Boolean; |
procedure Render_Page
( | Preview | : not null access Gtk_Print_Operation_Record; |
Page_Nr | : Gint); |
procedure On_Begin_Print
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Gtk_Print_Context_Void; | |
After | : Boolean := False); |
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); |
procedure On_Create_Custom_Widget
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_GObject; | |
After | : Boolean := False); |
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); |
procedure On_Custom_Widget_Apply
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Gtk_Widget_Void; | |
After | : Boolean := False); |
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); |
procedure On_Done
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void; | |
After | : Boolean := False); |
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); |
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); |
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); |
procedure On_End_Print
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Gtk_Print_Context_Void; | |
After | : Boolean := False); |
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); |
procedure On_Paginate
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean; | |
After | : Boolean := False); |
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); |
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); |
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); |
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); |
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); |
procedure On_Status_Changed
( | Self | : not null access Gtk_Print_Operation_Record; |
Call | : Cb_Gtk_Print_Operation_Void; | |
After | : Boolean := False); |
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); |
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); |
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); |
function "+"
( | Widget | : access Gtk_Print_Operation_Record'Class) return Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview renames Implements_Gtk_Print_Operation_Preview.To_Interface; |
function "-"
( | Interf | : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview) return Gtk_Print_Operation renames Implements_Gtk_Print_Operation_Preview.To_Object; |
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.