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