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