1. ------------------------------------------------------------------------------ 
  2. --                  GtkAda - Ada95 binding for Gtk+/Gnome                   -- 
  3. --                                                                          -- 
  4. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  5. --                     Copyright (C) 1998-2014, AdaCore                     -- 
  6. --                                                                          -- 
  7. -- This library is free software;  you can redistribute it and/or modify it -- 
  8. -- under terms of the  GNU General Public License  as published by the Free -- 
  9. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  10. -- version. This library is distributed in the hope that it will be useful, -- 
  11. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  12. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  13. --                                                                          -- 
  14. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  15. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  16. -- version 3.1, as published by the Free Software Foundation.               -- 
  17. --                                                                          -- 
  18. -- You should have received a copy of the GNU General Public License and    -- 
  19. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  20. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  21. -- <http://www.gnu.org/licenses/>.                                          -- 
  22. --                                                                          -- 
  23. ------------------------------------------------------------------------------ 
  24.  
  25. --  <description> 
  26. --  This package is obsolete and replaced by Glib.Values. 
  27. --  Future versions of GtkAda will no longer provide this package. 
  28. -- 
  29. --  This package provides a convenient interface to C, providing easy 
  30. --  conversion from a C's (void*) pointer to any Ada type used in 
  31. --  GtkAda.  Although this package has been designed to be easily 
  32. --  reusable by being as general as possible, these functions are mainly 
  33. --  used when writing callbacks and/or marshallers (see Gtk.Marshallers 
  34. --  and Gtk.Handlers). 
  35. -- 
  36. --  Therefore, the main type in this package is Gtk_Args, which is the 
  37. --  equivalent of the C's (GtkArg*) array, i.e an array of unions.  This 
  38. --  package provides functions to extract the values from this type. 
  39. --  </description> 
  40. --  <c_version>2.8.17</c_version> 
  41. --  <group>Signal handling</group> 
  42.  
  43. with Cairo.Region; 
  44. with Glib.Values; 
  45. with Glib.Object; 
  46. with Glib.Types; 
  47. with Gdk.Event; 
  48. with Gdk.RGBA; 
  49. with Gdk.Types; 
  50. with Gtk.Dialog; 
  51. with Gtk.Enums; 
  52. with Gtk.GEntry; 
  53. with Gtk.Notebook; 
  54. with Gtk.Print_Operation; 
  55. with Gtk.Status_Bar; 
  56. with Gtk.Text_Iter; 
  57. with Gtk.Tree_Model; 
  58. with Gtk.Widget; 
  59.  
  60. package Gtk.Arguments is 
  61.  
  62.    --  <doc_ignore>Do not create automatic documentation for this package 
  63.  
  64.    subtype Gtk_Args is Glib.Values.GValues; 
  65.    --  This type represents a table of arguments. Each argument of the 
  66.    --  table can be of any type. You can access them through one of the 
  67.    --  To_* functions found below. The index of the first element is 
  68.    --  always 1. 
  69.  
  70.    function Make_Args 
  71.      (Nb : Guint; Args : Glib.Values.C_GValues) return Gtk_Args 
  72.      renames Glib.Values.Make_Values; 
  73.    --  Build a Gtk_Args structure from the given C array. Nb should be the 
  74.    --  number of elements in the Args array. 
  75.  
  76.    --------------------------------------------------- 
  77.    -- Conversion functions, interfacing to Gtk_Args -- 
  78.    --------------------------------------------------- 
  79.  
  80.    function To_Gint    (Args : Gtk_Args; Num : Positive) return Gint; 
  81.    function To_Guint   (Args : Gtk_Args; Num : Positive) return Guint; 
  82.    function To_Boolean (Args : Gtk_Args; Num : Positive) return Boolean; 
  83.    function To_Event   (Args : Gtk_Args; Num : Positive) 
  84.      return Gdk.Event.Gdk_Event; 
  85.    function To_String  (Args : Gtk_Args; Num : Positive) return UTF8_String; 
  86.    function To_Notebook_Page 
  87.      (Args : Gtk_Args; Num : Positive) return Gtk_Notebook_Page; 
  88.    function To_Address (Args : Gtk_Args; Num : Positive) return System.Address; 
  89.    function To_C_Proxy (Args : Gtk_Args; Num : Positive) return Glib.C_Proxy; 
  90.    function To_Object 
  91.      (Args : Gtk_Args; Num : Positive) return Glib.Object.GObject; 
  92.    --  This function can return null, if the C object was not created. 
  93.    function To_Requisition (Args : Gtk_Args; Num : Positive) 
  94.       return Gtk.Widget.Gtk_Requisition_Access; 
  95.    function To_Allocation 
  96.      (Args : Gtk_Args; Num : Positive) return Gtk.Widget.Gtk_Allocation_Access; 
  97.  
  98.    function Unchecked_To_Boolean 
  99.      (Args : Glib.Values.C_GValues; Num : Guint) return Boolean; 
  100.    function Unchecked_To_Address 
  101.      (Args : Glib.Values.C_GValues; Num : Guint) return System.Address; 
  102.    function Unchecked_To_Object 
  103.      (Args : Glib.Values.C_GValues; Num : Guint) return Glib.Object.GObject; 
  104.    function Unchecked_To_Interface 
  105.      (Args : Glib.Values.C_GValues; Num : Guint) 
  106.       return Glib.Types.GType_Interface; 
  107.    function Unchecked_To_Gint 
  108.      (Args : Glib.Values.C_GValues; Num : Guint) return Gint; 
  109.    function Unchecked_To_Gint_Access 
  110.      (Args : Glib.Values.C_GValues; Num : Guint) return access Gint; 
  111.    function Unchecked_To_Gdouble 
  112.      (Args : Glib.Values.C_GValues; Num : Guint) return Gdouble; 
  113.    function Unchecked_To_Gdouble_Access 
  114.      (Args : Glib.Values.C_GValues; Num : Guint) return access Gdouble; 
  115.    function Unchecked_To_Guint 
  116.      (Args : Glib.Values.C_GValues; Num : Guint) return Guint; 
  117.    function Unchecked_To_Context_Id 
  118.      (Args : Glib.Values.C_GValues; Num : Guint) 
  119.       return Gtk.Status_Bar.Context_Id; 
  120.    function Unchecked_To_UTF8_String 
  121.      (Args : Glib.Values.C_GValues; Num : Guint) return UTF8_String; 
  122.    function Unchecked_To_Gdk_RGBA 
  123.      (Args : Glib.Values.C_GValues; Num : Guint) return Gdk.RGBA.Gdk_RGBA; 
  124.    function Unchecked_To_Gdk_Key_Type 
  125.      (Args : Glib.Values.C_GValues; Num : Guint) return Gdk.Types.Gdk_Key_Type; 
  126.    function Unchecked_To_Gdk_Event_Button 
  127.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Button); 
  128.    function Unchecked_To_Gdk_Event_Owner_Change 
  129.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Owner_Change); 
  130.    function Unchecked_To_Gdk_Event_Scroll 
  131.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Scroll); 
  132.    function Unchecked_To_Gdk_Event 
  133.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event); 
  134.    function Unchecked_To_Gdk_Event_Any 
  135.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Any); 
  136.    function Unchecked_To_Gdk_Event_Configure 
  137.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Configure); 
  138.    function Unchecked_To_Gdk_Event_Crossing 
  139.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Crossing); 
  140.    function Unchecked_To_Gdk_Event_Expose 
  141.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Expose); 
  142.    function Unchecked_To_Gdk_Event_Focus 
  143.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Focus); 
  144.    function Unchecked_To_Gdk_Event_Grab_Broken 
  145.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Grab_Broken); 
  146.    function Unchecked_To_Gdk_Event_Key 
  147.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Key); 
  148.    function Unchecked_To_Gdk_Event_Motion 
  149.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Motion); 
  150.    function Unchecked_To_Gdk_Event_Property 
  151.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Property); 
  152.    function Unchecked_To_Gdk_Event_Proximity 
  153.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Proximity); 
  154.    function Unchecked_To_Gdk_Event_Selection 
  155.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Selection); 
  156.    function Unchecked_To_Gdk_Event_Visibility 
  157.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Visibility); 
  158.    function Unchecked_To_Gdk_Event_Window_State 
  159.      is new Glib.Values.Unsafe_Proxy_Nth (Gdk.Event.Gdk_Event_Window_State); 
  160.    function Unchecked_To_Gtk_Movement_Step 
  161.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Movement_Step); 
  162.    function Unchecked_To_Gtk_Drag_Result 
  163.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Drag_Result); 
  164.    function Unchecked_To_Gtk_State_Flags 
  165.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_State_Flags); 
  166.    function Unchecked_To_Gtk_State_Type 
  167.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_State_Type); 
  168.    function Unchecked_To_Gtk_Scroll_Type 
  169.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Scroll_Type); 
  170.    function Unchecked_To_Gtk_Text_Direction 
  171.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Text_Direction); 
  172.    function Unchecked_To_Gtk_Direction_Type 
  173.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Direction_Type); 
  174.    function Unchecked_To_Gtk_Widget_Help_Type 
  175.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Widget.Gtk_Widget_Help_Type); 
  176.    function Unchecked_To_Gtk_Delete_Type 
  177.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Delete_Type); 
  178.    function Unchecked_To_Gtk_Menu_Direction_Type 
  179.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Menu_Direction_Type); 
  180.    function Unchecked_To_Gtk_Orientation 
  181.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Orientation); 
  182.    function Unchecked_To_Gtk_Notebook_Tab 
  183.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Notebook.Gtk_Notebook_Tab); 
  184.    function Unchecked_To_Gtk_Toolbar_Style 
  185.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Toolbar_Style); 
  186.    function Unchecked_To_Gtk_Scroll_Step 
  187.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Enums.Gtk_Scroll_Step); 
  188.    function Unchecked_To_Gtk_Response_Type 
  189.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.Dialog.Gtk_Response_Type); 
  190.    function Unchecked_To_Gtk_Print_Operation_Result 
  191.      is new Glib.Values.Unsafe_Enum_Nth 
  192.         (Gtk.Print_Operation.Gtk_Print_Operation_Result); 
  193.    function Unchecked_To_Gdk_Modifier_Type 
  194.      is new Glib.Values.Unsafe_Enum_Nth (Gdk.Types.Gdk_Modifier_Type); 
  195.    function Unchecked_To_Gtk_Entry_Icon_Position 
  196.      is new Glib.Values.Unsafe_Enum_Nth (Gtk.GEntry.Gtk_Entry_Icon_Position); 
  197.    function Unchecked_To_Gtk_Text_Iter 
  198.      is new Glib.Values.Unsafe_Proxy_Nth (Gtk.Text_Iter.Gtk_Text_Iter); 
  199.    function Unchecked_To_Gtk_Tree_Iter 
  200.      is new Glib.Values.Unsafe_Proxy_Nth (Gtk.Tree_Model.Gtk_Tree_Iter); 
  201.    function Unchecked_To_Gtk_Tree_Model 
  202.      is new Glib.Values.Unsafe_Proxy_Nth (Gtk.Tree_Model.Gtk_Tree_Model); 
  203.    function Unchecked_To_Param_Spec 
  204.      is new Glib.Values.Unsafe_Proxy_Nth (Glib.Param_Spec); 
  205.    function Unchecked_To_Cairo_Context 
  206.      (Args : Glib.Values.C_GValues; Num : Guint) 
  207.      return Cairo.Cairo_Context; 
  208.    function Unchecked_To_Cairo_Rectangle_Int_Access 
  209.      (Args : Glib.Values.C_GValues; Num : Guint) 
  210.      return access Cairo.Region.Cairo_Rectangle_Int; 
  211.    function Unchecked_To_Cairo_Rectangle_Int 
  212.      (Args : Glib.Values.C_GValues; Num : Guint) 
  213.      return Cairo.Region.Cairo_Rectangle_Int; 
  214.    pragma Inline (Unchecked_To_Object); 
  215.    pragma Inline (Unchecked_To_Boolean); 
  216.    pragma Inline (Unchecked_To_Gint); 
  217.    pragma Inline (Unchecked_To_Guint); 
  218.    pragma Inline (Unchecked_To_UTF8_String); 
  219.    --  Return the num-value (starting at 0) in Args. 
  220.    --  These functions are unsafe and do not check that Args contains at least 
  221.    --  Num values. 
  222.    --  The names are directly the ones needed by gtk+ as described in its GIR 
  223.    --  files, and as generated automatically by GtkAda. 
  224.  
  225. private 
  226.    pragma Inline (To_Gint); 
  227.    pragma Inline (To_Guint); 
  228.    pragma Inline (To_Boolean); 
  229.    pragma Inline (To_Object); 
  230.    pragma Inline (To_Event); 
  231.    pragma Inline (To_String); 
  232.  
  233.    --  </doc_ignore> 
  234. end Gtk.Arguments;