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