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