1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  GtkBuildable allows objects to extend and customize their deserialization 
  26. --  from <link linkend="BUILDER-UI">GtkBuilder UI descriptions</link>. The 
  27. --  interface includes methods for setting names and properties of objects, 
  28. --  parsing custom tags and constructing child objects. 
  29. -- 
  30. --  The GtkBuildable interface is implemented by all widgets and many of the 
  31. --  non-widget objects that are provided by GTK+. The main user of this 
  32. --  interface is Gtk.Builder.Gtk_Builder. There should be very little need for 
  33. --  applications to call any <function>gtk_buildable_...</function> functions. 
  34. -- 
  35. --  Note: 
  36. -- 
  37. --  An object only needs to implement this interface if it needs to extend the 
  38. --  Gtk.Builder.Gtk_Builder format or run any extra routines at deserialization 
  39. --  time 
  40. -- 
  41. --  </description> 
  42. pragma Ada_2005; 
  43.  
  44. pragma Warnings (Off, "*is already use-visible*"); 
  45. with Glib;        use Glib; 
  46. with Glib.Object; use Glib.Object; 
  47. with Glib.Types;  use Glib.Types; 
  48. with Glib.Values; use Glib.Values; 
  49. with Gtk.Builder; use Gtk.Builder; 
  50.  
  51. package Gtk.Buildable is 
  52.  
  53.    type Gtk_Buildable is new Glib.Types.GType_Interface; 
  54.    Null_Gtk_Buildable : constant Gtk_Buildable; 
  55.  
  56.    ------------------ 
  57.    -- Constructors -- 
  58.    ------------------ 
  59.  
  60.    function Get_Type return Glib.GType; 
  61.    pragma Import (C, Get_Type, "gtk_buildable_get_type"); 
  62.  
  63.    ------------- 
  64.    -- Methods -- 
  65.    ------------- 
  66.  
  67.    procedure Add_Child 
  68.       (Self     : Gtk_Buildable; 
  69.        Builder  : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  70.        Child    : not null access Glib.Object.GObject_Record'Class; 
  71.        The_Type : UTF8_String := ""); 
  72.    --  Adds a child to Buildable. Type is an optional string describing how 
  73.    --  the child should be added. 
  74.    --  Since: gtk+ 2.12 
  75.    --  "builder": a Gtk.Builder.Gtk_Builder 
  76.    --  "child": child to add 
  77.    --  "type": kind of child or null 
  78.  
  79.    function Construct_Child 
  80.       (Self    : Gtk_Buildable; 
  81.        Builder : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  82.        Name    : UTF8_String) return Glib.Object.GObject; 
  83.    --  Constructs a child of Buildable with the name Name. 
  84.    --  Gtk.Builder.Gtk_Builder calls this function if a "constructor" has been 
  85.    --  specified in the UI definition. 
  86.    --  Since: gtk+ 2.12 
  87.    --  "builder": Gtk.Builder.Gtk_Builder used to construct this object 
  88.    --  "name": name of child to construct 
  89.  
  90.    procedure Custom_Finished 
  91.       (Self    : Gtk_Buildable; 
  92.        Builder : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  93.        Child   : access Glib.Object.GObject_Record'Class; 
  94.        Tagname : UTF8_String; 
  95.        Data    : System.Address); 
  96.    --  This is similar to Gtk.Buildable.Parser_Finished but is called once for 
  97.    --  each custom tag handled by the Buildable. 
  98.    --  Since: gtk+ 2.12 
  99.    --  "builder": a Gtk.Builder.Gtk_Builder 
  100.    --  "child": child object or null for non-child tags 
  101.    --  "tagname": the name of the tag 
  102.    --  "data": user data created in custom_tag_start 
  103.  
  104.    procedure Custom_Tag_End 
  105.       (Self    : Gtk_Buildable; 
  106.        Builder : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  107.        Child   : access Glib.Object.GObject_Record'Class; 
  108.        Tagname : UTF8_String; 
  109.        Data    : in out System.Address); 
  110.    --  This is called at the end of each custom element handled by the 
  111.    --  buildable. 
  112.    --  Since: gtk+ 2.12 
  113.    --  "builder": Gtk.Builder.Gtk_Builder used to construct this object 
  114.    --  "child": child object or null for non-child tags 
  115.    --  "tagname": name of tag 
  116.    --  "data": user data that will be passed in to parser functions 
  117.  
  118.    function Get_Internal_Child 
  119.       (Self      : Gtk_Buildable; 
  120.        Builder   : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  121.        Childname : UTF8_String) return Glib.Object.GObject; 
  122.    --  Get the internal child called Childname of the Buildable object. 
  123.    --  Since: gtk+ 2.12 
  124.    --  "builder": a Gtk.Builder.Gtk_Builder 
  125.    --  "childname": name of child 
  126.  
  127.    function Get_Name (Self : Gtk_Buildable) return UTF8_String; 
  128.    --  Gets the name of the Buildable object. 
  129.    --  Gtk.Builder.Gtk_Builder sets the name based on the <link 
  130.    --  linkend="BUILDER-UI">GtkBuilder UI definition</link> used to construct 
  131.    --  the Buildable. 
  132.    --  Since: gtk+ 2.12 
  133.  
  134.    procedure Set_Name (Self : Gtk_Buildable; Name : UTF8_String); 
  135.    --  Sets the name of the Buildable object. 
  136.    --  Since: gtk+ 2.12 
  137.    --  "name": name to set 
  138.  
  139.    procedure Parser_Finished 
  140.       (Self    : Gtk_Buildable; 
  141.        Builder : not null access Gtk.Builder.Gtk_Builder_Record'Class); 
  142.    --  Called when the builder finishes the parsing of a <link 
  143.    --  linkend="BUILDER-UI">GtkBuilder UI definition</link>. Note that this 
  144.    --  will be called once for each time Gtk.Builder.Add_From_File or 
  145.    --  Gtk.Builder.Add_From_String is called on a builder. 
  146.    --  Since: gtk+ 2.12 
  147.    --  "builder": a Gtk.Builder.Gtk_Builder 
  148.  
  149.    procedure Set_Buildable_Property 
  150.       (Self    : Gtk_Buildable; 
  151.        Builder : not null access Gtk.Builder.Gtk_Builder_Record'Class; 
  152.        Name    : UTF8_String; 
  153.        Value   : in out Glib.Values.GValue); 
  154.    --  Sets the property name Name to Value on the Buildable object. 
  155.    --  Since: gtk+ 2.12 
  156.    --  "builder": a Gtk.Builder.Gtk_Builder 
  157.    --  "name": name of property 
  158.    --  "value": value of property 
  159.  
  160.    ---------------- 
  161.    -- Interfaces -- 
  162.    ---------------- 
  163.    --  This class implements several interfaces. See Glib.Types 
  164.    -- 
  165.    --  - "Gtk_Buildable" 
  166.  
  167.    function "+" (W : Gtk_Buildable) return Gtk_Buildable; 
  168.    pragma Inline ("+"); 
  169.  
  170. private 
  171.  
  172. Null_Gtk_Buildable : constant Gtk_Buildable := 
  173.    Gtk_Buildable (Glib.Types.Null_Interface); 
  174. end Gtk.Buildable;