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. --  This widget is a base class for all the widgets that require an alignment 
  32. --  and padding. This widget can not be instantiated directly. 
  33. -- 
  34. --  </description> 
  35. --  <group>Abstract base classes</group> 
  36.  
  37. pragma Warnings (Off, "*is already use-visible*"); 
  38. with Glib;            use Glib; 
  39. with Glib.Properties; use Glib.Properties; 
  40. with Glib.Types;      use Glib.Types; 
  41. with Gtk.Buildable;   use Gtk.Buildable; 
  42. with Gtk.Widget;      use Gtk.Widget; 
  43.  
  44. package Gtk.Misc is 
  45.  
  46.    type Gtk_Misc_Record is new Gtk_Widget_Record with null record; 
  47.    type Gtk_Misc is access all Gtk_Misc_Record'Class; 
  48.  
  49.    ------------------ 
  50.    -- Constructors -- 
  51.    ------------------ 
  52.  
  53.    function Get_Type return Glib.GType; 
  54.    pragma Import (C, Get_Type, "gtk_misc_get_type"); 
  55.  
  56.    ------------- 
  57.    -- Methods -- 
  58.    ------------- 
  59.  
  60.    procedure Get_Alignment 
  61.       (Misc   : access Gtk_Misc_Record; 
  62.        Xalign : out Gfloat; 
  63.        Yalign : out Gfloat); 
  64.    procedure Set_Alignment 
  65.       (Misc   : access Gtk_Misc_Record; 
  66.        Xalign : Gfloat; 
  67.        Yalign : Gfloat); 
  68.    --  Modify the alignment for the widget. Xalign and Yalign are both values 
  69.    --  between 0.0 and 1.0 that specify the alignment: if Xalign is 0.0, the 
  70.    --  widget will be left aligned; if it is 0.5, the widget will be centered; 
  71.    --  if it is 1.0 the widget will be right aligned. Yalign is from top (0.0) 
  72.    --  to bottom (1.0). Both Xalign and Yalign will be constrained to the range 
  73.    --  0.0 .. 1.0 Note that if the widget fills its allocated area, these two 
  74.    --  parameters won't have any effect. 
  75.  
  76.    procedure Get_Padding 
  77.       (Misc : access Gtk_Misc_Record; 
  78.        Xpad : out Gint; 
  79.        Ypad : out Gint); 
  80.    procedure Set_Padding 
  81.       (Misc : access Gtk_Misc_Record; 
  82.        Xpad : Gint; 
  83.        Ypad : Gint); 
  84.    --  Set the padding (i.e. the extra spaces on the side of the widget). If 
  85.    --  Xpad or Ypad is negative, they will be changed to 0. 
  86.  
  87.    ---------------- 
  88.    -- Interfaces -- 
  89.    ---------------- 
  90.    --  This class implements several interfaces. See Glib.Types 
  91.    -- 
  92.    --  - "Buildable" 
  93.  
  94.    package Implements_Buildable is new Glib.Types.Implements 
  95.      (Gtk.Buildable.Gtk_Buildable, Gtk_Misc_Record, Gtk_Misc); 
  96.    function "+" 
  97.      (Widget : access Gtk_Misc_Record'Class) 
  98.    return Gtk.Buildable.Gtk_Buildable 
  99.    renames Implements_Buildable.To_Interface; 
  100.    function "-" 
  101.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  102.    return Gtk_Misc 
  103.    renames Implements_Buildable.To_Object; 
  104.  
  105.    ---------------- 
  106.    -- Properties -- 
  107.    ---------------- 
  108.    --  The following properties are defined for this widget. See 
  109.    --  Glib.Properties for more information on properties) 
  110.    -- 
  111.    --  Name: Xalign_Property 
  112.    --  Type: Gfloat 
  113.    --  Flags: read-write 
  114.    -- 
  115.    --  Name: Xpad_Property 
  116.    --  Type: Gint 
  117.    --  Flags: read-write 
  118.    -- 
  119.    --  Name: Yalign_Property 
  120.    --  Type: Gfloat 
  121.    --  Flags: read-write 
  122.    -- 
  123.    --  Name: Ypad_Property 
  124.    --  Type: Gint 
  125.    --  Flags: read-write 
  126.  
  127.    Xalign_Property : constant Glib.Properties.Property_Float; 
  128.    Xpad_Property : constant Glib.Properties.Property_Int; 
  129.    Yalign_Property : constant Glib.Properties.Property_Float; 
  130.    Ypad_Property : constant Glib.Properties.Property_Int; 
  131.  
  132. private 
  133.    Xalign_Property : constant Glib.Properties.Property_Float := 
  134.      Glib.Properties.Build ("xalign"); 
  135.    Xpad_Property : constant Glib.Properties.Property_Int := 
  136.      Glib.Properties.Build ("xpad"); 
  137.    Yalign_Property : constant Glib.Properties.Property_Float := 
  138.      Glib.Properties.Build ("yalign"); 
  139.    Ypad_Property : constant Glib.Properties.Property_Int := 
  140.      Glib.Properties.Build ("ypad"); 
  141. end Gtk.Misc;