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. --  The Gtk.Alignment.Gtk_Alignment widget controls the alignment and size of 
  26. --  its child widget. It has four settings: xscale, yscale, xalign, and yalign. 
  27. -- 
  28. --  The scale settings are used to specify how much the child widget should 
  29. --  expand to fill the space allocated to the Gtk.Alignment.Gtk_Alignment. The 
  30. --  values can range from 0 (meaning the child doesn't expand at all) to 1 
  31. --  (meaning the child expands to fill all of the available space). 
  32. -- 
  33. --  The align settings are used to place the child widget within the available 
  34. --  area. The values range from 0 (top or left) to 1 (bottom or right). Of 
  35. --  course, if the scale settings are both set to 1, the alignment settings 
  36. --  have no effect. 
  37. -- 
  38. --  Note: 
  39. -- 
  40. --  Note that the desired effect can in most cases be achieved by using the 
  41. --  Gtk.Widget.Gtk_Widget:halign, Gtk.Widget.Gtk_Widget:valign and 
  42. --  Gtk.Widget.Gtk_Widget:margin properties on the child widget, so 
  43. --  Gtk.Alignment.Gtk_Alignment should not be used in new code. 
  44. -- 
  45. -- 
  46. --  </description> 
  47. --  <screenshot>gtk-alignment</screenshot> 
  48. --  <testgtk>create_alignment.adb</testgtk> 
  49. pragma Ada_2005; 
  50.  
  51. pragma Warnings (Off, "*is already use-visible*"); 
  52. with Glib;            use Glib; 
  53. with Glib.Properties; use Glib.Properties; 
  54. with Glib.Types;      use Glib.Types; 
  55. with Gtk.Bin;         use Gtk.Bin; 
  56. with Gtk.Buildable;   use Gtk.Buildable; 
  57.  
  58. package Gtk.Alignment is 
  59.  
  60.    type Gtk_Alignment_Record is new Gtk_Bin_Record with null record; 
  61.    type Gtk_Alignment is access all Gtk_Alignment_Record'Class; 
  62.  
  63.    ------------------ 
  64.    -- Constructors -- 
  65.    ------------------ 
  66.  
  67.    procedure Gtk_New 
  68.       (Alignment : out Gtk_Alignment; 
  69.        Xalign    : Gfloat; 
  70.        Yalign    : Gfloat; 
  71.        Xscale    : Gfloat; 
  72.        Yscale    : Gfloat); 
  73.    procedure Initialize 
  74.       (Alignment : not null access Gtk_Alignment_Record'Class; 
  75.        Xalign    : Gfloat; 
  76.        Yalign    : Gfloat; 
  77.        Xscale    : Gfloat; 
  78.        Yscale    : Gfloat); 
  79.    --  Creates a new Gtk.Alignment.Gtk_Alignment. 
  80.    --  "xalign": the horizontal alignment of the child widget, from 0 (left) 
  81.    --  to 1 (right). 
  82.    --  "yalign": the vertical alignment of the child widget, from 0 (top) to 1 
  83.    --  (bottom). 
  84.    --  "xscale": the amount that the child widget expands horizontally to fill 
  85.    --  up unused space, from 0 to 1. A value of 0 indicates that the child 
  86.    --  widget should never expand. A value of 1 indicates that the child widget 
  87.    --  will expand to fill all of the space allocated for the 
  88.    --  Gtk.Alignment.Gtk_Alignment. 
  89.    --  "yscale": the amount that the child widget expands vertically to fill 
  90.    --  up unused space, from 0 to 1. The values are similar to Xscale. 
  91.  
  92.    function Gtk_Alignment_New 
  93.       (Xalign : Gfloat; 
  94.        Yalign : Gfloat; 
  95.        Xscale : Gfloat; 
  96.        Yscale : Gfloat) return Gtk_Alignment; 
  97.    --  Creates a new Gtk.Alignment.Gtk_Alignment. 
  98.    --  "xalign": the horizontal alignment of the child widget, from 0 (left) 
  99.    --  to 1 (right). 
  100.    --  "yalign": the vertical alignment of the child widget, from 0 (top) to 1 
  101.    --  (bottom). 
  102.    --  "xscale": the amount that the child widget expands horizontally to fill 
  103.    --  up unused space, from 0 to 1. A value of 0 indicates that the child 
  104.    --  widget should never expand. A value of 1 indicates that the child widget 
  105.    --  will expand to fill all of the space allocated for the 
  106.    --  Gtk.Alignment.Gtk_Alignment. 
  107.    --  "yscale": the amount that the child widget expands vertically to fill 
  108.    --  up unused space, from 0 to 1. The values are similar to Xscale. 
  109.  
  110.    function Get_Type return Glib.GType; 
  111.    pragma Import (C, Get_Type, "gtk_alignment_get_type"); 
  112.  
  113.    ------------- 
  114.    -- Methods -- 
  115.    ------------- 
  116.  
  117.    procedure Get_Padding 
  118.       (Alignment      : not null access Gtk_Alignment_Record; 
  119.        Padding_Top    : out Guint; 
  120.        Padding_Bottom : out Guint; 
  121.        Padding_Left   : out Guint; 
  122.        Padding_Right  : out Guint); 
  123.    --  Gets the padding on the different sides of the widget. See 
  124.    --  gtk_alignment_set_padding (). 
  125.    --  Since: gtk+ 2.4 
  126.    --  "padding_top": location to store the padding for the top of the widget, 
  127.    --  or null 
  128.    --  "padding_bottom": location to store the padding for the bottom of the 
  129.    --  widget, or null 
  130.    --  "padding_left": location to store the padding for the left of the 
  131.    --  widget, or null 
  132.    --  "padding_right": location to store the padding for the right of the 
  133.    --  widget, or null 
  134.  
  135.    procedure Set_Padding 
  136.       (Alignment      : not null access Gtk_Alignment_Record; 
  137.        Padding_Top    : Guint; 
  138.        Padding_Bottom : Guint; 
  139.        Padding_Left   : Guint; 
  140.        Padding_Right  : Guint); 
  141.    --  Sets the padding on the different sides of the widget. The padding adds 
  142.    --  blank space to the sides of the widget. For instance, this can be used 
  143.    --  to indent the child widget towards the right by adding padding on the 
  144.    --  left. 
  145.    --  Since: gtk+ 2.4 
  146.    --  "padding_top": the padding at the top of the widget 
  147.    --  "padding_bottom": the padding at the bottom of the widget 
  148.    --  "padding_left": the padding at the left of the widget 
  149.    --  "padding_right": the padding at the right of the widget. 
  150.  
  151.    procedure Set 
  152.       (Alignment : not null access Gtk_Alignment_Record; 
  153.        Xalign    : Gfloat; 
  154.        Yalign    : Gfloat; 
  155.        Xscale    : Gfloat; 
  156.        Yscale    : Gfloat); 
  157.    --  Sets the Gtk.Alignment.Gtk_Alignment values. 
  158.    --  "xalign": the horizontal alignment of the child widget, from 0 (left) 
  159.    --  to 1 (right). 
  160.    --  "yalign": the vertical alignment of the child widget, from 0 (top) to 1 
  161.    --  (bottom). 
  162.    --  "xscale": the amount that the child widget expands horizontally to fill 
  163.    --  up unused space, from 0 to 1. A value of 0 indicates that the child 
  164.    --  widget should never expand. A value of 1 indicates that the child widget 
  165.    --  will expand to fill all of the space allocated for the 
  166.    --  Gtk.Alignment.Gtk_Alignment. 
  167.    --  "yscale": the amount that the child widget expands vertically to fill 
  168.    --  up unused space, from 0 to 1. The values are similar to Xscale. 
  169.  
  170.    ---------------- 
  171.    -- Properties -- 
  172.    ---------------- 
  173.    --  The following properties are defined for this widget. See 
  174.    --  Glib.Properties for more information on properties) 
  175.  
  176.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint; 
  177.    --  The padding to insert at the bottom of the widget. 
  178.  
  179.    Left_Padding_Property : constant Glib.Properties.Property_Uint; 
  180.    --  The padding to insert at the left of the widget. 
  181.  
  182.    Right_Padding_Property : constant Glib.Properties.Property_Uint; 
  183.    --  The padding to insert at the right of the widget. 
  184.  
  185.    Top_Padding_Property : constant Glib.Properties.Property_Uint; 
  186.    --  The padding to insert at the top of the widget. 
  187.  
  188.    Xalign_Property : constant Glib.Properties.Property_Float; 
  189.  
  190.    Xscale_Property : constant Glib.Properties.Property_Float; 
  191.  
  192.    Yalign_Property : constant Glib.Properties.Property_Float; 
  193.  
  194.    Yscale_Property : constant Glib.Properties.Property_Float; 
  195.  
  196.    ---------------- 
  197.    -- Interfaces -- 
  198.    ---------------- 
  199.    --  This class implements several interfaces. See Glib.Types 
  200.    -- 
  201.    --  - "Buildable" 
  202.  
  203.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  204.      (Gtk.Buildable.Gtk_Buildable, Gtk_Alignment_Record, Gtk_Alignment); 
  205.    function "+" 
  206.      (Widget : access Gtk_Alignment_Record'Class) 
  207.    return Gtk.Buildable.Gtk_Buildable 
  208.    renames Implements_Gtk_Buildable.To_Interface; 
  209.    function "-" 
  210.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  211.    return Gtk_Alignment 
  212.    renames Implements_Gtk_Buildable.To_Object; 
  213.  
  214. private 
  215.    Yscale_Property : constant Glib.Properties.Property_Float := 
  216.      Glib.Properties.Build ("yscale"); 
  217.    Yalign_Property : constant Glib.Properties.Property_Float := 
  218.      Glib.Properties.Build ("yalign"); 
  219.    Xscale_Property : constant Glib.Properties.Property_Float := 
  220.      Glib.Properties.Build ("xscale"); 
  221.    Xalign_Property : constant Glib.Properties.Property_Float := 
  222.      Glib.Properties.Build ("xalign"); 
  223.    Top_Padding_Property : constant Glib.Properties.Property_Uint := 
  224.      Glib.Properties.Build ("top-padding"); 
  225.    Right_Padding_Property : constant Glib.Properties.Property_Uint := 
  226.      Glib.Properties.Build ("right-padding"); 
  227.    Left_Padding_Property : constant Glib.Properties.Property_Uint := 
  228.      Glib.Properties.Build ("left-padding"); 
  229.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint := 
  230.      Glib.Properties.Build ("bottom-padding"); 
  231. end Gtk.Alignment;