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