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. -- 
  32. --  This package is deprecated and is here for purposes of backwards 
  33. --  compatibility. 
  34. -- 
  35. --  The handling of flags has been moved to Gtk.Widget, and the rest 
  36. --  of the facilities are available through Glib.Object. 
  37. -- 
  38. --  </description> 
  39. --  <c_version>2.8.17</c_version> 
  40. --  <group>Abstract base classes</group> 
  41.  
  42. with Glib.Object; 
  43. with Glib.Properties; 
  44. with Glib.GSlist; 
  45. with Gtkada.Types; 
  46.  
  47. package Gtk.Object is 
  48.  
  49.    type Gtk_Object_Record is new Glib.Object.GObject_Record with private; 
  50.    type Gtk_Object is access all Gtk_Object_Record'Class; 
  51.  
  52.    procedure Destroy (Object : access Gtk_Object_Record); 
  53.    --  Destroy the object. 
  54.    --  This emits a "destroy" signal, calls all your handlers, and then 
  55.    --  unconnects them all. The object is then unref-ed, and if its reference 
  56.    --  count goes down to 0, the memory associated with the object and its 
  57.    --  user data is freed. 
  58.    --  Note that when you destroy handlers are called, the user_data is still 
  59.    --  available. 
  60.    -- 
  61.    --  When a widget is destroyed, it will break any references it holds to 
  62.    --  other objects. If the widget is inside a container, the widget will be 
  63.    --  removed from the container. If the widget is a toplevel (derived from 
  64.    --  Gtk_Window), it will be removed from the list of toplevels, and the 
  65.    --  reference GTK+ holds to it will be removed. Removing widget from its 
  66.    --  container or the list of toplevels results in the widget being 
  67.    --  finalized, unless you've added additional references to the widget with 
  68.    --  Ref. 
  69.    -- 
  70.    --  In most cases, only toplevel widgets (windows) require explicit 
  71.    --  destruction, because when you destroy a toplevel its children will be 
  72.    --  destroyed as well. 
  73.  
  74.    function Get_Type return Gtk.Gtk_Type; 
  75.    --  Return the internal value associated with a Gtk_Object internally. 
  76.    pragma Import (C, Get_Type, "gtk_object_get_type"); 
  77.  
  78.    function Get_Type (Object : access Gtk_Object_Record) return Gtk_Type; 
  79.    --  This function is now obsolete, and is temporarily kept for backward 
  80.    --  compatibility only. Use Glib.Object.Get_Type instead. 
  81.    --  ??? 
  82.  
  83.    ----------- 
  84.    -- Lists -- 
  85.    ----------- 
  86.  
  87.    function Convert (W : Gtk_Object) return System.Address; 
  88.    function Convert (W : System.Address) return Gtk_Object; 
  89.  
  90.    package Object_SList is new Glib.GSlist.Generic_SList (Gtk_Object); 
  91.  
  92.    ----------- 
  93.    -- Flags -- 
  94.    ----------- 
  95.    --  Each object is associated with a set of flags, that reports the state 
  96.    --  of the object. 
  97.    --  The following flags are known by all objects: 
  98.    -- 
  99.    --  - "Destroyed": 
  100.    --     Set if the object is marked as destroyed (if its reference count is 
  101.    --     not yet 0, the memory has not been freed, but you should not use it 
  102.    --     anyway). 
  103.    -- 
  104.    --  - "Floating": 
  105.    --     The object has no parent yet, since it was just created. Its 
  106.    --     reference count is still 1 (as it was initially). This flag is 
  107.    --     cleared as soon as Set_Parent is called on the widget or the widget 
  108.    --     is qualified as a toplevel widget (see 
  109.    --     Gtk.Container.Register_Toplevel). 
  110.  
  111.    In_Destruction : constant := 2 ** 0; 
  112.    Floating       : constant := 2 ** 1; 
  113.    Reserved_1     : constant := 2 ** 2; 
  114.    Reserved_2     : constant := 2 ** 3; 
  115.  
  116.    function Flags (Object : access Gtk_Object_Record) return Guint32; 
  117.    --  Return the flags that are set for the object, as a binary mask. 
  118.  
  119.    procedure Set_Flags (Object : access Gtk_Object_Record; Flags : Guint32); 
  120.    --  Set some specific flags for the object. 
  121.    --  Flags is a mask that will be added to the current flags of the object. 
  122.  
  123.    procedure Unset_Flags (Object : access Gtk_Object_Record; Flags : Guint32); 
  124.    --  Unset some specific flags for the object. 
  125.    --  Flags is a mask that will be deleted from the current flags of the 
  126.    --  object. 
  127.  
  128.    function Flag_Is_Set 
  129.      (Object : access Gtk_Object_Record; Flag : Guint32) return Boolean; 
  130.    --  Return True if the specific flag Flag is set for the object. 
  131.  
  132.    function In_Destruction_Is_Set 
  133.      (Object : access Gtk_Object_Record'Class) return Boolean; 
  134.    --  Test if the Destroyed flag is set for the object. 
  135.  
  136.    --  <doc_ignore> 
  137.    function Destroyed_Is_Set (Object : access Gtk_Object_Record'Class) 
  138.       return Boolean renames In_Destruction_Is_Set; 
  139.    --  backward compatibility only 
  140.    --  </doc_ignore> 
  141.  
  142.    function Floating_Is_Set 
  143.      (Object : access Gtk_Object_Record'Class) return Boolean; 
  144.    --  Test if the Floating flag is set for the object. 
  145.  
  146.    -------------------------- 
  147.    -- Creating new widgets -- 
  148.    -------------------------- 
  149.  
  150.    --  <doc_ignore> 
  151.    --  The following definitions are only provided for better backward 
  152.    --  compatibility. You should use Glib.Object directly. 
  153.  
  154.    subtype GObject_Class is Glib.Object.GObject_Class; 
  155.    Uninitialized_Class : GObject_Class renames 
  156.      Glib.Object.Uninitialized_Class; 
  157.  
  158.    subtype Signal_Parameter_Types is Glib.Object.Signal_Parameter_Types; 
  159.  
  160.    Null_Parameter_Types : Signal_Parameter_Types renames 
  161.      Glib.Object.Null_Parameter_Types; 
  162.  
  163.    procedure Initialize_Class_Record 
  164.      (Object       : access GObject_Record'Class; 
  165.       Signals      : Gtkada.Types.Chars_Ptr_Array; 
  166.       Class_Record : in out GObject_Class; 
  167.       Type_Name    : String; 
  168.       Parameters   : Signal_Parameter_Types := Null_Parameter_Types) 
  169.       renames Glib.Object.Initialize_Class_Record; 
  170.  
  171.    --  </doc_ignore> 
  172.  
  173.    --------------- 
  174.    -- User Data -- 
  175.    --------------- 
  176.    --  It is possible to associate your own specific data with an existing 
  177.    --  object. See the documentation in Glib.Object. 
  178.    --  The declaration below has been kept for compatibility reasons. 
  179.  
  180.    generic 
  181.    package User_Data renames Glib.Object.User_Data; 
  182.  
  183.    ----------------- 
  184.    -- Obsolescent -- 
  185.    ----------------- 
  186.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  187.    --  from future versions of gtk+ (and therefore GtkAda). 
  188.    --  To find out whether your code uses any of these, we recommend compiling 
  189.    --  with the -gnatwj switch 
  190.    --  <doc_ignore> 
  191.  
  192.    procedure Sink (Object : access Gtk_Object_Record); 
  193.    pragma Obsolescent (Sink); 
  194.    --  Sink the object. 
  195.    --  If the object is floating (does not have a parent yet), it is unref-ed 
  196.    --  once and the floating flag is cleared. 
  197.  
  198.    --  </doc_ignore> 
  199.  
  200.    ---------------- 
  201.    -- Properties -- 
  202.    ---------------- 
  203.  
  204.    --  <properties> 
  205.    --  The following properties are defined for this widget. See 
  206.    --  Glib.Properties for more information on properties. 
  207.    -- 
  208.    --  - Name:  User_Data_Property 
  209.    --    Type:  Pointer 
  210.    --    Flags: read-write 
  211.    --    Descr: Anonymous User Data Pointer 
  212.    --    See also: User_Data.Set, using the default Id "user_data" 
  213.    -- 
  214.    --  </properties> 
  215.  
  216.    User_Data_Property : constant Glib.Properties.Property_Address; 
  217.  
  218.    ------------- 
  219.    -- Signals -- 
  220.    ------------- 
  221.  
  222.    --  <signals> 
  223.    --  The following new signals are defined for this widget: 
  224.    -- 
  225.    --  - "destroy" 
  226.    --    procedure Handler (Object : access Gtk_Object_Record'Class); 
  227.    -- 
  228.    --    Raised when the object is about to be destroyed. The "destroyed" 
  229.    --    flag has been set on the object first. Handlers should not keep 
  230.    --    a reference on the object. 
  231.    --    Note that when your destroy handlers are called, the user_data is 
  232.    --    still available. 
  233.    --    The default implementation destroys all the handlers. 
  234.    --  </signals> 
  235.  
  236.    Signal_Destroy : constant Glib.Signal_Name := "destroy"; 
  237.  
  238. private 
  239.    type Gtk_Object_Record is new Glib.Object.GObject_Record with null record; 
  240.  
  241.    User_Data_Property : constant Glib.Properties.Property_Address := 
  242.      Glib.Properties.Build ("user_data"); 
  243.  
  244.    pragma Inline (Floating_Is_Set); 
  245.    pragma Inline (In_Destruction_Is_Set); 
  246.  
  247. end Gtk.Object; 
  248.  
  249. --  The following subprograms never had a binding, but are now obsolescent 
  250. --  No binding: gtk_object_add_arg_type 
  251. --  No binding: gtk_object_get 
  252. --  No binding: gtk_object_get_data 
  253. --  No binding: gtk_object_get_data_by_id 
  254. --  No binding: gtk_object_get_user_data 
  255. --  No binding: gtk_object_new 
  256. --  No binding: gtk_object_ref 
  257. --  No binding: gtk_object_unref 
  258. --  No binding: gtk_object_remove_data 
  259. --  No binding: gtk_object_remove_data_by_id 
  260. --  No binding: gtk_object_remove_no_notify 
  261. --  No binding: gtk_object_remove_no_notify_by_id 
  262. --  No binding: gtk_object_set 
  263. --  No binding: gtk_object_set_data 
  264. --  No binding: gtk_object_set_data_by_id 
  265. --  No binding: gtk_object_set_data_by_id_full 
  266. --  No binding: gtk_object_set_data_full 
  267. --  No binding: gtk_object_set_user_data 
  268. --  No binding: gtk_object_weakref 
  269. --  No binding: gtk_object_weakunref