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