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.Misc.Gtk_Misc widget is an abstract widget which is not useful 
  26. --  itself, but is used to derive subclasses which have alignment and padding 
  27. --  attributes. 
  28. -- 
  29. --  The horizontal and vertical padding attributes allows extra space to be 
  30. --  added around the widget. 
  31. -- 
  32. --  The horizontal and vertical alignment attributes enable the widget to be 
  33. --  positioned within its allocated area. Note that if the widget is added to a 
  34. --  container in such a way that it expands automatically to fill its allocated 
  35. --  area, the alignment settings will not alter the widgets position. 
  36. -- 
  37. --  Note: Note that the desired effect can in most cases be achieved by using 
  38. --  the Gtk.Widget.Gtk_Widget:halign, Gtk.Widget.Gtk_Widget:valign and 
  39. --  Gtk.Widget.Gtk_Widget:margin properties on the child widget, so GtkMisc 
  40. --  should not be used in new code. 
  41. -- 
  42. --  </description> 
  43. --  <group>Abstract base classes</group> 
  44. pragma Ada_2005; 
  45.  
  46. pragma Warnings (Off, "*is already use-visible*"); 
  47. with Glib;            use Glib; 
  48. with Glib.Properties; use Glib.Properties; 
  49. with Glib.Types;      use Glib.Types; 
  50. with Gtk.Buildable;   use Gtk.Buildable; 
  51. with Gtk.Widget;      use Gtk.Widget; 
  52.  
  53. package Gtk.Misc is 
  54.  
  55.    type Gtk_Misc_Record is new Gtk_Widget_Record with null record; 
  56.    type Gtk_Misc is access all Gtk_Misc_Record'Class; 
  57.  
  58.    ------------------ 
  59.    -- Constructors -- 
  60.    ------------------ 
  61.  
  62.    function Get_Type return Glib.GType; 
  63.    pragma Import (C, Get_Type, "gtk_misc_get_type"); 
  64.  
  65.    ------------- 
  66.    -- Methods -- 
  67.    ------------- 
  68.  
  69.    procedure Get_Alignment 
  70.       (Misc   : not null access Gtk_Misc_Record; 
  71.        Xalign : out Gfloat; 
  72.        Yalign : out Gfloat); 
  73.    --  Gets the X and Y alignment of the widget within its allocation. See 
  74.    --  Gtk.Misc.Set_Alignment. 
  75.    --  "xalign": location to store X alignment of Misc, or null 
  76.    --  "yalign": location to store Y alignment of Misc, or null 
  77.  
  78.    procedure Set_Alignment 
  79.       (Misc   : not null access Gtk_Misc_Record; 
  80.        Xalign : Gfloat; 
  81.        Yalign : Gfloat); 
  82.    --  Modify the alignment for the widget. Xalign and Yalign are both values 
  83.    --  between 0.0 and 1.0 that specify the alignment: if Xalign is 0.0, the 
  84.    --  widget will be left aligned; if it is 0.5, the widget will be centered; 
  85.    --  if it is 1.0 the widget will be right aligned. Yalign is from top (0.0) 
  86.    --  to bottom (1.0). Both Xalign and Yalign will be constrained to the range 
  87.    --  0.0 .. 1.0 Note that if the widget fills its allocated area, these two 
  88.    --  parameters won't have any effect. 
  89.    --  "xalign": the horizontal alignment, from 0 (left) to 1 (right). 
  90.    --  "yalign": the vertical alignment, from 0 (top) to 1 (bottom). 
  91.  
  92.    procedure Get_Padding 
  93.       (Misc : not null access Gtk_Misc_Record; 
  94.        Xpad : out Gint; 
  95.        Ypad : out Gint); 
  96.    --  Gets the padding in the X and Y directions of the widget. See 
  97.    --  Gtk.Misc.Set_Padding. 
  98.    --  "xpad": location to store padding in the X direction, or null 
  99.    --  "ypad": location to store padding in the Y direction, or null 
  100.  
  101.    procedure Set_Padding 
  102.       (Misc : not null access Gtk_Misc_Record; 
  103.        Xpad : Gint; 
  104.        Ypad : Gint); 
  105.    --  Sets the amount of space to add around the widget. 
  106.    --  "xpad": the amount of space to add on the left and right of the widget, 
  107.    --  in pixels. 
  108.    --  "ypad": the amount of space to add on the top and bottom of the widget, 
  109.    --  in pixels. 
  110.  
  111.    ---------------- 
  112.    -- Properties -- 
  113.    ---------------- 
  114.    --  The following properties are defined for this widget. See 
  115.    --  Glib.Properties for more information on properties) 
  116.  
  117.    Xalign_Property : constant Glib.Properties.Property_Float; 
  118.  
  119.    Xpad_Property : constant Glib.Properties.Property_Int; 
  120.  
  121.    Yalign_Property : constant Glib.Properties.Property_Float; 
  122.  
  123.    Ypad_Property : constant Glib.Properties.Property_Int; 
  124.  
  125.    ---------------- 
  126.    -- Interfaces -- 
  127.    ---------------- 
  128.    --  This class implements several interfaces. See Glib.Types 
  129.    -- 
  130.    --  - "Buildable" 
  131.  
  132.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  133.      (Gtk.Buildable.Gtk_Buildable, Gtk_Misc_Record, Gtk_Misc); 
  134.    function "+" 
  135.      (Widget : access Gtk_Misc_Record'Class) 
  136.    return Gtk.Buildable.Gtk_Buildable 
  137.    renames Implements_Gtk_Buildable.To_Interface; 
  138.    function "-" 
  139.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  140.    return Gtk_Misc 
  141.    renames Implements_Gtk_Buildable.To_Object; 
  142.  
  143. private 
  144.    Ypad_Property : constant Glib.Properties.Property_Int := 
  145.      Glib.Properties.Build ("ypad"); 
  146.    Yalign_Property : constant Glib.Properties.Property_Float := 
  147.      Glib.Properties.Build ("yalign"); 
  148.    Xpad_Property : constant Glib.Properties.Property_Int := 
  149.      Glib.Properties.Build ("xpad"); 
  150.    Xalign_Property : constant Glib.Properties.Property_Float := 
  151.      Glib.Properties.Build ("xalign"); 
  152. end Gtk.Misc;