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-2011, 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. --  A Gtk_Frame is a simple border than can be added to any widget or group of 
  27. --  widget to enhance its visual aspect. Optionally, a frame can have a title. 
  28. -- 
  29. --  This is a very convenient widget to visually group related widgets (like 
  30. --  groups of buttons for instance), possibly with a title to explain the 
  31. --  purpose of this group. 
  32. -- 
  33. --  A Gtk_Frame has only one child, so you have to put a container like for 
  34. --  instance a Gtk_Box inside if you want the frame to surround multiple 
  35. --  widgets. 
  36. -- 
  37. --  </description> 
  38. --  <screenshot>gtk-frame</screenshot> 
  39. --  <group>Ornaments</group> 
  40. --  <testgtk>create_frame.adb</testgtk> 
  41.  
  42. pragma Warnings (Off, "*is already use-visible*"); 
  43. with Glib;            use Glib; 
  44. with Glib.Properties; use Glib.Properties; 
  45. with Glib.Types;      use Glib.Types; 
  46. with Gtk.Bin;         use Gtk.Bin; 
  47. with Gtk.Buildable;   use Gtk.Buildable; 
  48. with Gtk.Enums;       use Gtk.Enums; 
  49. with Gtk.Widget;      use Gtk.Widget; 
  50.  
  51. package Gtk.Frame is 
  52.  
  53.    type Gtk_Frame_Record is new Gtk_Bin_Record with null record; 
  54.    type Gtk_Frame is access all Gtk_Frame_Record'Class; 
  55.  
  56.    ------------------ 
  57.    -- Constructors -- 
  58.    ------------------ 
  59.  
  60.    procedure Gtk_New (Frame : out Gtk_Frame; Label : UTF8_String := ""); 
  61.    procedure Initialize 
  62.       (Frame : access Gtk_Frame_Record'Class; 
  63.        Label : UTF8_String := ""); 
  64.    --  Creates a new Gtk.Frame.Gtk_Frame, with optional label Label. If Label 
  65.    --  is null, the label is omitted. 
  66.    --  "label": the text to use as the label of the frame 
  67.  
  68.    function Get_Type return Glib.GType; 
  69.    pragma Import (C, Get_Type, "gtk_frame_get_type"); 
  70.  
  71.    ------------- 
  72.    -- Methods -- 
  73.    ------------- 
  74.  
  75.    function Get_Label (Frame : access Gtk_Frame_Record) return UTF8_String; 
  76.    procedure Set_Label 
  77.       (Frame : access Gtk_Frame_Record; 
  78.        Label : UTF8_String); 
  79.    --  Sets the text of the label. If Label is null, the current label is 
  80.    --  removed. 
  81.    --  "label": the text to use as the label of the frame 
  82.  
  83.    procedure Get_Label_Align 
  84.       (Frame  : access Gtk_Frame_Record; 
  85.        Xalign : out Gfloat; 
  86.        Yalign : out Gfloat); 
  87.    procedure Set_Label_Align 
  88.       (Frame  : access Gtk_Frame_Record; 
  89.        Xalign : Gfloat; 
  90.        Yalign : Gfloat); 
  91.    --  Sets the alignment of the frame widget's label. The default values for 
  92.    --  a newly created frame are 0.0 and 0.5. 
  93.    --  "xalign": The position of the label along the top edge of the widget. A 
  94.    --  value of 0.0 represents left alignment; 1.0 represents right alignment. 
  95.    --  "yalign": The y alignment of the label. A value of 0.0 aligns under the 
  96.    --  frame; 1.0 aligns above the frame. If the values are exactly 0.0 or 1.0 
  97.    --  the gap in the frame won't be painted because the label will be 
  98.    --  completely above or below the frame. 
  99.  
  100.    function Get_Label_Widget 
  101.       (Frame : access Gtk_Frame_Record) return Gtk.Widget.Gtk_Widget; 
  102.    procedure Set_Label_Widget 
  103.       (Frame        : access Gtk_Frame_Record; 
  104.        Label_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  105.    --  Sets the label widget for the frame. This is the widget that will 
  106.    --  appear embedded in the top edge of the frame as a title. 
  107.    --  "label_widget": the new label widget 
  108.  
  109.    function Get_Shadow_Type 
  110.       (Frame : access Gtk_Frame_Record) return Gtk.Enums.Gtk_Shadow_Type; 
  111.    procedure Set_Shadow_Type 
  112.       (Frame    : access Gtk_Frame_Record; 
  113.        The_Type : Gtk.Enums.Gtk_Shadow_Type); 
  114.    --  Sets the shadow type for Frame. 
  115.    --  "type": the new Gtk.Enums.Gtk_Shadow_Type 
  116.  
  117.    ---------------- 
  118.    -- Interfaces -- 
  119.    ---------------- 
  120.    --  This class implements several interfaces. See Glib.Types 
  121.    -- 
  122.    --  - "Buildable" 
  123.  
  124.    package Implements_Buildable is new Glib.Types.Implements 
  125.      (Gtk.Buildable.Gtk_Buildable, Gtk_Frame_Record, Gtk_Frame); 
  126.    function "+" 
  127.      (Widget : access Gtk_Frame_Record'Class) 
  128.    return Gtk.Buildable.Gtk_Buildable 
  129.    renames Implements_Buildable.To_Interface; 
  130.    function "-" 
  131.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  132.    return Gtk_Frame 
  133.    renames Implements_Buildable.To_Object; 
  134.  
  135.    ---------------- 
  136.    -- Properties -- 
  137.    ---------------- 
  138.    --  The following properties are defined for this widget. See 
  139.    --  Glib.Properties for more information on properties) 
  140.    -- 
  141.    --  Name: Label_Property 
  142.    --  Type: UTF8_String 
  143.    --  Flags: read-write 
  144.    -- 
  145.    --  Name: Label_Widget_Property 
  146.    --  Type: Gtk.Widget.Gtk_Widget 
  147.    --  Flags: read-write 
  148.    -- 
  149.    --  Name: Label_Xalign_Property 
  150.    --  Type: Gfloat 
  151.    --  Flags: read-write 
  152.    -- 
  153.    --  Name: Label_Yalign_Property 
  154.    --  Type: Gfloat 
  155.    --  Flags: read-write 
  156.    -- 
  157.    --  Name: Shadow_Property 
  158.    --  Type: Gtk.Enums.Gtk_Shadow_Type 
  159.    --  Flags: read-write 
  160.    -- 
  161.    --  Name: Shadow_Type_Property 
  162.    --  Type: Gtk.Enums.Gtk_Shadow_Type 
  163.    --  Flags: read-write 
  164.  
  165.    Label_Property : constant Glib.Properties.Property_String; 
  166.    Label_Widget_Property : constant Glib.Properties.Property_Object; 
  167.    Label_Xalign_Property : constant Glib.Properties.Property_Float; 
  168.    Label_Yalign_Property : constant Glib.Properties.Property_Float; 
  169.    Shadow_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  170.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  171.  
  172. private 
  173.    Label_Property : constant Glib.Properties.Property_String := 
  174.      Glib.Properties.Build ("label"); 
  175.    Label_Widget_Property : constant Glib.Properties.Property_Object := 
  176.      Glib.Properties.Build ("label-widget"); 
  177.    Label_Xalign_Property : constant Glib.Properties.Property_Float := 
  178.      Glib.Properties.Build ("label-xalign"); 
  179.    Label_Yalign_Property : constant Glib.Properties.Property_Float := 
  180.      Glib.Properties.Build ("label-yalign"); 
  181.    Shadow_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  182.      Gtk.Enums.Build ("shadow"); 
  183.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  184.      Gtk.Enums.Build ("shadow-type"); 
  185. end Gtk.Frame;