1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2006 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. -- 
  27. --  A Gtk_Alignment controls the size and alignment of its single child inside 
  28. --  the area allocated to the alignment widget. 
  29. -- 
  30. --  The scale/size settings indicate how much the child will expand to fill 
  31. --  the container. The values should be in the range 0.0 (no expansion) to 1.0 
  32. --  (full expansion). Note that the scale only indicates the minimal size for 
  33. --  the child, it does not force an absolute size. 
  34. -- 
  35. --  The alignment settings indicate where in the alignment widget the child 
  36. --  should be located. The values are in the range 0.0 (top or left) to 1.0 
  37. --  (bottom or right). These settings are irrelevant if the child is fully 
  38. --  expanded. 
  39. -- 
  40. --  </description> 
  41. --  <c_version>2.8.17</c_version> 
  42. --  <testgtk>create_alignment.adb</testgt> 
  43. --  <screenshot>gtk-alignment</screenshot> 
  44.  
  45. with Gtk.Bin; 
  46. with Glib.Properties; 
  47.  
  48. package Gtk.Alignment is 
  49.  
  50.    type Gtk_Alignment_Record is new Gtk.Bin.Gtk_Bin_Record with private; 
  51.    type Gtk_Alignment is access all Gtk_Alignment_Record'Class; 
  52.  
  53.    procedure Gtk_New 
  54.      (Alignment : out Gtk_Alignment; 
  55.       Xalign    : Gfloat; 
  56.       Yalign    : Gfloat; 
  57.       Xscale    : Gfloat; 
  58.       Yscale    : Gfloat); 
  59.    --  Create a new alignment widget, with initial values for the settings. 
  60.    --  See the description of the settings above. 
  61.  
  62.    procedure Initialize 
  63.      (Alignment : access Gtk_Alignment_Record'Class; 
  64.       Xalign    : Gfloat; 
  65.       Yalign    : Gfloat; 
  66.       Xscale    : Gfloat; 
  67.       Yscale    : Gfloat); 
  68.    --  Internal initialization function. 
  69.    --  See the section "Creating your own widgets" in the documentation. 
  70.  
  71.    function Get_Type return Gtk.Gtk_Type; 
  72.    --  Return the internal value associated with a Gtk_Alignment. 
  73.  
  74.    procedure Set 
  75.      (Alignment : access Gtk_Alignment_Record; 
  76.       Xalign    : Gfloat; 
  77.       Yalign    : Gfloat; 
  78.       Xscale    : Gfloat; 
  79.       Yscale    : Gfloat); 
  80.    --  Modify the settings for the alignment. 
  81.    --  See the description of the settings above. 
  82.  
  83.    function Get_Xalign (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  84.    --  Return the X alignment value. 
  85.    --  Its value is in the range 0.0 .. 1.0, from left to right. 
  86.  
  87.    function Get_Yalign (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  88.    --  Return the Y alignment value. 
  89.    --  Its value is in the range 0.0 .. 1.0, from top to bottom. 
  90.  
  91.    function Get_Xscale (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  92.    --  Return the X expansion value, in the range 0.0 .. 1.0. 
  93.    --  0.0 means no expansion while 1.0 means full expansion. 
  94.  
  95.    function Get_Yscale (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  96.    --  Return the Y expansion value, in the range 0.0 .. 1.0 
  97.    --  0.0 means no expansion while 1.0 means full expansion. 
  98.  
  99.    procedure Set_Padding 
  100.      (Alignment      : access Gtk_Alignment_Record; 
  101.       Padding_Top    : Guint; 
  102.       Padding_Bottom : Guint; 
  103.       Padding_Left   : Guint; 
  104.       Padding_Right  : Guint); 
  105.    procedure Get_Padding 
  106.      (Alignment      : access Gtk_Alignment_Record; 
  107.       Padding_Top    : out Guint; 
  108.       Padding_Bottom : out Guint; 
  109.       Padding_Left   : out Guint; 
  110.       Padding_Right  : out Guint); 
  111.    --  Sets the padding on the different sides of the widget. 
  112.    --  The padding adds blank space to the sides of the widget. For instance, 
  113.    --  this can be used to indent the child widget towards the right by adding 
  114.    --  padding on the left. 
  115.  
  116.    ---------------- 
  117.    -- Properties -- 
  118.    ---------------- 
  119.  
  120.    --  <properties> 
  121.    --  The following properties are defined for this widget. See 
  122.    --  Glib.Properties for more information on properties. 
  123.    -- 
  124.    --  Name:  Xalign_Property 
  125.    --  Type:  Float 
  126.    --  Flags: read-write 
  127.    --  Descr: Value between 0.0 and 1.0 to indicate X alignment 
  128.    --  See also: Set and Get_Xalign 
  129.    -- 
  130.    --  Name:  Yalign_Property 
  131.    --  Type:  Float 
  132.    --  Flags: read-write 
  133.    --  Descr: Value between 0.0 and 1.0 to indicate Y alignment 
  134.    --  See also: Set and Get_Yalign 
  135.    -- 
  136.    --  Name:  Xscale_Property 
  137.    --  Type:  Float 
  138.    --  Flags: read-write 
  139.    --  Descr: Value between 0.0 and 1.0 to indicate X scale 
  140.    --  See also: Set and Get_Xscale 
  141.    -- 
  142.    --  Name:  Yscale_Property 
  143.    --  Type:  Float 
  144.    --  Flags: read-write 
  145.    --  Descr: Value between 0.0 and 1.0 to indicate Y scale 
  146.    --  See also: Set and Get_Yscale 
  147.    -- 
  148.    --  Name:  Bottom_Padding_Property 
  149.    --  Type:  Uint 
  150.    --  Descr: The padding to insert at the bottom of the widget. 
  151.    -- 
  152.    --  Name:  Left_Padding_Property 
  153.    --  Type:  Uint 
  154.    --  Descr: The padding to insert at the left of the widget. 
  155.    -- 
  156.    --  Name:  Right_Padding_Property 
  157.    --  Type:  Uint 
  158.    --  Descr: The padding to insert at the right of the widget. 
  159.    -- 
  160.    --  Name:  Top_Padding_Property 
  161.    --  Type:  Uint 
  162.    --  Descr: The padding to insert at the top of the widget. 
  163.    -- 
  164.    --  </properties> 
  165.  
  166.    Xalign_Property         : constant Glib.Properties.Property_Float; 
  167.    Yalign_Property         : constant Glib.Properties.Property_Float; 
  168.    Xscale_Property         : constant Glib.Properties.Property_Float; 
  169.    Yscale_Property         : constant Glib.Properties.Property_Float; 
  170.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint; 
  171.    Left_Padding_Property   : constant Glib.Properties.Property_Uint; 
  172.    Right_Padding_Property  : constant Glib.Properties.Property_Uint; 
  173.    Top_Padding_Property    : constant Glib.Properties.Property_Uint; 
  174.  
  175.    ------------- 
  176.    -- Signals -- 
  177.    ------------- 
  178.  
  179.    --  <signals> 
  180.    --  The following new signals are defined for this widget: 
  181.    --  </signals> 
  182.  
  183. private 
  184.    type Gtk_Alignment_Record is new Gtk.Bin.Gtk_Bin_Record with null record; 
  185.  
  186.    Xalign_Property : constant Glib.Properties.Property_Float := 
  187.      Glib.Properties.Build ("xalign"); 
  188.    Yalign_Property : constant Glib.Properties.Property_Float := 
  189.      Glib.Properties.Build ("yalign"); 
  190.    Xscale_Property : constant Glib.Properties.Property_Float := 
  191.      Glib.Properties.Build ("xscale"); 
  192.    Yscale_Property : constant Glib.Properties.Property_Float := 
  193.      Glib.Properties.Build ("yscale"); 
  194.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint := 
  195.      Glib.Properties.Build ("bottom-padding"); 
  196.    Left_Padding_Property : constant Glib.Properties.Property_Uint := 
  197.      Glib.Properties.Build ("left-padding"); 
  198.    Right_Padding_Property : constant Glib.Properties.Property_Uint := 
  199.      Glib.Properties.Build ("right-padding"); 
  200.    Top_Padding_Property : constant Glib.Properties.Property_Uint := 
  201.      Glib.Properties.Build ("top-padding"); 
  202.  
  203.    pragma Import (C, Get_Type, "gtk_alignment_get_type"); 
  204. end Gtk.Alignment;