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. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <description> 
  31. -- 
  32. --  A Gtk_Alignment controls the size and alignment of its single child inside 
  33. --  the area allocated to the alignment widget. 
  34. -- 
  35. --  The scale/size settings indicate how much the child will expand to fill 
  36. --  the container. The values should be in the range 0.0 (no expansion) to 1.0 
  37. --  (full expansion). Note that the scale only indicates the minimal size for 
  38. --  the child, it does not force an absolute size. 
  39. -- 
  40. --  The alignment settings indicate where in the alignment widget the child 
  41. --  should be located. The values are in the range 0.0 (top or left) to 1.0 
  42. --  (bottom or right). These settings are irrelevant if the child is fully 
  43. --  expanded. 
  44. -- 
  45. --  </description> 
  46. --  <c_version>2.8.17</c_version> 
  47. --  <testgtk>create_alignment.adb</testgt> 
  48. --  <screenshot>gtk-alignment</screenshot> 
  49.  
  50. with Gtk.Bin; 
  51. with Glib.Properties; 
  52.  
  53. package Gtk.Alignment is 
  54.  
  55.    type Gtk_Alignment_Record is new Gtk.Bin.Gtk_Bin_Record with private; 
  56.    type Gtk_Alignment is access all Gtk_Alignment_Record'Class; 
  57.  
  58.    procedure Gtk_New 
  59.      (Alignment : out Gtk_Alignment; 
  60.       Xalign    : Gfloat; 
  61.       Yalign    : Gfloat; 
  62.       Xscale    : Gfloat; 
  63.       Yscale    : Gfloat); 
  64.    --  Create a new alignment widget, with initial values for the settings. 
  65.    --  See the description of the settings above. 
  66.  
  67.    procedure Initialize 
  68.      (Alignment : access Gtk_Alignment_Record'Class; 
  69.       Xalign    : Gfloat; 
  70.       Yalign    : Gfloat; 
  71.       Xscale    : Gfloat; 
  72.       Yscale    : Gfloat); 
  73.    --  Internal initialization function. 
  74.    --  See the section "Creating your own widgets" in the documentation. 
  75.  
  76.    function Get_Type return Gtk.Gtk_Type; 
  77.    --  Return the internal value associated with a Gtk_Alignment. 
  78.  
  79.    procedure Set 
  80.      (Alignment : access Gtk_Alignment_Record; 
  81.       Xalign    : Gfloat; 
  82.       Yalign    : Gfloat; 
  83.       Xscale    : Gfloat; 
  84.       Yscale    : Gfloat); 
  85.    --  Modify the settings for the alignment. 
  86.    --  See the description of the settings above. 
  87.  
  88.    function Get_Xalign (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  89.    --  Return the X alignment value. 
  90.    --  Its value is in the range 0.0 .. 1.0, from left to right. 
  91.  
  92.    function Get_Yalign (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  93.    --  Return the Y alignment value. 
  94.    --  Its value is in the range 0.0 .. 1.0, from top to bottom. 
  95.  
  96.    function Get_Xscale (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  97.    --  Return the X expansion value, in the range 0.0 .. 1.0. 
  98.    --  0.0 means no expansion while 1.0 means full expansion. 
  99.  
  100.    function Get_Yscale (Alignment : access Gtk_Alignment_Record) return Gfloat; 
  101.    --  Return the Y expansion value, in the range 0.0 .. 1.0 
  102.    --  0.0 means no expansion while 1.0 means full expansion. 
  103.  
  104.    procedure Set_Padding 
  105.      (Alignment      : access Gtk_Alignment_Record; 
  106.       Padding_Top    : Guint; 
  107.       Padding_Bottom : Guint; 
  108.       Padding_Left   : Guint; 
  109.       Padding_Right  : Guint); 
  110.    procedure Get_Padding 
  111.      (Alignment      : access Gtk_Alignment_Record; 
  112.       Padding_Top    : out Guint; 
  113.       Padding_Bottom : out Guint; 
  114.       Padding_Left   : out Guint; 
  115.       Padding_Right  : out Guint); 
  116.    --  Sets the padding on the different sides of the widget. 
  117.    --  The padding adds blank space to the sides of the widget. For instance, 
  118.    --  this can be used to indent the child widget towards the right by adding 
  119.    --  padding on the left. 
  120.  
  121.    ---------------- 
  122.    -- Properties -- 
  123.    ---------------- 
  124.  
  125.    --  <properties> 
  126.    --  The following properties are defined for this widget. See 
  127.    --  Glib.Properties for more information on properties. 
  128.    -- 
  129.    --  Name:  Xalign_Property 
  130.    --  Type:  Float 
  131.    --  Flags: read-write 
  132.    --  Descr: Value between 0.0 and 1.0 to indicate X alignment 
  133.    --  See also: Set and Get_Xalign 
  134.    -- 
  135.    --  Name:  Yalign_Property 
  136.    --  Type:  Float 
  137.    --  Flags: read-write 
  138.    --  Descr: Value between 0.0 and 1.0 to indicate Y alignment 
  139.    --  See also: Set and Get_Yalign 
  140.    -- 
  141.    --  Name:  Xscale_Property 
  142.    --  Type:  Float 
  143.    --  Flags: read-write 
  144.    --  Descr: Value between 0.0 and 1.0 to indicate X scale 
  145.    --  See also: Set and Get_Xscale 
  146.    -- 
  147.    --  Name:  Yscale_Property 
  148.    --  Type:  Float 
  149.    --  Flags: read-write 
  150.    --  Descr: Value between 0.0 and 1.0 to indicate Y scale 
  151.    --  See also: Set and Get_Yscale 
  152.    -- 
  153.    --  Name:  Bottom_Padding_Property 
  154.    --  Type:  Uint 
  155.    --  Descr: The padding to insert at the bottom of the widget. 
  156.    -- 
  157.    --  Name:  Left_Padding_Property 
  158.    --  Type:  Uint 
  159.    --  Descr: The padding to insert at the left of the widget. 
  160.    -- 
  161.    --  Name:  Right_Padding_Property 
  162.    --  Type:  Uint 
  163.    --  Descr: The padding to insert at the right of the widget. 
  164.    -- 
  165.    --  Name:  Top_Padding_Property 
  166.    --  Type:  Uint 
  167.    --  Descr: The padding to insert at the top of the widget. 
  168.    -- 
  169.    --  </properties> 
  170.  
  171.    Xalign_Property         : constant Glib.Properties.Property_Float; 
  172.    Yalign_Property         : constant Glib.Properties.Property_Float; 
  173.    Xscale_Property         : constant Glib.Properties.Property_Float; 
  174.    Yscale_Property         : constant Glib.Properties.Property_Float; 
  175.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint; 
  176.    Left_Padding_Property   : constant Glib.Properties.Property_Uint; 
  177.    Right_Padding_Property  : constant Glib.Properties.Property_Uint; 
  178.    Top_Padding_Property    : constant Glib.Properties.Property_Uint; 
  179.  
  180.    ------------- 
  181.    -- Signals -- 
  182.    ------------- 
  183.  
  184.    --  <signals> 
  185.    --  The following new signals are defined for this widget: 
  186.    --  </signals> 
  187.  
  188. private 
  189.    type Gtk_Alignment_Record is new Gtk.Bin.Gtk_Bin_Record with null record; 
  190.  
  191.    Xalign_Property : constant Glib.Properties.Property_Float := 
  192.      Glib.Properties.Build ("xalign"); 
  193.    Yalign_Property : constant Glib.Properties.Property_Float := 
  194.      Glib.Properties.Build ("yalign"); 
  195.    Xscale_Property : constant Glib.Properties.Property_Float := 
  196.      Glib.Properties.Build ("xscale"); 
  197.    Yscale_Property : constant Glib.Properties.Property_Float := 
  198.      Glib.Properties.Build ("yscale"); 
  199.    Bottom_Padding_Property : constant Glib.Properties.Property_Uint := 
  200.      Glib.Properties.Build ("bottom-padding"); 
  201.    Left_Padding_Property : constant Glib.Properties.Property_Uint := 
  202.      Glib.Properties.Build ("left-padding"); 
  203.    Right_Padding_Property : constant Glib.Properties.Property_Uint := 
  204.      Glib.Properties.Build ("right-padding"); 
  205.    Top_Padding_Property : constant Glib.Properties.Property_Uint := 
  206.      Glib.Properties.Build ("top-padding"); 
  207.  
  208.    pragma Import (C, Get_Type, "gtk_alignment_get_type"); 
  209. end Gtk.Alignment;