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_Aspect_Frame is the same type of widget as a frame, but it 
  28. --  constrains its child to a specific aspect ratio between its width 
  29. --  and its height. 
  30. -- 
  31. --  This ratio can either be given explicitly by the user, or chosen from the 
  32. --  widget's initial size request (might be different from the one if was 
  33. --  actually given). 
  34. -- 
  35. --  </description> 
  36. --  <c_version>2.8.17</c_version> 
  37. --  <group>Layout containers</group> 
  38. --  <testgtk>create_frame.adb</testgtk> 
  39.  
  40. with Glib.Properties; 
  41. with Gtk.Frame; 
  42.  
  43. package Gtk.Aspect_Frame is 
  44.  
  45.    type Gtk_Aspect_Frame_Record is new Gtk.Frame.Gtk_Frame_Record with private; 
  46.    type Gtk_Aspect_Frame is access all Gtk_Aspect_Frame_Record'Class; 
  47.  
  48.    procedure Gtk_New 
  49.      (Aspect_Frame : out Gtk_Aspect_Frame; 
  50.       Label        : UTF8_String; 
  51.       Xalign       : Gfloat; 
  52.       Yalign       : Gfloat; 
  53.       Ratio        : Gfloat; 
  54.       Obey_Child   : Boolean); 
  55.    --  Create a new Aspect_Frame. 
  56.    --  If Label is the empty string, then the frame won't have any title. 
  57.    --  Xalign and Yalign are constrained to the range 0.0 .. 1.0 and specify 
  58.    --  the alignment of the child inside the frame (0.0 means either left or 
  59.    --  top aligned, 1.0 means right or bottom aligned). 
  60.    --  Ratio is the ratio width/height for the child of the frame. 
  61.    --  If Obey_Child is True, then Ratio is ignored and the effective ratio 
  62.    --  is taken from the child's requisition (ie the ideal size it asked 
  63.    --  for at creation time). 
  64.  
  65.    procedure Initialize 
  66.      (Aspect_Frame : access Gtk_Aspect_Frame_Record'Class; 
  67.       Label        : UTF8_String; 
  68.       Xalign       : Gfloat; 
  69.       Yalign       : Gfloat; 
  70.       Ratio        : Gfloat; 
  71.       Obey_Child   : Boolean); 
  72.    --  Internal initialization function. 
  73.    --  See the section "Creating your own widgets" in the documentation. 
  74.  
  75.    function Get_Type return Gtk.Gtk_Type; 
  76.    --  Return the internal value associated with a Gtk_Aspect_Frame. 
  77.  
  78.    procedure Set 
  79.      (Aspect_Frame : access Gtk_Aspect_Frame_Record; 
  80.       Xalign       : Gfloat; 
  81.       Yalign       : Gfloat; 
  82.       Ratio        : Gfloat; 
  83.       Obey_Child   : Boolean); 
  84.    --  Modify the frame's parameters (see the description of these parameters 
  85.    --  for Gtk_New. 
  86.  
  87.    function Get_Ratio 
  88.      (Aspect_Frame : access Gtk_Aspect_Frame_Record) return Gfloat; 
  89.    --  Return the current ratio for the frame (width / height) 
  90.  
  91.    function Get_Xalign 
  92.      (Aspect_Frame : access Gtk_Aspect_Frame_Record) return Gfloat; 
  93.    --  Return the current X alignment for the frame. 
  94.    --  0.0 means the child is left aligned, 1.0 that it is right aligned. 
  95.  
  96.    function Get_Yalign 
  97.      (Aspect_Frame : access Gtk_Aspect_Frame_Record) return Gfloat; 
  98.    --  Return the current Y alignment for the frame. 
  99.    --  1.0 means the child is top aligned, 1.0 that it is bottom aligned. 
  100.  
  101.    ---------------- 
  102.    -- Properties -- 
  103.    ---------------- 
  104.  
  105.    --  <properties> 
  106.    --  The following properties are defined for this widget. See 
  107.    --  Glib.Properties for more information on properties. 
  108.    -- 
  109.    --  Name:  Xalign_Property 
  110.    --  Type:  Gfloat 
  111.    --  Flags: read-write 
  112.    --  Descr: X alignment of the child 
  113.    --  See also: Set and Get_Xalign 
  114.    -- 
  115.    --  Name:  Yalign_Property 
  116.    --  Type:  Gfloat 
  117.    --  Flags: read-write 
  118.    --  Descr: Y alignment of the child 
  119.    --  See also: Set and Get_Xalign 
  120.    -- 
  121.    --  Name:  Ratio_Property 
  122.    --  Type:  Gfloat 
  123.    --  Flags: read-write 
  124.    --  Descr: Aspect ratio if obey_child is FALSE 
  125.    --  See also: Set and Get_Ratio 
  126.    -- 
  127.    --  Name:  Obey_Child_Property 
  128.    --  Type:  Boolean 
  129.    --  Flags: read-write 
  130.    --  Descr: Force aspect ratio to match that of the frame's child 
  131.    --  See also: Set and Get_Ratio 
  132.    -- 
  133.    --  </properties> 
  134.  
  135.    Xalign_Property     : constant Glib.Properties.Property_Float; 
  136.    Yalign_Property     : constant Glib.Properties.Property_Float; 
  137.    Radio_Property      : constant Glib.Properties.Property_Float; 
  138.    Obey_Child_Property : constant Glib.Properties.Property_Boolean; 
  139.    Ratio_Property      : constant Glib.Properties.Property_Float; 
  140.  
  141.    ------------- 
  142.    -- Signals -- 
  143.    ------------- 
  144.  
  145.    --  <signals> 
  146.    --  The following new signals are defined for this widget: 
  147.    --  </signals> 
  148.  
  149. private 
  150.    type Gtk_Aspect_Frame_Record is new Gtk.Frame.Gtk_Frame_Record 
  151.      with null record; 
  152.  
  153.    Xalign_Property     : constant Glib.Properties.Property_Float := 
  154.      Glib.Properties.Build ("xalign"); 
  155.    Yalign_Property     : constant Glib.Properties.Property_Float := 
  156.      Glib.Properties.Build ("xalign"); 
  157.    Radio_Property      : constant Glib.Properties.Property_Float := 
  158.      Glib.Properties.Build ("ratio"); 
  159.    Obey_Child_Property : constant Glib.Properties.Property_Boolean := 
  160.      Glib.Properties.Build ("obey_child"); 
  161.    Ratio_Property : constant Glib.Properties.Property_Float := 
  162.      Glib.Properties.Build ("ratio"); 
  163.  
  164.    pragma Import (C, Get_Type, "gtk_aspect_frame_get_type"); 
  165. end Gtk.Aspect_Frame;