1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                    Copyright (C) 2010-2013, AdaCore               -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  A Gtk_Page_Setup object stores the page size, orientation and margins. The 
  31. --  idea is that you can get one of these from the page setup dialog and then 
  32. --  pass it to the Gtk_Print_Operation when printing. The benefit of splitting 
  33. --  this out of the Gtk_Print_Settings is that these affect the actual layout 
  34. --  of the page, and thus need to be set long before user prints. 
  35. -- 
  36. --  The margins specified in this object are the "print margins", i.e. the 
  37. --  parts of the page that the printer cannot print on. These are different 
  38. --  from the layout margins that a word processor uses; they are typically 
  39. --  used to determine the minimal size for the layout margins. 
  40. -- 
  41. --  To obtain a Gtk_Page_Setup use Gtk_New to get the defaults, or use 
  42. --  Gtk_Print_Run_Page_Setup_Dialog to show the page setup dialog and receive 
  43. --  the resulting page setup. 
  44. --  </description> 
  45. --  <c_version>2.16.6</c_version> 
  46.  
  47. with Glib.Error; 
  48. with Glib.Key_File; 
  49. with Glib.Object; 
  50. with Gtk.Enums; 
  51. with Gtk.Paper_Size; 
  52.  
  53. package Gtk.Page_Setup is 
  54.  
  55.    type Gtk_Page_Setup_Record is new Glib.Object.GObject_Record with private; 
  56.    type Gtk_Page_Setup is access all Gtk_Page_Setup_Record'Class; 
  57.  
  58.    function Get_Type return GType; 
  59.  
  60.    procedure Gtk_New (Widget : out Gtk_Page_Setup); 
  61.    procedure Initialize (Widget : access Gtk_Page_Setup_Record'Class); 
  62.    --  Creates a new Gtk_Page_Setup. 
  63.  
  64.    procedure Gtk_New_From_File 
  65.      (Widget    : out Gtk_Page_Setup; 
  66.       File_Name : String; 
  67.       Error     : Glib.Error.GError := null); 
  68.    procedure Initialize_From_File 
  69.      (Widget    : access Gtk_Page_Setup_Record'Class; 
  70.       File_Name : String; 
  71.       Error     : Glib.Error.GError := null); 
  72.    --  Reads the page setup from the file File_Name. Returns a 
  73.    --  new Gtk_Page_Setup object with the restored page setup, 
  74.    --  or null if an error occurred. See To_File. 
  75.  
  76.    procedure Gtk_New_From_Key_File 
  77.      (Widget     : out Gtk_Page_Setup; 
  78.       Key_File   : Glib.Key_File.G_Key_File; 
  79.       Group_Name : String := ""; 
  80.       Error      : Glib.Error.GError := null); 
  81.    procedure Initialize_From_Key_File 
  82.      (Widget     : access Gtk_Page_Setup_Record'Class; 
  83.       Key_File   : Glib.Key_File.G_Key_File; 
  84.       Group_Name : String := ""; 
  85.       Error      : Glib.Error.GError := null); 
  86.    --  Reads the page setup from the group @group_name in the key file 
  87.    --  Key_File. Returns a new Gtk_Page_Setup object with the restored 
  88.    --  page setup, or null if an error occurred. 
  89.    -- 
  90.    --  Return value: the restored Gtk_Page_Setup 
  91.  
  92.    ------------------------------ 
  93.    -- Loading, Saving, Copying -- 
  94.    ------------------------------ 
  95.  
  96.    function Load_File 
  97.      (Setup     : access Gtk_Page_Setup_Record; 
  98.       File_Name : String; 
  99.       Error     : Glib.Error.GError := null) 
  100.       return Boolean; 
  101.    --  Reads the page setup from the file File_name. 
  102.    --  See To_File.  Returns True on success. 
  103.  
  104.    function Load_Key_File 
  105.      (Setup      : access Gtk_Page_Setup_Record; 
  106.       Key_File   : Glib.Key_File.G_Key_File; 
  107.       Group_Name : String := ""; 
  108.       Error      : Glib.Error.GError := null) 
  109.       return Boolean; 
  110.    --  Reads the page setup from the group Group_Name (by default, 
  111.    --  "Page Setup") in the key file Key_File.  Returns True on success. 
  112.  
  113.    function To_File 
  114.      (Setup     : access Gtk_Page_Setup_Record; 
  115.       File_Name : String; 
  116.       Error     : Glib.Error.GError := null) 
  117.       return Boolean; 
  118.    --  This function saves the information from Setup to File_Name. 
  119.    --  Returns True on success. 
  120.  
  121.    procedure To_Key_File 
  122.      (Setup      : access Gtk_Page_Setup_Record; 
  123.       Key_File   : Glib.Key_File.G_Key_File; 
  124.       Group_Name : String := ""); 
  125.    --  This function adds the page setup from Setup to Key_File. 
  126.  
  127.    function Copy (Other : access Gtk_Page_Setup_Record) return Gtk_Page_Setup; 
  128.    --  Copies a Gtk_Page_Setup. 
  129.  
  130.    ------------- 
  131.    -- Margins -- 
  132.    ------------- 
  133.  
  134.    function Get_Bottom_Margin 
  135.      (Setup : access Gtk_Page_Setup_Record; 
  136.       Unit  : Gtk.Enums.Gtk_Unit) 
  137.       return Gdouble; 
  138.    function Get_Left_Margin 
  139.      (Setup : access Gtk_Page_Setup_Record; 
  140.       Unit  : Gtk.Enums.Gtk_Unit) 
  141.       return Gdouble; 
  142.    function Get_Right_Margin 
  143.      (Setup : access Gtk_Page_Setup_Record; 
  144.       Unit  : Gtk.Enums.Gtk_Unit) 
  145.       return Gdouble; 
  146.    function Get_Top_Margin 
  147.      (Setup : access Gtk_Page_Setup_Record; 
  148.       Unit  : Gtk.Enums.Gtk_Unit) 
  149.       return Gdouble; 
  150.    --  Gets the specified margin in units of Unit. 
  151.  
  152.    procedure Set_Bottom_Margin 
  153.      (Setup  : access Gtk_Page_Setup_Record; 
  154.       Margin : Gdouble; 
  155.       Unit   : Gtk.Enums.Gtk_Unit); 
  156.    procedure Set_Left_Margin 
  157.      (Setup  : access Gtk_Page_Setup_Record; 
  158.       Margin : Gdouble; 
  159.       Unit   : Gtk.Enums.Gtk_Unit); 
  160.    procedure Set_Right_Margin 
  161.      (Setup  : access Gtk_Page_Setup_Record; 
  162.       Margin : Gdouble; 
  163.       Unit   : Gtk.Enums.Gtk_Unit); 
  164.    procedure Set_Top_Margin 
  165.      (Setup  : access Gtk_Page_Setup_Record; 
  166.       Margin : Gdouble; 
  167.       Unit   : Gtk.Enums.Gtk_Unit); 
  168.    --  Sets the margins of the Gtk_Page_Setup. 
  169.  
  170.    --------------- 
  171.    -- Page Size -- 
  172.    --------------- 
  173.  
  174.    function Get_Page_Height 
  175.      (Setup : access Gtk_Page_Setup_Record; 
  176.       Unit  : Gtk.Enums.Gtk_Unit) 
  177.       return Gdouble; 
  178.    function Get_Page_Width 
  179.      (Setup : access Gtk_Page_Setup_Record; 
  180.       Unit  : Gtk.Enums.Gtk_Unit) 
  181.       return Gdouble; 
  182.    --  Returns the page height/width in units of Unit. 
  183.    -- 
  184.    --  Note that this function takes orientation and 
  185.    --  margins into consideration.  See Get_Paper_Height. 
  186.  
  187.    ------------------------------ 
  188.    -- Paper Size / Orientation -- 
  189.    ------------------------------ 
  190.  
  191.    function Get_Paper_Size 
  192.      (Setup : access Gtk_Page_Setup_Record) 
  193.       return Gtk.Paper_Size.Gtk_Paper_Size; 
  194.    procedure Set_Paper_Size 
  195.      (Setup : access Gtk_Page_Setup_Record; 
  196.       Size  : Gtk.Paper_Size.Gtk_Paper_Size); 
  197.    --  Gets/Sets the paper size of the Gtk_Page_Setup without 
  198.    --  changing the margins. See Set_Paper_Size_And_Default_Margins. 
  199.  
  200.    procedure Set_Paper_Size_And_Default_Margins 
  201.      (Setup : access Gtk_Page_Setup_Record; 
  202.       Size  : Gtk.Paper_Size.Gtk_Paper_Size); 
  203.    --  Sets the paper size of the Gtk_Page_Setup and modifies 
  204.    --  the margins according to the new paper size. 
  205.  
  206.    function Get_Paper_Height 
  207.      (Setup : access Gtk_Page_Setup_Record; 
  208.       Unit  : Gtk.Enums.Gtk_Unit) 
  209.       return Gdouble; 
  210.    function Get_Paper_Width 
  211.      (Setup : access Gtk_Page_Setup_Record; 
  212.       Unit  : Gtk.Enums.Gtk_Unit) 
  213.       return Gdouble; 
  214.    --  Returns the paper height in units of Unit. 
  215.    -- 
  216.    --  Note that this function takes orientation, but 
  217.    --  not margins into consideration.  See Get_Page_Height. 
  218.  
  219.    function Get_Orientation 
  220.      (Setup : access Gtk_Page_Setup_Record) 
  221.       return Gtk.Enums.Gtk_Page_Orientation; 
  222.    procedure Set_Orientation 
  223.      (Setup       : access Gtk_Page_Setup_Record; 
  224.       Orientation : Gtk.Enums.Gtk_Page_Orientation); 
  225.    --  The page orientation of the Gtk_Page_Setup. 
  226.  
  227. private 
  228.  
  229.    type Gtk_Page_Setup_Record is 
  230.       new Glib.Object.GObject_Record with null record; 
  231.  
  232.    pragma Import (C, Get_Type, "gtk_page_setup_get_type"); 
  233.  
  234. end Gtk.Page_Setup;