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_Frame is a simple border than can be added to any widget or 
  28. --  group of widget to enhance its visual aspect. 
  29. --  Optionally, a frame can have a title. 
  30. -- 
  31. --  This is a very convenient widget to visually group related widgets (like 
  32. --  groups of buttons for instance), possibly with a title to explain the 
  33. --  purpose of this group. 
  34. -- 
  35. --  A Gtk_Frame has only one child, so you have to put a container like for 
  36. --  instance a Gtk_Box inside if you want the frame to surround multiple 
  37. --  widgets. 
  38. -- 
  39. --  </description> 
  40. --  <c_version>2.8.17</c_version> 
  41. --  <group>Ornaments</group> 
  42. --  <testgtk>create_frame.adb</testgtk> 
  43. --  <screenshot>gtk-frame</screenshot> 
  44.  
  45. with Glib.Properties; 
  46. with Gtk.Bin; 
  47. with Gtk.Widget; 
  48. with Gtk.Enums; use Gtk.Enums; 
  49.  
  50. package Gtk.Frame is 
  51.  
  52.    type Gtk_Frame_Record is new Gtk.Bin.Gtk_Bin_Record with private; 
  53.    type Gtk_Frame is access all Gtk_Frame_Record'Class; 
  54.  
  55.    procedure Gtk_New (Frame : out Gtk_Frame; Label : UTF8_String := ""); 
  56.    --  Create a new frame. 
  57.    --  If Label is not the empty string, the frame will have a title. 
  58.  
  59.    procedure Initialize 
  60.      (Frame : access Gtk_Frame_Record'Class; Label : UTF8_String := ""); 
  61.    --  Internal initialization function. 
  62.    --  See the section "Creating your own widgets" in the documentation. 
  63.  
  64.    function Get_Type return Glib.GType; 
  65.    --  Return the internal value associated with a Gtk_Frame. 
  66.  
  67.    procedure Set_Label 
  68.      (Frame : access Gtk_Frame_Record; Label : UTF8_String := ""); 
  69.    function Get_Label (Frame : access Gtk_Frame_Record) return UTF8_String; 
  70.    --  Change the label of the frame dynamically. 
  71.    --  If Label is the empty string, the frame's label is deleted. 
  72.  
  73.    procedure Set_Label_Widget 
  74.      (Frame        : access Gtk_Frame_Record; 
  75.       Label_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  76.    function Get_Label_Widget 
  77.      (Frame : access Gtk_Frame_Record) return Gtk.Widget.Gtk_Widget; 
  78.    --  Set the label widget for the frame. 
  79.    --  This is the widget that will appear embedded in the top edge of the 
  80.    --  frame as a title. 
  81.  
  82.    procedure Set_Label_Align 
  83.      (Frame  : access Gtk_Frame_Record; 
  84.       Xalign : Gfloat := 0.0; 
  85.       Yalign : Gfloat := 0.0); 
  86.    --  Change the alignment of the title in the frame. 
  87.    --  Xalign and Yalign are both percents that indicate the exact position 
  88.    --  of the label relative to the top-left corner of the frame. 
  89.    --  Note that Yalign is currently ignored, and the label can only be 
  90.    --  displayed on the top of the frame (0.0 for Xalign means align the label 
  91.    --  on the left, 1.0 means align the label on the right). 
  92.  
  93.    procedure Get_Label_Align 
  94.      (Frame  : access Gtk_Frame_Record; 
  95.       Xalign : out Gfloat; 
  96.       Yalign : out Gfloat); 
  97.    --  Return the X and Y alignments of the title in the frame. 
  98.  
  99.    procedure Set_Shadow_Type 
  100.      (Frame    : access Gtk_Frame_Record; 
  101.       The_Type : Gtk_Shadow_Type); 
  102.    --  Change the visual aspect of the frame. 
  103.  
  104.    function Get_Shadow_Type 
  105.      (Frame : access Gtk_Frame_Record) return Gtk_Shadow_Type; 
  106.    --  Return the visual aspect of the frame. 
  107.  
  108.    ---------------- 
  109.    -- Properties -- 
  110.    ---------------- 
  111.  
  112.    --  <properties> 
  113.    --  The following properties are defined for this widget. See 
  114.    --  Glib.Properties for more information on properties. 
  115.    -- 
  116.    --  Name:  Label_Property 
  117.    --  Type:  UTF8_String 
  118.    --  Flags: read-write 
  119.    --  Descr: Text of the frame's label. 
  120.    --  See also: Set_Label and Get_Label 
  121.    -- 
  122.    --  Name:  Shadow_Property 
  123.    --  Type:  Gtk_Shadow_Type 
  124.    --  Flags: read-write 
  125.    --  Descr: Appearance of the frameborder. 
  126.    --  See also: Set_Shadow_Type 
  127.    -- 
  128.    --  Name:  Label_Widget_Property 
  129.    --  Type:  Gtk_Widget'Class 
  130.    --  Flags: read-write 
  131.    --  Descr: A widget to display in place of the usual frame label. 
  132.    --  See also: Set_Label_Widget 
  133.    -- 
  134.    --  Name:  Label_Xalign_Property 
  135.    --  Type:  Float 
  136.    --  Descr: The horizontal alignment of the label 
  137.    -- 
  138.    --  Name:  Label_Yalign_Property 
  139.    --  Type:  Float 
  140.    --  Descr: The vertical alignment of the label 
  141.    -- 
  142.    --  Name:  Shadow_Type_Property 
  143.    --  Type:  Enum 
  144.    --  Descr: Appearance of the frame border 
  145.    -- 
  146.    --  </properties> 
  147.  
  148.    Label_Property        : constant Glib.Properties.Property_String; 
  149.    Label_Widget_Property : constant Glib.Properties.Property_Object; 
  150.    Label_Xalign_Property : constant Glib.Properties.Property_Float; 
  151.    Label_Yalign_Property : constant Glib.Properties.Property_Float; 
  152.    Shadow_Type_Property  : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  153.  
  154.    ------------- 
  155.    -- Signals -- 
  156.    ------------- 
  157.  
  158.    --  <signals> 
  159.    --  The following new signals are defined for this widget: 
  160.    --  </signals> 
  161.  
  162. private 
  163.    type Gtk_Frame_Record is new Gtk.Bin.Gtk_Bin_Record with null record; 
  164.  
  165.    Label_Property        : constant Glib.Properties.Property_String := 
  166.      Glib.Properties.Build ("label"); 
  167.    Label_Xalign_Property : constant Glib.Properties.Property_Float := 
  168.      Glib.Properties.Build ("label_xalign"); 
  169.    Label_Yalign_Property : constant Glib.Properties.Property_Float := 
  170.      Glib.Properties.Build ("label_yalign"); 
  171.    Shadow_Type_Property  : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  172.      Gtk.Enums.Build ("shadow"); 
  173.    Label_Widget_Property : constant Glib.Properties.Property_Object := 
  174.      Glib.Properties.Build ("label_widget"); 
  175.  
  176.    pragma Import (C, Get_Type, "gtk_frame_get_type"); 
  177. end Gtk.Frame;