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. pragma Ada_2005; 
  25.  
  26. pragma Warnings (Off, "*is already use-visible*"); 
  27. with Glib;              use Glib; 
  28. with Glib.Object;       use Glib.Object; 
  29. with Glib.Types;        use Glib.Types; 
  30. with Gtk.Page_Setup;    use Gtk.Page_Setup; 
  31. with Gtk.Print_Context; use Gtk.Print_Context; 
  32.  
  33. package Gtk.Print_Operation_Preview is 
  34.  
  35.    type Gtk_Print_Operation_Preview is new Glib.Types.GType_Interface; 
  36.    Null_Gtk_Print_Operation_Preview : constant Gtk_Print_Operation_Preview; 
  37.  
  38.    ------------------ 
  39.    -- Constructors -- 
  40.    ------------------ 
  41.  
  42.    function Get_Type return Glib.GType; 
  43.    pragma Import (C, Get_Type, "gtk_print_operation_preview_get_type"); 
  44.  
  45.    ------------- 
  46.    -- Methods -- 
  47.    ------------- 
  48.  
  49.    procedure End_Preview (Preview : Gtk_Print_Operation_Preview); 
  50.    pragma Import (C, End_Preview, "gtk_print_operation_preview_end_preview"); 
  51.    --  Ends a preview. 
  52.    --  This function must be called to finish a custom print preview. 
  53.    --  Since: gtk+ 2.10 
  54.  
  55.    function Is_Selected 
  56.       (Preview : Gtk_Print_Operation_Preview; 
  57.        Page_Nr : Gint) return Boolean; 
  58.    --  Returns whether the given page is included in the set of pages that 
  59.    --  have been selected for printing. 
  60.    --  Since: gtk+ 2.10 
  61.    --  "page_nr": a page number 
  62.  
  63.    procedure Render_Page 
  64.       (Preview : Gtk_Print_Operation_Preview; 
  65.        Page_Nr : Gint); 
  66.    pragma Import (C, Render_Page, "gtk_print_operation_preview_render_page"); 
  67.    --  Renders a page to the preview, using the print context that was passed 
  68.    --  to the Gtk.Print_Operation.Gtk_Print_Operation::preview handler together 
  69.    --  with Preview. 
  70.    --  A custom iprint preview should use this function in its ::expose 
  71.    --  handler to render the currently selected page. 
  72.    --  Note that this function requires a suitable cairo context to be 
  73.    --  associated with the print context. 
  74.    --  Since: gtk+ 2.10 
  75.    --  "page_nr": the page to render 
  76.  
  77.    ------------- 
  78.    -- Signals -- 
  79.    ------------- 
  80.  
  81.    type Cb_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Page_Setup_Void is not null access procedure 
  82.      (Self       : Gtk_Print_Operation_Preview; 
  83.       Context    : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  84.       Page_Setup : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class); 
  85.  
  86.    type Cb_GObject_Gtk_Print_Context_Gtk_Page_Setup_Void is not null access procedure 
  87.      (Self       : access Glib.Object.GObject_Record'Class; 
  88.       Context    : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class; 
  89.       Page_Setup : not null access Gtk.Page_Setup.Gtk_Page_Setup_Record'Class); 
  90.  
  91.    Signal_Got_Page_Size : constant Glib.Signal_Name := "got-page-size"; 
  92.    procedure On_Got_Page_Size 
  93.       (Self  : Gtk_Print_Operation_Preview; 
  94.        Call  : Cb_Gtk_Print_Operation_Preview_Gtk_Print_Context_Gtk_Page_Setup_Void; 
  95.        After : Boolean := False); 
  96.    procedure On_Got_Page_Size 
  97.       (Self  : Gtk_Print_Operation_Preview; 
  98.        Call  : Cb_GObject_Gtk_Print_Context_Gtk_Page_Setup_Void; 
  99.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  100.        After : Boolean := False); 
  101.    --  The ::got-page-size signal is emitted once for each page that gets 
  102.    --  rendered to the preview. 
  103.    -- 
  104.    --  A handler for this signal should update the Context according to 
  105.    --  Page_Setup and set up a suitable cairo context, using 
  106.    --  Gtk.Print_Context.Set_Cairo_Context. 
  107.    --  
  108.    --  Callback parameters: 
  109.    --    --  "context": the current Gtk.Print_Context.Gtk_Print_Context 
  110.    --    --  "page_setup": the Gtk.Page_Setup.Gtk_Page_Setup for the current page 
  111.  
  112.    type Cb_Gtk_Print_Operation_Preview_Gtk_Print_Context_Void is not null access procedure 
  113.      (Self    : Gtk_Print_Operation_Preview; 
  114.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class); 
  115.  
  116.    type Cb_GObject_Gtk_Print_Context_Void is not null access procedure 
  117.      (Self    : access Glib.Object.GObject_Record'Class; 
  118.       Context : not null access Gtk.Print_Context.Gtk_Print_Context_Record'Class); 
  119.  
  120.    Signal_Ready : constant Glib.Signal_Name := "ready"; 
  121.    procedure On_Ready 
  122.       (Self  : Gtk_Print_Operation_Preview; 
  123.        Call  : Cb_Gtk_Print_Operation_Preview_Gtk_Print_Context_Void; 
  124.        After : Boolean := False); 
  125.    procedure On_Ready 
  126.       (Self  : Gtk_Print_Operation_Preview; 
  127.        Call  : Cb_GObject_Gtk_Print_Context_Void; 
  128.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  129.        After : Boolean := False); 
  130.    --  The ::ready signal gets emitted once per preview operation, before the 
  131.    --  first page is rendered. 
  132.    -- 
  133.    --  A handler for this signal can be used for setup tasks. 
  134.  
  135.    ---------------- 
  136.    -- Interfaces -- 
  137.    ---------------- 
  138.    --  This class implements several interfaces. See Glib.Types 
  139.    -- 
  140.    --  - "Gtk_Print_Operation_Preview" 
  141.  
  142.    function "+" (W : Gtk_Print_Operation_Preview) return Gtk_Print_Operation_Preview; 
  143.    pragma Inline ("+"); 
  144.  
  145. private 
  146.  
  147. Null_Gtk_Print_Operation_Preview : constant Gtk_Print_Operation_Preview := 
  148.    Gtk_Print_Operation_Preview (Glib.Types.Null_Interface); 
  149. end Gtk.Print_Operation_Preview;