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. --  Gtk_Buildable allows objects to extend and customize their deserialization 
  27. --  from Gtk_Builder UI descriptions. The interface includes methods for 
  28. --  setting names and properties of objects, parsing custom tags and 
  29. --  constructing child objects. 
  30. -- 
  31. --  The Gtk_Buildable interface is implemented by all widgets and many of the 
  32. --  non-widget objects that are provided by GTK+. The main user of this 
  33. --  interface is Gtk_Builder. There should be very little need for applications 
  34. --  to call any gtk_buildable_... functions. 
  35. -- 
  36. --  </description> 
  37.  
  38. pragma Warnings (Off, "*is already use-visible*"); 
  39. with Glib;        use Glib; 
  40. with Glib.Object; use Glib.Object; 
  41. with Glib.Types;  use Glib.Types; 
  42. with Glib.Values; use Glib.Values; 
  43. with Gtk.Builder; use Gtk.Builder; 
  44.  
  45. package Gtk.Buildable is 
  46.  
  47.    type Gtk_Buildable is new Glib.Types.GType_Interface; 
  48.  
  49.    ------------------ 
  50.    -- Constructors -- 
  51.    ------------------ 
  52.  
  53.    function Get_Type return Glib.GType; 
  54.    pragma Import (C, Get_Type, "gtk_buildable_get_type"); 
  55.  
  56.    ------------- 
  57.    -- Methods -- 
  58.    ------------- 
  59.  
  60.    procedure Add_Child 
  61.       (Self     : Gtk_Buildable; 
  62.        Builder  : access Gtk.Builder.Gtk_Builder_Record'Class; 
  63.        Child    : access Glib.Object.GObject_Record'Class; 
  64.        The_Type : UTF8_String); 
  65.    --  Adds a child to Buildable. Type is an optional string describing how 
  66.    --  the child should be added. 
  67.    --  Since: gtk+ 2.12 
  68.    --  "builder": a Gtk.Builder.Gtk_Builder 
  69.    --  "child": child to add 
  70.    --  "type": kind of child or null 
  71.  
  72.    function Construct_Child 
  73.       (Self    : Gtk_Buildable; 
  74.        Builder : access Gtk.Builder.Gtk_Builder_Record'Class; 
  75.        Name    : UTF8_String) return Glib.Object.GObject; 
  76.    --  Constructs a child of Buildable with the name Name. 
  77.    --  Gtk.Builder.Gtk_Builder calls this function if a "constructor" has been 
  78.    --  specified in the UI definition. 
  79.    --  Since: gtk+ 2.12 
  80.    --  Returns the constructed child 
  81.    --  "builder": Gtk.Builder.Gtk_Builder used to construct this object 
  82.    --  "name": name of child to construct 
  83.  
  84.    procedure Custom_Finished 
  85.       (Self    : Gtk_Buildable; 
  86.        Builder : access Gtk.Builder.Gtk_Builder_Record'Class; 
  87.        Child   : access Glib.Object.GObject_Record'Class; 
  88.        Tagname : UTF8_String; 
  89.        Data    : System.Address); 
  90.    --  This is similar to Gtk.Buildable.Parser_Finished but is called once for 
  91.    --  each custom tag handled by the Buildable. 
  92.    --  Since: gtk+ 2.12 
  93.    --  "builder": a Gtk.Builder.Gtk_Builder 
  94.    --  "child": child object or null for non-child tags 
  95.    --  "tagname": the name of the tag 
  96.    --  "data": user data created in custom_tag_start 
  97.  
  98.    procedure Custom_Tag_End 
  99.       (Self    : Gtk_Buildable; 
  100.        Builder : access Gtk.Builder.Gtk_Builder_Record'Class; 
  101.        Child   : access Glib.Object.GObject_Record'Class; 
  102.        Tagname : UTF8_String; 
  103.        Data    : System.Address); 
  104.    --  This is called at the end of each custom element handled by the 
  105.    --  buildable. 
  106.    --  Since: gtk+ 2.12 
  107.    --  "builder": Gtk.Builder.Gtk_Builder used to construct this object 
  108.    --  "child": child object or null for non-child tags 
  109.    --  "tagname": name of tag 
  110.    --  "data": user data that will be passed in to parser functions 
  111.  
  112.    function Get_Internal_Child 
  113.       (Self      : Gtk_Buildable; 
  114.        Builder   : access Gtk.Builder.Gtk_Builder_Record'Class; 
  115.        Childname : UTF8_String) return Glib.Object.GObject; 
  116.    --  Get the internal child called Childname of the Buildable object. 
  117.    --  Since: gtk+ 2.12 
  118.    --  Returns the internal child of the buildable object 
  119.    --  "builder": a Gtk.Builder.Gtk_Builder 
  120.    --  "childname": name of child 
  121.  
  122.    function Get_Name (Self : Gtk_Buildable) return UTF8_String; 
  123.    procedure Set_Name (Self : Gtk_Buildable; Name : UTF8_String); 
  124.    --  Sets the name of the Buildable object. 
  125.    --  Since: gtk+ 2.12 
  126.    --  "name": name to set 
  127.  
  128.    procedure Parser_Finished 
  129.       (Self    : Gtk_Buildable; 
  130.        Builder : access Gtk.Builder.Gtk_Builder_Record'Class); 
  131.    --  Called when the builder finishes the parsing of a <link 
  132.    --  linkend="BUILDER-UI">GtkBuilder UI definition</link>. Note that this 
  133.    --  will be called once for each time Gtk.Builder.Add_From_File or 
  134.    --  Gtk.Builder.Add_From_String is called on a builder. 
  135.    --  Since: gtk+ 2.12 
  136.    --  "builder": a Gtk.Builder.Gtk_Builder 
  137.  
  138.    procedure Set_Buildable_Property 
  139.       (Self    : Gtk_Buildable; 
  140.        Builder : access Gtk.Builder.Gtk_Builder_Record'Class; 
  141.        Name    : UTF8_String; 
  142.        Value   : out Glib.Values.GValue); 
  143.    --  Sets the property name Name to Value on the Buildable object. 
  144.    --  Since: gtk+ 2.12 
  145.    --  "builder": a Gtk.Builder.Gtk_Builder 
  146.    --  "name": name of property 
  147.    --  "value": value of property 
  148.  
  149. end Gtk.Buildable;