1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  GtkPrintOperation is the high-level, portable printing API. It looks a bit 
  26. --  different than other GTK+ dialogs such as the 
  27. --  Gtk.File_Chooser.Gtk_File_Chooser, since some platforms don't expose enough 
  28. --  infrastructure to implement a good print dialog. On such platforms, 
  29. --  GtkPrintOperation uses the native print dialog. On platforms which do not 
  30. --  provide a native print dialog, GTK+ uses its own, see 
  31. --  Gtk_Print_Unix_Dialog. 
  32. -- 
  33. --  The typical way to use the high-level printing API is to create a 
  34. --  GtkPrintOperation object with Gtk.Print_Operation.Gtk_New when the user 
  35. --  selects to print. Then you set some properties on it, e.g. the page size, 
  36. --  any Gtk.Print_Settings.Gtk_Print_Settings from previous print operations, 
  37. --  the number of pages, the current page, etc. 
  38. -- 
  39. --  Then you start the print operation by calling Gtk.Print_Operation.Run. It 
  40. --  will then show a dialog, let the user select a printer and options. When 
  41. --  the user finished the dialog various signals will be emitted on the 
  42. --  Gtk.Print_Operation.Gtk_Print_Operation, the main one being 
  43. --  Gtk.Print_Operation.Gtk_Print_Operation::draw-page, which you are supposed 
  44. --  to catch and render the page on the provided 
  45. --  Gtk.Print_Context.Gtk_Print_Context using Cairo. 
  46. -- 
  47. --  == The high-level printing API == 
  48. -- 
  49. --    static GtkPrintSettings *settings = NULL; 
  50. --    static void 
  51. --    do_print (void) 
  52. --    { 
  53. --       GtkPrintOperation *print; 
  54. --       GtkPrintOperationResult res; 
  55. --       print = gtk_print_operation_new (); 
  56. --       if (settings != NULL) 
  57. --       gtk_print_operation_set_print_settings (print, settings); 
  58. --       g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL); 
  59. --       g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL); 
  60. --       res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, 
  61. --          GTK_WINDOW (main_window), NULL); 
  62. --       if (res == GTK_PRINT_OPERATION_RESULT_APPLY) 
  63. --       { 
  64. --          if (settings != NULL) 
  65. --          g_object_unref (settings); 
  66. --          settings = g_object_ref (gtk_print_operation_get_print_settings (print)); 
  67. --       } 
  68. --       g_object_unref (print); 
  69. --    } 
  70. -- 
  71. --  By default GtkPrintOperation uses an external application to do print 
  72. --  preview. To implement a custom print preview, an application must connect 
  73. --  to the preview signal. The functions 
  74. --  Gtk.Print_Operation_Preview.Render_Page, 
  75. --  Gtk.Print_Operation_Preview.End_Preview and 
  76. --  Gtk.Print_Operation_Preview.Is_Selected are useful when implementing a 
  77. --  print preview. 
  78. -- 
  79. --  </description> 
  80. pragma Ada_2005; 
  81.  
  82. pragma Warnings (Off, "*is already use-visible*"); 
  83. with Glib;                        use Glib; 
  84. with Glib.Generic_Properties;     use Glib.Generic_Properties; 
  85. with Glib.Object;                 use Glib.Object; 
  86. with Glib.Properties;             use Glib.Properties; 
  87. with Glib.Types;                  use Glib.Types; 
  88. with Gtk.Enums;                   use Gtk.Enums; 
  89. with Gtk.Page_Setup;              use Gtk.Page_Setup; 
  90. with Gtk.Print_Context;           use Gtk.Print_Context; 
  91. with Gtk.Print_Operation_Preview; use Gtk.Print_Operation_Preview; 
  92. with Gtk.Print_Settings;          use Gtk.Print_Settings; 
  93. with Gtk.Widget;                  use Gtk.Widget; 
  94. with Gtk.Window;                  use Gtk.Window; 
  95.  
  96. package Gtk.Print_Operation is 
  97.  
  98.    type Gtk_Print_Operation_Record is new GObject_Record with null record; 
  99.    type Gtk_Print_Operation is access all Gtk_Print_Operation_Record'Class; 
  100.  
  101.    type Gtk_Print_Status is ( 
  102.       Status_Initial, 
  103.       Status_Preparing, 
  104.       Status_Generating_Data, 
  105.       Status_Sending_Data, 
  106.       Status_Pending, 
  107.       Status_Pending_Issue, 
  108.       Status_Printing, 
  109.       Status_Finished, 
  110.       Status_Finished_Aborted); 
  111.    pragma Convention (C, Gtk_Print_Status); 
  112.    --  The status gives a rough indication of the completion of a running 
  113.    --  print operation. 
  114.  
  115.    type Gtk_Print_Operation_Result is ( 
  116.       Result_Error, 
  117.       Result_Apply, 
  118.       Result_Cancel, 
  119.       Result_In_Progress); 
  120.    pragma Convention (C, Gtk_Print_Operation_Result); 
  121.    --  A value of this type is returned by Gtk.Print_Operation.Run. 
  122.  
  123.    type Gtk_Print_Operation_Action is ( 
  124.       Action_Print_Dialog, 
  125.       Action_Print, 
  126.       Action_Preview, 
  127.       Action_Export); 
  128.    pragma Convention (C, Gtk_Print_Operation_Action); 
  129.    --  The Action parameter to Gtk.Print_Operation.Run determines what action 
  130.    --  the print operation should perform. 
  131.  
  132.    type Gtk_Print_Error is ( 
  133.       Error_General, 
  134.       Error_Internal_Error, 
  135.       Error_Nomem, 
  136.       Error_Invalid_File); 
  137.    pragma Convention (C, Gtk_Print_Error); 
  138.    --  Error codes that identify various errors that can occur while using the 
  139.    --  GTK+ printing support. 
  140.  
  141.    ---------------------------- 
  142.    -- Enumeration Properties -- 
  143.    ---------------------------- 
  144.  
  145.    package Gtk_Print_Status_Properties is 
  146.       new Generic_Internal_Discrete_Property (Gtk_Print_Status); 
  147.    type Property_Gtk_Print_Status is new Gtk_Print_Status_Properties.Property; 
  148.  
  149.    package Gtk_Print_Operation_Result_Properties is 
  150.       new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Result); 
  151.    type Property_Gtk_Print_Operation_Result is new Gtk_Print_Operation_Result_Properties.Property; 
  152.  
  153.    package Gtk_Print_Operation_Action_Properties is 
  154.       new Generic_Internal_Discrete_Property (Gtk_Print_Operation_Action); 
  155.    type Property_Gtk_Print_Operation_Action is new Gtk_Print_Operation_Action_Properties.Property; 
  156.  
  157.    package Gtk_Print_Error_Properties is 
  158.       new Generic_Internal_Discrete_Property (Gtk_Print_Error); 
  159.    type Property_Gtk_Print_Error is new Gtk_Print_Error_Properties.Property; 
  160.  
  161.    ------------------ 
  162.    -- Constructors -- 
  163.    ------------------ 
  164.  
  165.    procedure Gtk_New (Self : out Gtk_Print_Operation); 
  166.    procedure Initialize 
  167.       (Self : not null access Gtk_Print_Operation_Record'Class); 
  168.    --  Creates a new Gtk.Print_Operation.Gtk_Print_Operation. 
  169.    --  Since: gtk+ 2.10 
  170.  
  171.    function Gtk_Print_Operation_New return Gtk_Print_Operation; 
  172.    --  Creates a new Gtk.Print_Operation.Gtk_Print_Operation. 
  173.    --  Since: gtk+ 2.10 
  174.  
  175.    function Get_Type return Glib.GType; 
  176.    pragma Import (C, Get_Type, "gtk_print_operation_get_type"); 
  177.  
  178.    ------------- 
  179.    -- Methods -- 
  180.    ------------- 
  181.  
  182.    procedure Cancel (Self : not null access Gtk_Print_Operation_Record); 
  183.    --  Cancels a running print operation. This function may be called from a 
  184.    --  Gtk.Print_Operation.Gtk_Print_Operation::begin-print, 
  185.    --  Gtk.Print_Operation.Gtk_Print_Operation::paginate or 
  186.    --  Gtk.Print_Operation.Gtk_Print_Operation::draw-page signal handler to 
  187.    --  stop the currently running print operation. 
  188.    --  Since: gtk+ 2.10 
  189.  
  190.    procedure Draw_Page_Finish 
  191.       (Self : not null access Gtk_Print_Operation_Record); 
  192.    --  Signalize that drawing of particular page is complete. 
  193.    --  It is called after completion of page drawing (e.g. drawing in another 
  194.    --  thread). If Gtk.Print_Operation.Set_Defer_Drawing was called before, 
  195.    --  then this function has to be called by application. In another case it 
  196.    --  is called by the library itself. 
  197.    --  Since: gtk+ 2.16 
  198.  
  199.    function Get_Default_Page_Setup 
  200.       (Self : not null access Gtk_Print_Operation_Record) 
  201.        return Gtk.Page_Setup.Gtk_Page_Setup; 
  202.    --  Returns the default page setup, see 
  203.    --  Gtk.Print_Operation.Set_Default_Page_Setup. 
  204.    --  Since: gtk+ 2.10 
  205.  
  206.    procedure Set_Default_Page_Setup 
  207.       (Self               : not null access Gtk_Print_Operation_Record; 
  208.        Default_Page_Setup : access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class); 
  209.    --  Makes Default_Page_Setup the default page setup for Op. 
  210.    --  This page setup will be used by Gtk.Print_Operation.Run, but it can be 
  211.    --  overridden on a per-page basis by connecting to the 
  212.    --  Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup signal. 
  213.    --  Since: gtk+ 2.10 
  214.    --  "default_page_setup": a Gtk.Page_Setup.Gtk_Page_Setup, or null 
  215.  
  216.    function Get_Embed_Page_Setup 
  217.       (Self : not null access Gtk_Print_Operation_Record) return Boolean; 
  218.    --  Gets the value of 
  219.    --  Gtk.Print_Operation.Gtk_Print_Operation:embed-page-setup property. 
  220.    --  Since: gtk+ 2.18 
  221.  
  222.    procedure Set_Embed_Page_Setup 
  223.       (Self  : not null access Gtk_Print_Operation_Record; 
  224.        Embed : Boolean); 
  225.    --  Embed page size combo box and orientation combo box into page setup 
  226.    --  page. Selected page setup is stored as default page setup in 
  227.    --  Gtk.Print_Operation.Gtk_Print_Operation. 
  228.    --  Since: gtk+ 2.18 
  229.    --  "embed": True to embed page setup selection in the 
  230.    --  Gtk_Print_Unix_Dialog 
  231.  
  232.    procedure Get_Error (Self : not null access Gtk_Print_Operation_Record); 
  233.    --  Call this when the result of a print operation is 
  234.    --  Gtk.Print_Operation.Result_Error, either as returned by 
  235.    --  Gtk.Print_Operation.Run, or in the 
  236.    --  Gtk.Print_Operation.Gtk_Print_Operation::done signal handler. The 
  237.    --  returned Gerror.Gerror will contain more details on what went wrong. 
  238.    --  Since: gtk+ 2.10 
  239.  
  240.    function Get_Has_Selection 
  241.       (Self : not null access Gtk_Print_Operation_Record) return Boolean; 
  242.    --  Gets the value of Gtk.Print_Operation.Gtk_Print_Operation:has-selection 
  243.    --  property. 
  244.    --  Since: gtk+ 2.18 
  245.  
  246.    procedure Set_Has_Selection 
  247.       (Self          : not null access Gtk_Print_Operation_Record; 
  248.        Has_Selection : Boolean); 
  249.    --  Sets whether there is a selection to print. 
  250.    --  Application has to set number of pages to which the selection will draw 
  251.    --  by Gtk.Print_Operation.Set_N_Pages in a callback of 
  252.    --  Gtk.Print_Operation.Gtk_Print_Operation::begin-print. 
  253.    --  Since: gtk+ 2.18 
  254.    --  "has_selection": True indicates that a selection exists 
  255.  
  256.    function Get_N_Pages_To_Print 
  257.       (Self : not null access Gtk_Print_Operation_Record) return Gint; 
  258.    --  Returns the number of pages that will be printed. 
  259.    --  Note that this value is set during print preparation phase 
  260.    --  (Gtk.Print_Operation.Status_Preparing), so this function should never be 
  261.    --  called before the data generation phase 
  262.    --  (Gtk.Print_Operation.Status_Generating_Data). You can connect to the 
  263.    --  Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal and call 
  264.    --  Gtk.Print_Operation.Get_N_Pages_To_Print when print status is 
  265.    --  Gtk.Print_Operation.Status_Generating_Data. This is typically used to 
  266.    --  track the progress of print operation. 
  267.    --  Since: gtk+ 2.18 
  268.  
  269.    function Get_Print_Settings 
  270.       (Self : not null access Gtk_Print_Operation_Record) 
  271.        return Gtk.Print_Settings.Gtk_Print_Settings; 
  272.    --  Returns the current print settings. 
  273.    --  Note that the return value is null until either 
  274.    --  Gtk.Print_Operation.Set_Print_Settings or Gtk.Print_Operation.Run have 
  275.    --  been called. 
  276.    --  Since: gtk+ 2.10 
  277.  
  278.    procedure Set_Print_Settings 
  279.       (Self           : not null access Gtk_Print_Operation_Record; 
  280.        Print_Settings : access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class); 
  281.    --  Sets the print settings for Op. This is typically used to re-establish 
  282.    --  print settings from a previous print operation, see 
  283.    --  Gtk.Print_Operation.Run. 
  284.    --  Since: gtk+ 2.10 
  285.    --  "print_settings": Gtk.Print_Settings.Gtk_Print_Settings 
  286.  
  287.    function Get_Status 
  288.       (Self : not null access Gtk_Print_Operation_Record) 
  289.        return Gtk_Print_Status; 
  290.    --  Returns the status of the print operation. Also see 
  291.    --  Gtk.Print_Operation.Get_Status_String. 
  292.    --  Since: gtk+ 2.10 
  293.  
  294.    function Get_Status_String 
  295.       (Self : not null access Gtk_Print_Operation_Record) return UTF8_String; 
  296.    --  Returns a string representation of the status of the print operation. 
  297.    --  The string is translated and suitable for displaying the print status 
  298.    --  e.g. in a Gtk.Status_Bar.Gtk_Status_Bar. 
  299.    --  Use Gtk.Print_Operation.Get_Status to obtain a status value that is 
  300.    --  suitable for programmatic use. 
  301.    --  Since: gtk+ 2.10 
  302.  
  303.    function Get_Support_Selection 
  304.       (Self : not null access Gtk_Print_Operation_Record) return Boolean; 
  305.    --  Gets the value of 
  306.    --  Gtk.Print_Operation.Gtk_Print_Operation:support-selection property. 
  307.    --  Since: gtk+ 2.18 
  308.  
  309.    procedure Set_Support_Selection 
  310.       (Self              : not null access Gtk_Print_Operation_Record; 
  311.        Support_Selection : Boolean); 
  312.    --  Sets whether selection is supported by 
  313.    --  Gtk.Print_Operation.Gtk_Print_Operation. 
  314.    --  Since: gtk+ 2.18 
  315.    --  "support_selection": True to support selection 
  316.  
  317.    function Is_Finished 
  318.       (Self : not null access Gtk_Print_Operation_Record) return Boolean; 
  319.    --  A convenience function to find out if the print operation is finished, 
  320.    --  either successfully (Gtk.Print_Operation.Status_Finished) or 
  321.    --  unsuccessfully (Gtk.Print_Operation.Status_Finished_Aborted). 
  322.    --  Note: when you enable print status tracking the print operation can be 
  323.    --  in a non-finished state even after done has been called, as the 
  324.    --  operation status then tracks the print job status on the printer. 
  325.    --  Since: gtk+ 2.10 
  326.  
  327.    function Run 
  328.       (Self   : not null access Gtk_Print_Operation_Record; 
  329.        Action : Gtk_Print_Operation_Action; 
  330.        Parent : access Gtk.Window.Gtk_Window_Record'Class) 
  331.        return Gtk_Print_Operation_Result; 
  332.    --  Runs the print operation, by first letting the user modify print 
  333.    --  settings in the print dialog, and then print the document. 
  334.    --  Normally that this function does not return until the rendering of all 
  335.    --  pages is complete. You can connect to the 
  336.    --  Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal on Op to 
  337.    --  obtain some information about the progress of the print operation. 
  338.    --  Furthermore, it may use a recursive mainloop to show the print dialog. 
  339.    --  If you call Gtk.Print_Operation.Set_Allow_Async or set the 
  340.    --  Gtk.Print_Operation.Gtk_Print_Operation:allow-async property the 
  341.    --  operation will run asynchronously if this is supported on the platform. 
  342.    --  The Gtk.Print_Operation.Gtk_Print_Operation::done signal will be emitted 
  343.    --  with the result of the operation when the it is done (i.e. when the 
  344.    --  dialog is canceled, or when the print succeeds or fails). |[ if 
  345.    --  (settings != NULL) gtk_print_operation_set_print_settings (print, 
  346.    --  settings); if (page_setup != NULL) 
  347.    --  gtk_print_operation_set_default_page_setup (print, page_setup); 
  348.    --  g_signal_connect (print, "begin-print", G_CALLBACK (begin_print), 
  349.    --  &data); g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), 
  350.    --  &data); res = gtk_print_operation_run (print, 
  351.    --  GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, parent, &error); if (res == 
  352.    --  GTK_PRINT_OPERATION_RESULT_ERROR) { error_dialog = 
  353.    --  gtk_message_dialog_new (GTK_WINDOW (parent), 
  354.    --  GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
  355.    --  "Error printing file:\n%s", error->message); g_signal_connect 
  356.    --  (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); 
  357.    --  gtk_widget_show (error_dialog); g_error_free (error); } else if (res == 
  358.    --  GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != NULL) g_object_unref 
  359.    --  (settings); settings = g_object_ref 
  360.    --  (gtk_print_operation_get_print_settings (print)); } ]| 
  361.    --  Note that Gtk.Print_Operation.Run can only be called once on a given 
  362.    --  Gtk.Print_Operation.Gtk_Print_Operation. 
  363.    --  Since: gtk+ 2.10 
  364.    --  "action": the action to start 
  365.    --  "parent": Transient parent of the dialog 
  366.  
  367.    procedure Set_Allow_Async 
  368.       (Self        : not null access Gtk_Print_Operation_Record; 
  369.        Allow_Async : Boolean); 
  370.    --  Sets whether the Gtk.Print_Operation.Run may return before the print 
  371.    --  operation is completed. Note that some platforms may not allow 
  372.    --  asynchronous operation. 
  373.    --  Since: gtk+ 2.10 
  374.    --  "allow_async": True to allow asynchronous operation 
  375.  
  376.    procedure Set_Current_Page 
  377.       (Self         : not null access Gtk_Print_Operation_Record; 
  378.        Current_Page : Gint); 
  379.    --  Sets the current page. 
  380.    --  If this is called before Gtk.Print_Operation.Run, the user will be able 
  381.    --  to select to print only the current page. 
  382.    --  Note that this only makes sense for pre-paginated documents. 
  383.    --  Since: gtk+ 2.10 
  384.    --  "current_page": the current page, 0-based 
  385.  
  386.    procedure Set_Custom_Tab_Label 
  387.       (Self  : not null access Gtk_Print_Operation_Record; 
  388.        Label : UTF8_String := ""); 
  389.    --  Sets the label for the tab holding custom widgets. 
  390.    --  Since: gtk+ 2.10 
  391.    --  "label": the label to use, or null to use the default label 
  392.  
  393.    procedure Set_Defer_Drawing 
  394.       (Self : not null access Gtk_Print_Operation_Record); 
  395.    --  Sets up the Gtk.Print_Operation.Gtk_Print_Operation to wait for calling 
  396.    --  of Gtk.Print_Operation.Draw_Page_Finish from application. It can be used 
  397.    --  for drawing page in another thread. 
  398.    --  This function must be called in the callback of "draw-page" signal. 
  399.    --  Since: gtk+ 2.16 
  400.  
  401.    procedure Set_Export_Filename 
  402.       (Self     : not null access Gtk_Print_Operation_Record; 
  403.        Filename : UTF8_String); 
  404.    --  Sets up the Gtk.Print_Operation.Gtk_Print_Operation to generate a file 
  405.    --  instead of showing the print dialog. The indended use of this function 
  406.    --  is for implementing "Export to PDF" actions. Currently, PDF is the only 
  407.    --  supported format. 
  408.    --  "Print to PDF" support is independent of this and is done by letting 
  409.    --  the user pick the "Print to PDF" item from the list of printers in the 
  410.    --  print dialog. 
  411.    --  Since: gtk+ 2.10 
  412.    --  "filename": the filename for the exported file 
  413.  
  414.    procedure Set_Job_Name 
  415.       (Self     : not null access Gtk_Print_Operation_Record; 
  416.        Job_Name : UTF8_String); 
  417.    --  Sets the name of the print job. The name is used to identify the job 
  418.    --  (e.g. in monitoring applications like eggcups). 
  419.    --  If you don't set a job name, GTK+ picks a default one by numbering 
  420.    --  successive print jobs. 
  421.    --  Since: gtk+ 2.10 
  422.    --  "job_name": a string that identifies the print job 
  423.  
  424.    procedure Set_N_Pages 
  425.       (Self    : not null access Gtk_Print_Operation_Record; 
  426.        N_Pages : Gint); 
  427.    --  Sets the number of pages in the document. 
  428.    --  This *must* be set to a positive number before the rendering starts. It 
  429.    --  may be set in a Gtk.Print_Operation.Gtk_Print_Operation::begin-print 
  430.    --  signal hander. 
  431.    --  Note that the page numbers passed to the 
  432.    --  Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup and 
  433.    --  Gtk.Print_Operation.Gtk_Print_Operation::draw-page signals are 0-based, 
  434.    --  i.e. if the user chooses to print all pages, the last ::draw-page signal 
  435.    --  will be for page N_Pages - 1. 
  436.    --  Since: gtk+ 2.10 
  437.    --  "n_pages": the number of pages 
  438.  
  439.    procedure Set_Show_Progress 
  440.       (Self          : not null access Gtk_Print_Operation_Record; 
  441.        Show_Progress : Boolean); 
  442.    --  If Show_Progress is True, the print operation will show a progress 
  443.    --  dialog during the print operation. 
  444.    --  Since: gtk+ 2.10 
  445.    --  "show_progress": True to show a progress dialog 
  446.  
  447.    procedure Set_Track_Print_Status 
  448.       (Self         : not null access Gtk_Print_Operation_Record; 
  449.        Track_Status : Boolean); 
  450.    --  If track_status is True, the print operation will try to continue 
  451.    --  report on the status of the print job in the printer queues and printer. 
  452.    --  This can allow your application to show things like "out of paper" 
  453.    --  issues, and when the print job actually reaches the printer. 
  454.    --  This function is often implemented using some form of polling, so it 
  455.    --  should not be enabled unless needed. 
  456.    --  Since: gtk+ 2.10 
  457.    --  "track_status": True to track status after printing 
  458.  
  459.    procedure Set_Unit 
  460.       (Self : not null access Gtk_Print_Operation_Record; 
  461.        Unit : Gtk.Enums.Gtk_Unit); 
  462.    --  Sets up the transformation for the cairo context obtained from 
  463.    --  Gtk.Print_Context.Gtk_Print_Context in such a way that distances are 
  464.    --  measured in units of Unit. 
  465.    --  Since: gtk+ 2.10 
  466.    --  "unit": the unit to use 
  467.  
  468.    procedure Set_Use_Full_Page 
  469.       (Self      : not null access Gtk_Print_Operation_Record; 
  470.        Full_Page : Boolean); 
  471.    --  If Full_Page is True, the transformation for the cairo context obtained 
  472.    --  from Gtk.Print_Context.Gtk_Print_Context puts the origin at the top left 
  473.    --  corner of the page (which may not be the top left corner of the sheet, 
  474.    --  depending on page orientation and the number of pages per sheet). 
  475.    --  Otherwise, the origin is at the top left corner of the imageable area 
  476.    --  (i.e. inside the margins). 
  477.    --  Since: gtk+ 2.10 
  478.    --  "full_page": True to set up the Gtk.Print_Context.Gtk_Print_Context for 
  479.    --  the full page 
  480.  
  481.    --------------------------------------------- 
  482.    -- Inherited subprograms (from interfaces) -- 
  483.    --------------------------------------------- 
  484.  
  485.    procedure End_Preview 
  486.       (Preview : not null access Gtk_Print_Operation_Record); 
  487.  
  488.    function Is_Selected 
  489.       (Preview : not null access Gtk_Print_Operation_Record; 
  490.        Page_Nr : Gint) return Boolean; 
  491.  
  492.    procedure Render_Page 
  493.       (Preview : not null access Gtk_Print_Operation_Record; 
  494.        Page_Nr : Gint); 
  495.  
  496.    ---------------- 
  497.    -- Properties -- 
  498.    ---------------- 
  499.    --  The following properties are defined for this widget. See 
  500.    --  Glib.Properties for more information on properties) 
  501.  
  502.    Allow_Async_Property : constant Glib.Properties.Property_Boolean; 
  503.    --  Determines whether the print operation may run asynchronously or not. 
  504.    -- 
  505.    --  Some systems don't support asynchronous printing, but those that do 
  506.    --  will return Gtk.Print_Operation.Result_In_Progress as the status, and 
  507.    --  emit the Gtk.Print_Operation.Gtk_Print_Operation::done signal when the 
  508.    --  operation is actually done. 
  509.    -- 
  510.    --  The Windows port does not support asynchronous operation at all (this 
  511.    --  is unlikely to change). On other platforms, all actions except for 
  512.    --  Gtk.Print_Operation.Action_Export support asynchronous operation. 
  513.  
  514.    Current_Page_Property : constant Glib.Properties.Property_Int; 
  515.    --  The current page in the document. 
  516.    -- 
  517.    --  If this is set before Gtk.Print_Operation.Run, the user will be able to 
  518.    --  select to print only the current page. 
  519.    -- 
  520.    --  Note that this only makes sense for pre-paginated documents. 
  521.  
  522.    Custom_Tab_Label_Property : constant Glib.Properties.Property_String; 
  523.    --  Used as the label of the tab containing custom widgets. Note that this 
  524.    --  property may be ignored on some platforms. 
  525.    -- 
  526.    --  If this is null, GTK+ uses a default label. 
  527.  
  528.    Default_Page_Setup_Property : constant Glib.Properties.Property_Object; 
  529.    --  Type: Gtk.Page_Setup.Gtk_Page_Setup 
  530.    --  The Gtk.Page_Setup.Gtk_Page_Setup used by default. 
  531.    -- 
  532.    --  This page setup will be used by Gtk.Print_Operation.Run, but it can be 
  533.    --  overridden on a per-page basis by connecting to the 
  534.    --  Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup signal. 
  535.  
  536.    Embed_Page_Setup_Property : constant Glib.Properties.Property_Boolean; 
  537.    --  If True, page size combo box and orientation combo box are embedded 
  538.    --  into page setup page. 
  539.  
  540.    Export_Filename_Property : constant Glib.Properties.Property_String; 
  541.    --  The name of a file to generate instead of showing the print dialog. 
  542.    --  Currently, PDF is the only supported format. 
  543.    -- 
  544.    --  The intended use of this property is for implementing "Export to PDF" 
  545.    --  actions. 
  546.    -- 
  547.    --  "Print to PDF" support is independent of this and is done by letting 
  548.    --  the user pick the "Print to PDF" item from the list of printers in the 
  549.    --  print dialog. 
  550.  
  551.    Has_Selection_Property : constant Glib.Properties.Property_Boolean; 
  552.    --  Determines whether there is a selection in your application. This can 
  553.    --  allow your application to print the selection. This is typically used to 
  554.    --  make a "Selection" button sensitive. 
  555.  
  556.    Job_Name_Property : constant Glib.Properties.Property_String; 
  557.    --  A string used to identify the job (e.g. in monitoring applications like 
  558.    --  eggcups). 
  559.    -- 
  560.    --  If you don't set a job name, GTK+ picks a default one by numbering 
  561.    --  successive print jobs. 
  562.  
  563.    N_Pages_Property : constant Glib.Properties.Property_Int; 
  564.    --  The number of pages in the document. 
  565.    -- 
  566.    --  This *must* be set to a positive number before the rendering starts. It 
  567.    --  may be set in a Gtk.Print_Operation.Gtk_Print_Operation::begin-print 
  568.    --  signal hander. 
  569.    -- 
  570.    --  Note that the page numbers passed to the 
  571.    --  Gtk.Print_Operation.Gtk_Print_Operation::request-page-setup and 
  572.    --  Gtk.Print_Operation.Gtk_Print_Operation::draw-page signals are 0-based, 
  573.    --  i.e. if the user chooses to print all pages, the last ::draw-page signal 
  574.    --  will be for page N_Pages - 1. 
  575.  
  576.    N_Pages_To_Print_Property : constant Glib.Properties.Property_Int; 
  577.    --  The number of pages that will be printed. 
  578.    -- 
  579.    --  Note that this value is set during print preparation phase 
  580.    --  (Gtk.Print_Operation.Status_Preparing), so this value should never be 
  581.    --  get before the data generation phase 
  582.    --  (Gtk.Print_Operation.Status_Generating_Data). You can connect to the 
  583.    --  Gtk.Print_Operation.Gtk_Print_Operation::status-changed signal and call 
  584.    --  Gtk.Print_Operation.Get_N_Pages_To_Print when print status is 
  585.    --  Gtk.Print_Operation.Status_Generating_Data. This is typically used to 
  586.    --  track the progress of print operation. 
  587.  
  588.    Print_Settings_Property : constant Glib.Properties.Property_Object; 
  589.    --  Type: Gtk.Print_Settings.Gtk_Print_Settings 
  590.    --  The Gtk.Print_Settings.Gtk_Print_Settings used for initializing the 
  591.    --  dialog. 
  592.    -- 
  593.    --  Setting this property is typically used to re-establish print settings 
  594.    --  from a previous print operation, see Gtk.Print_Operation.Run. 
  595.  
  596.    Show_Progress_Property : constant Glib.Properties.Property_Boolean; 
  597.    --  Determines whether to show a progress dialog during the print 
  598.    --  operation. 
  599.  
  600.    Status_Property : constant Gtk.Print_Operation.Property_Gtk_Print_Status; 
  601.    --  Type: Gtk_Print_Status 
  602.    --  The status of the print operation. 
  603.  
  604.    Status_String_Property : constant Glib.Properties.Property_String; 
  605.    --  A string representation of the status of the print operation. The 
  606.    --  string is translated and suitable for displaying the print status e.g. 
  607.    --  in a Gtk.Status_Bar.Gtk_Status_Bar. 
  608.    -- 
  609.    --  See the Gtk.Print_Operation.Gtk_Print_Operation:status property for a 
  610.    --  status value that is suitable for programmatic use. 
  611.  
  612.    Support_Selection_Property : constant Glib.Properties.Property_Boolean; 
  613.    --  If True, the print operation will support print of selection. This 
  614.    --  allows the print dialog to show a "Selection" button. 
  615.  
  616.    Track_Print_Status_Property : constant Glib.Properties.Property_Boolean; 
  617.    --  If True, the print operation will try to continue report on the status 
  618.    --  of the print job in the printer queues and printer. This can allow your 
  619.    --  application to show things like "out of paper" issues, and when the 
  620.    --  print job actually reaches the printer. However, this is often 
  621.    --  implemented using polling, and should not be enabled unless needed. 
  622.  
  623.    Unit_Property : constant Gtk.Enums.Property_Gtk_Unit; 
  624.    --  The transformation for the cairo context obtained from 
  625.    --  Gtk.Print_Context.Gtk_Print_Context is set up in such a way that 
  626.    --  distances are measured in units of Unit. 
  627.  
  628.    Use_Full_Page_Property : constant Glib.Properties.Property_Boolean; 
  629.    --  If True, the transformation for the cairo context obtained from 
  630.    --  Gtk.Print_Context.Gtk_Print_Context puts the origin at the top left 
  631.    --  corner of the page (which may not be the top left corner of the sheet, 
  632.    --  depending on page orientation and the number of pages per sheet). 
  633.    --  Otherwise, the origin is at the top left corner of the imageable area 
  634.    --  (i.e. inside the margins). 
  635.  
  636.    ------------- 
  637.    -- Signals -- 
  638.    ------------- 
  639.  
  640.    type Cb_Gtk_Print_Operation_Gtk_Print_Context_Void is not null access procedure 
  641.      (Self    : access Gtk_Print_Operation_Record'Class; 
  642.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class); 
  643.  
  644.    type Cb_GObject_Gtk_Print_Context_Void is not null access procedure 
  645.      (Self    : access Glib.Object.GObject_Record'Class; 
  646.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class); 
  647.  
  648.    Signal_Begin_Print : constant Glib.Signal_Name := "begin-print"; 
  649.    procedure On_Begin_Print 
  650.       (Self  : not null access Gtk_Print_Operation_Record; 
  651.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Void; 
  652.        After : Boolean := False); 
  653.    procedure On_Begin_Print 
  654.       (Self  : not null access Gtk_Print_Operation_Record; 
  655.        Call  : Cb_GObject_Gtk_Print_Context_Void; 
  656.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  657.        After : Boolean := False); 
  658.    --  Emitted after the user has finished changing print settings in the 
  659.    --  dialog, before the actual rendering starts. 
  660.    -- 
  661.    --  A typical use for ::begin-print is to use the parameters from the 
  662.    --  Gtk.Print_Context.Gtk_Print_Context and paginate the document 
  663.    --  accordingly, and then set the number of pages with 
  664.    --  Gtk.Print_Operation.Set_N_Pages. 
  665.  
  666.    type Cb_Gtk_Print_Operation_GObject is not null access function 
  667.      (Self : access Gtk_Print_Operation_Record'Class) 
  668.    return Glib.Object.GObject; 
  669.  
  670.    type Cb_GObject_GObject is not null access function 
  671.      (Self : access Glib.Object.GObject_Record'Class) 
  672.    return Glib.Object.GObject; 
  673.  
  674.    Signal_Create_Custom_Widget : constant Glib.Signal_Name := "create-custom-widget"; 
  675.    procedure On_Create_Custom_Widget 
  676.       (Self  : not null access Gtk_Print_Operation_Record; 
  677.        Call  : Cb_Gtk_Print_Operation_GObject; 
  678.        After : Boolean := False); 
  679.    procedure On_Create_Custom_Widget 
  680.       (Self  : not null access Gtk_Print_Operation_Record; 
  681.        Call  : Cb_GObject_GObject; 
  682.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  683.        After : Boolean := False); 
  684.    --  Emitted when displaying the print dialog. If you return a widget in a 
  685.    --  handler for this signal it will be added to a custom tab in the print 
  686.    --  dialog. You typically return a container widget with multiple widgets in 
  687.    --  it. 
  688.    -- 
  689.    --  The print dialog owns the returned widget, and its lifetime is not 
  690.    --  controlled by the application. However, the widget is guaranteed to stay 
  691.    --  around until the 
  692.    --  Gtk.Print_Operation.Gtk_Print_Operation::custom-widget-apply signal is 
  693.    --  emitted on the operation. Then you can read out any information you need 
  694.    --  from the widgets. 
  695.    --  
  696.    --  Callback parameters: 
  697.    --    --  Returns A custom widget that gets embedded in the print dialog, or null 
  698.  
  699.    type Cb_Gtk_Print_Operation_Gtk_Widget_Void is not null access procedure 
  700.      (Self   : access Gtk_Print_Operation_Record'Class; 
  701.       Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  702.  
  703.    type Cb_GObject_Gtk_Widget_Void is not null access procedure 
  704.      (Self   : access Glib.Object.GObject_Record'Class; 
  705.       Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  706.  
  707.    Signal_Custom_Widget_Apply : constant Glib.Signal_Name := "custom-widget-apply"; 
  708.    procedure On_Custom_Widget_Apply 
  709.       (Self  : not null access Gtk_Print_Operation_Record; 
  710.        Call  : Cb_Gtk_Print_Operation_Gtk_Widget_Void; 
  711.        After : Boolean := False); 
  712.    procedure On_Custom_Widget_Apply 
  713.       (Self  : not null access Gtk_Print_Operation_Record; 
  714.        Call  : Cb_GObject_Gtk_Widget_Void; 
  715.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  716.        After : Boolean := False); 
  717.    --  Emitted right before 
  718.    --  Gtk.Print_Operation.Gtk_Print_Operation::begin-print if you added a 
  719.    --  custom widget in the 
  720.    --  Gtk.Print_Operation.Gtk_Print_Operation::create-custom-widget handler. 
  721.    --  When you get this signal you should read the information from the custom 
  722.    --  widgets, as the widgets are not guaraneed to be around at a later time. 
  723.  
  724.    type Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void is not null access procedure 
  725.      (Self   : access Gtk_Print_Operation_Record'Class; 
  726.       Result : Gtk_Print_Operation_Result); 
  727.  
  728.    type Cb_GObject_Gtk_Print_Operation_Result_Void is not null access procedure 
  729.      (Self   : access Glib.Object.GObject_Record'Class; 
  730.       Result : Gtk_Print_Operation_Result); 
  731.  
  732.    Signal_Done : constant Glib.Signal_Name := "done"; 
  733.    procedure On_Done 
  734.       (Self  : not null access Gtk_Print_Operation_Record; 
  735.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Operation_Result_Void; 
  736.        After : Boolean := False); 
  737.    procedure On_Done 
  738.       (Self  : not null access Gtk_Print_Operation_Record; 
  739.        Call  : Cb_GObject_Gtk_Print_Operation_Result_Void; 
  740.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  741.        After : Boolean := False); 
  742.    --  Emitted when the print operation run has finished doing everything 
  743.    --  required for printing. 
  744.    -- 
  745.    --  Result gives you information about what happened during the run. If 
  746.    --  Result is Gtk.Print_Operation.Result_Error then you can call 
  747.    --  Gtk.Print_Operation.Get_Error for more information. 
  748.    -- 
  749.    --  If you enabled print status tracking then 
  750.    --  Gtk.Print_Operation.Is_Finished may still return False after 
  751.    --  Gtk.Print_Operation.Gtk_Print_Operation::done was emitted. 
  752.  
  753.    type Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void is not null access procedure 
  754.      (Self    : access Gtk_Print_Operation_Record'Class; 
  755.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  756.       Page_Nr : Gint); 
  757.  
  758.    type Cb_GObject_Gtk_Print_Context_Gint_Void is not null access procedure 
  759.      (Self    : access Glib.Object.GObject_Record'Class; 
  760.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  761.       Page_Nr : Gint); 
  762.  
  763.    Signal_Draw_Page : constant Glib.Signal_Name := "draw-page"; 
  764.    procedure On_Draw_Page 
  765.       (Self  : not null access Gtk_Print_Operation_Record; 
  766.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Void; 
  767.        After : Boolean := False); 
  768.    procedure On_Draw_Page 
  769.       (Self  : not null access Gtk_Print_Operation_Record; 
  770.        Call  : Cb_GObject_Gtk_Print_Context_Gint_Void; 
  771.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  772.        After : Boolean := False); 
  773.    --  Emitted for every page that is printed. The signal handler must render 
  774.    --  the Page_Nr's page onto the cairo context obtained from Context using 
  775.    --  Gtk.Print_Context.Get_Cairo_Context. |[ static void draw_page 
  776.    --  (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, 
  777.    --  gpointer user_data) { cairo_t *cr; PangoLayout *layout; gdouble width, 
  778.    --  text_height; gint layout_height; PangoFontDescription *desc; cr = 
  779.    --  gtk_print_context_get_cairo_context (context); width = 
  780.    --  gtk_print_context_get_width (context); cairo_rectangle (cr, 0, 0, width, 
  781.    --  HEADER_HEIGHT); cairo_set_source_rgb (cr, 0.8, 0.8, 0.8); cairo_fill 
  782.    --  (cr); layout = gtk_print_context_create_pango_layout (context); desc = 
  783.    --  pango_font_description_from_string ("sans 14"); 
  784.    --  pango_layout_set_font_description (layout, desc); 
  785.    --  pango_font_description_free (desc); pango_layout_set_text (layout, "some 
  786.    --  text", -1); pango_layout_set_width (layout, width * PANGO_SCALE); 
  787.    --  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); 
  788.    --  pango_layout_get_size (layout, NULL, &layout_height); text_height = 
  789.    --  (gdouble)layout_height / PANGO_SCALE; cairo_move_to (cr, width / 2, 
  790.    --  (HEADER_HEIGHT - text_height) / 2); pango_cairo_show_layout (cr, 
  791.    --  layout); g_object_unref (layout); } ]| 
  792.    -- 
  793.    --  Use Gtk.Print_Operation.Set_Use_Full_Page and 
  794.    --  Gtk.Print_Operation.Set_Unit before starting the print operation to set 
  795.    --  up the transformation of the cairo context according to your needs. 
  796.    --  
  797.    --  Callback parameters: 
  798.    --    --  "context": the Gtk.Print_Context.Gtk_Print_Context for the current 
  799.    --    --  operation 
  800.    --    --  "page_nr": the number of the currently printed page (0-based) 
  801.  
  802.    Signal_End_Print : constant Glib.Signal_Name := "end-print"; 
  803.    procedure On_End_Print 
  804.       (Self  : not null access Gtk_Print_Operation_Record; 
  805.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Void; 
  806.        After : Boolean := False); 
  807.    procedure On_End_Print 
  808.       (Self  : not null access Gtk_Print_Operation_Record; 
  809.        Call  : Cb_GObject_Gtk_Print_Context_Void; 
  810.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  811.        After : Boolean := False); 
  812.    --  Emitted after all pages have been rendered. A handler for this signal 
  813.    --  can clean up any resources that have been allocated in the 
  814.    --  Gtk.Print_Operation.Gtk_Print_Operation::begin-print handler. 
  815.  
  816.    type Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean is not null access function 
  817.      (Self    : access Gtk_Print_Operation_Record'Class; 
  818.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class) 
  819.    return Boolean; 
  820.  
  821.    type Cb_GObject_Gtk_Print_Context_Boolean is not null access function 
  822.      (Self    : access Glib.Object.GObject_Record'Class; 
  823.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class) 
  824.    return Boolean; 
  825.  
  826.    Signal_Paginate : constant Glib.Signal_Name := "paginate"; 
  827.    procedure On_Paginate 
  828.       (Self  : not null access Gtk_Print_Operation_Record; 
  829.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Boolean; 
  830.        After : Boolean := False); 
  831.    procedure On_Paginate 
  832.       (Self  : not null access Gtk_Print_Operation_Record; 
  833.        Call  : Cb_GObject_Gtk_Print_Context_Boolean; 
  834.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  835.        After : Boolean := False); 
  836.    --  Emitted after the Gtk.Print_Operation.Gtk_Print_Operation::begin-print 
  837.    --  signal, but before the actual rendering starts. It keeps getting emitted 
  838.    --  until a connected signal handler returns True. 
  839.    -- 
  840.    --  The ::paginate signal is intended to be used for paginating a document 
  841.    --  in small chunks, to avoid blocking the user interface for a long time. 
  842.    --  The signal handler should update the number of pages using 
  843.    --  Gtk.Print_Operation.Set_N_Pages, and return True if the document has 
  844.    --  been completely paginated. 
  845.    -- 
  846.    --  If you don't need to do pagination in chunks, you can simply do it all 
  847.    --  in the ::begin-print handler, and set the number of pages from there. 
  848.    --  
  849.    --  Callback parameters: 
  850.    --    --  "context": the Gtk.Print_Context.Gtk_Print_Context for the current 
  851.    --    --  operation 
  852.    --    --  Returns True if pagination is complete 
  853.  
  854.    type Cb_Gtk_Print_Operation_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean is not null access function 
  855.      (Self    : access Gtk_Print_Operation_Record'Class; 
  856.       Preview : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview; 
  857.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  858.       Parent  : access Gtk.Window.Gtk_Window_Record'Class) 
  859.    return Boolean; 
  860.  
  861.    type Cb_GObject_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean is not null access function 
  862.      (Self    : access Glib.Object.GObject_Record'Class; 
  863.       Preview : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview; 
  864.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  865.       Parent  : access Gtk.Window.Gtk_Window_Record'Class) 
  866.    return Boolean; 
  867.  
  868.    Signal_Preview : constant Glib.Signal_Name := "preview"; 
  869.    procedure On_Preview 
  870.       (Self  : not null access Gtk_Print_Operation_Record; 
  871.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean; 
  872.        After : Boolean := False); 
  873.    procedure On_Preview 
  874.       (Self  : not null access Gtk_Print_Operation_Record; 
  875.        Call  : Cb_GObject_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Window_Boolean; 
  876.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  877.        After : Boolean := False); 
  878.    --  Gets emitted when a preview is requested from the native dialog. 
  879.    -- 
  880.    --  The default handler for this signal uses an external viewer application 
  881.    --  to preview. 
  882.    -- 
  883.    --  To implement a custom print preview, an application must return True 
  884.    --  from its handler for this signal. In order to use the provided Context 
  885.    --  for the preview implementation, it must be given a suitable cairo 
  886.    --  context with Gtk.Print_Context.Set_Cairo_Context. 
  887.    -- 
  888.    --  The custom preview implementation can use 
  889.    --  Gtk.Print_Operation_Preview.Is_Selected and 
  890.    --  Gtk.Print_Operation_Preview.Render_Page to find pages which are selected 
  891.    --  for print and render them. The preview must be finished by calling 
  892.    --  Gtk.Print_Operation_Preview.End_Preview (typically in response to the 
  893.    --  user clicking a close button). 
  894.    --  
  895.    --  Callback parameters: 
  896.    --    --  "preview": the Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview 
  897.    --    --  for the current operation 
  898.    --    --  "context": the Gtk.Print_Context.Gtk_Print_Context that will be used 
  899.    --    --  "parent": the Gtk.Window.Gtk_Window to use as window parent, or null 
  900.    --    --  Returns True if the listener wants to take over control of the preview 
  901.  
  902.    type Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void is not null access procedure 
  903.      (Self    : access Gtk_Print_Operation_Record'Class; 
  904.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  905.       Page_Nr : Gint; 
  906.       Setup   : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class); 
  907.  
  908.    type Cb_GObject_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void is not null access procedure 
  909.      (Self    : access Glib.Object.GObject_Record'Class; 
  910.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  911.       Page_Nr : Gint; 
  912.       Setup   : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class); 
  913.  
  914.    Signal_Request_Page_Setup : constant Glib.Signal_Name := "request-page-setup"; 
  915.    procedure On_Request_Page_Setup 
  916.       (Self  : not null access Gtk_Print_Operation_Record; 
  917.        Call  : Cb_Gtk_Print_Operation_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void; 
  918.        After : Boolean := False); 
  919.    procedure On_Request_Page_Setup 
  920.       (Self  : not null access Gtk_Print_Operation_Record; 
  921.        Call  : Cb_GObject_Gtk_Print_Context_Gint_Gtk_Page_Setup_Void; 
  922.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  923.        After : Boolean := False); 
  924.    --  Emitted once for every page that is printed, to give the application a 
  925.    --  chance to modify the page setup. Any changes done to Setup will be in 
  926.    --  force only for printing this page. 
  927.    --  
  928.    --  Callback parameters: 
  929.    --    --  "context": the Gtk.Print_Context.Gtk_Print_Context for the current 
  930.    --    --  operation 
  931.    --    --  "page_nr": the number of the currently printed page (0-based) 
  932.    --    --  "setup": the Gtk.Page_Setup.Gtk_Page_Setup 
  933.  
  934.    type Cb_Gtk_Print_Operation_Void is not null access procedure 
  935.      (Self : access Gtk_Print_Operation_Record'Class); 
  936.  
  937.    type Cb_GObject_Void is not null access procedure 
  938.      (Self : access Glib.Object.GObject_Record'Class); 
  939.  
  940.    Signal_Status_Changed : constant Glib.Signal_Name := "status-changed"; 
  941.    procedure On_Status_Changed 
  942.       (Self  : not null access Gtk_Print_Operation_Record; 
  943.        Call  : Cb_Gtk_Print_Operation_Void; 
  944.        After : Boolean := False); 
  945.    procedure On_Status_Changed 
  946.       (Self  : not null access Gtk_Print_Operation_Record; 
  947.        Call  : Cb_GObject_Void; 
  948.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  949.        After : Boolean := False); 
  950.    --  Emitted at between the various phases of the print operation. See 
  951.    --  Gtk.Print_Operation.Gtk_Print_Status for the phases that are being 
  952.    --  discriminated. Use Gtk.Print_Operation.Get_Status to find out the 
  953.    --  current status. 
  954.  
  955.    type Cb_Gtk_Print_Operation_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void is not null access procedure 
  956.      (Self     : access Gtk_Print_Operation_Record'Class; 
  957.       Widget   : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  958.       Setup    : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class; 
  959.       Settings : not null access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class); 
  960.  
  961.    type Cb_GObject_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void is not null access procedure 
  962.      (Self     : access Glib.Object.GObject_Record'Class; 
  963.       Widget   : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  964.       Setup    : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class; 
  965.       Settings : not null access Gtk.Print_Settings.Gtk_Print_Settings_Record'Class); 
  966.  
  967.    Signal_Update_Custom_Widget : constant Glib.Signal_Name := "update-custom-widget"; 
  968.    procedure On_Update_Custom_Widget 
  969.       (Self  : not null access Gtk_Print_Operation_Record; 
  970.        Call  : Cb_Gtk_Print_Operation_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void; 
  971.        After : Boolean := False); 
  972.    procedure On_Update_Custom_Widget 
  973.       (Self  : not null access Gtk_Print_Operation_Record; 
  974.        Call  : Cb_GObject_Gtk_Widget_Gtk_Page_Setup_Gtk_Print_Settings_Void; 
  975.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  976.        After : Boolean := False); 
  977.    --  Emitted after change of selected printer. The actual page setup and 
  978.    --  print settings are passed to the custom widget, which can actualize 
  979.    --  itself according to this change. 
  980.    --  
  981.    --  Callback parameters: 
  982.    --    --  "widget": the custom widget added in create-custom-widget 
  983.    --    --  "setup": actual page setup 
  984.    --    --  "settings": actual print settings 
  985.  
  986.    ---------------- 
  987.    -- Interfaces -- 
  988.    ---------------- 
  989.    --  This class implements several interfaces. See Glib.Types 
  990.    -- 
  991.    --  - "PrintOperationPreview" 
  992.  
  993.    package Implements_Gtk_Print_Operation_Preview is new Glib.Types.Implements 
  994.      (Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview, Gtk_Print_Operation_Record, Gtk_Print_Operation); 
  995.    function "+" 
  996.      (Widget : access Gtk_Print_Operation_Record'Class) 
  997.    return Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview 
  998.    renames Implements_Gtk_Print_Operation_Preview.To_Interface; 
  999.    function "-" 
  1000.      (Interf : Gtk.Print_Operation_Preview.Gtk_Print_Operation_Preview) 
  1001.    return Gtk_Print_Operation 
  1002.    renames Implements_Gtk_Print_Operation_Preview.To_Object; 
  1003.  
  1004. private 
  1005.    Use_Full_Page_Property : constant Glib.Properties.Property_Boolean := 
  1006.      Glib.Properties.Build ("use-full-page"); 
  1007.    Unit_Property : constant Gtk.Enums.Property_Gtk_Unit := 
  1008.      Gtk.Enums.Build ("unit"); 
  1009.    Track_Print_Status_Property : constant Glib.Properties.Property_Boolean := 
  1010.      Glib.Properties.Build ("track-print-status"); 
  1011.    Support_Selection_Property : constant Glib.Properties.Property_Boolean := 
  1012.      Glib.Properties.Build ("support-selection"); 
  1013.    Status_String_Property : constant Glib.Properties.Property_String := 
  1014.      Glib.Properties.Build ("status-string"); 
  1015.    Status_Property : constant Gtk.Print_Operation.Property_Gtk_Print_Status := 
  1016.      Gtk.Print_Operation.Build ("status"); 
  1017.    Show_Progress_Property : constant Glib.Properties.Property_Boolean := 
  1018.      Glib.Properties.Build ("show-progress"); 
  1019.    Print_Settings_Property : constant Glib.Properties.Property_Object := 
  1020.      Glib.Properties.Build ("print-settings"); 
  1021.    N_Pages_To_Print_Property : constant Glib.Properties.Property_Int := 
  1022.      Glib.Properties.Build ("n-pages-to-print"); 
  1023.    N_Pages_Property : constant Glib.Properties.Property_Int := 
  1024.      Glib.Properties.Build ("n-pages"); 
  1025.    Job_Name_Property : constant Glib.Properties.Property_String := 
  1026.      Glib.Properties.Build ("job-name"); 
  1027.    Has_Selection_Property : constant Glib.Properties.Property_Boolean := 
  1028.      Glib.Properties.Build ("has-selection"); 
  1029.    Export_Filename_Property : constant Glib.Properties.Property_String := 
  1030.      Glib.Properties.Build ("export-filename"); 
  1031.    Embed_Page_Setup_Property : constant Glib.Properties.Property_Boolean := 
  1032.      Glib.Properties.Build ("embed-page-setup"); 
  1033.    Default_Page_Setup_Property : constant Glib.Properties.Property_Object := 
  1034.      Glib.Properties.Build ("default-page-setup"); 
  1035.    Custom_Tab_Label_Property : constant Glib.Properties.Property_String := 
  1036.      Glib.Properties.Build ("custom-tab-label"); 
  1037.    Current_Page_Property : constant Glib.Properties.Property_Int := 
  1038.      Glib.Properties.Build ("current-page"); 
  1039.    Allow_Async_Property : constant Glib.Properties.Property_Boolean := 
  1040.      Glib.Properties.Build ("allow-async"); 
  1041. end Gtk.Print_Operation;