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. --  This package provides a set of generic packages to easily create 
  32. --  some Marshallers. Although this package has been designed to be 
  33. --  easily reusable, its primary aim is to simplify the use of callbacks. 
  34. -- 
  35. --  Note that most users don't need to understand or even look at this 
  36. --  package, since the main functions are also renamed in the Gtk.Handlers 
  37. --  package (They are called To_Marshaller). This package is rather 
  38. --  complex (generic packages inside generic packages), and thus you should 
  39. --  understand correctly how Gtk.Handlers work before looking at this one. 
  40. -- 
  41. --  To understand the paradigm used in this package, some definitions 
  42. --  are necessary: 
  43. -- 
  44. --     A Handler, or Callback, is a subprogram provided by the user. 
  45. --     This handler, when attached to a particular object, will be 
  46. --     called when certain events happen during the life of this 
  47. --     object. All handlers take as a first argument an access to 
  48. --     the object they were attached to. Depending on the signal, this 
  49. --     handler can also have some extra parameters; most of the time, 
  50. --     only one extra parameter will be used. For more information about 
  51. --     Handlers, refer to the package Gtk.Handlers, where this notion is 
  52. --     explained in more details. 
  53. -- 
  54. --     A General_Handler is an access to any Handler. Note that this is 
  55. --     a type used internally, most users should *not* be using it. It is 
  56. --     publicly declared so that users can create new marshallers that 
  57. --     would not be already provided here. 
  58. -- 
  59. --     A Handler_Proxy is a subprogram that calls its associated 
  60. --     handler with the appropriate arguments (from an array of arguments 
  61. --     stored in Glib.Values.GValues) 
  62. -- 
  63. --     A Marshaller is the association of a General_Handler and a 
  64. --     Handler_Proxy. 
  65. -- 
  66. --  This package is divided in four generic packages. Each package has 
  67. --  been designed to cover a certain kind of callback by providing the 
  68. --  associated marshallers. There are two primary factors that describe 
  69. --  a callback, and that decide which marshaller to use: Does the 
  70. --  callback have access to some user data?  Does the callback return 
  71. --  some value? 
  72. -- 
  73. --  Depending on that, the appropriate generic package should be chosen. 
  74. --  For example, if the callback returns a value, but does not expect 
  75. --  user data, then the "Return_Marshallers" package should be used. 
  76. --  More details about the usage of each package is provided individually 
  77. --  below. 
  78. -- 
  79. --  Each of these packages is in turn divided into three generic 
  80. --  sub-packages.  The organization of these subpackages is always the 
  81. --  same : 
  82. --     o The type "Handler" is defined. It describes the profile of the 
  83. --       Handler covered in this generic package. 
  84. --     o a "To_Marshaller" function is provided to build a Marshaller 
  85. --       from any Handler. 
  86. --     o A "Emit_By_Name" procedure is also provided to allow the user 
  87. --       to "emit" a signal. This service is explained in more details in 
  88. --       Gtk.Handlers. 
  89. --     o A private function "Call" is also defined. This is the actual 
  90. --       Handler_Proxy that will be used when creating Marshallers with 
  91. --       the "To_Marshaller" service. 
  92. -- 
  93. --  Once again, selecting the right generic sub-package depends on the 
  94. --  callback. For instance, the first sub-package, always called 
  95. --  "Generic_Marshaller", is to be used when the handler has one extra 
  96. --  argument which is a simple non-tagged type. More details about the 
  97. --  usage of each sub-package is also provided individually. 
  98. -- 
  99. --  Although most of the cases are covered by the packages below, some 
  100. --  unusual cases may appear. This is the case for example when the 
  101. --  callback accepts several extra parameters. In such cases, two options 
  102. --  are available: The first option is to use the "standard" callback 
  103. --  mechanism with one parameter, this parameter being an array of 
  104. --  arguments that you will parse yourself. The second option is to 
  105. --  create a new Marshaller package. This is more interesting if more 
  106. --  than one callback will follow the same pattern. The body of this 
  107. --  package can be used as a good model to build such new marshallers. 
  108. --  See also the example in the GtkAda distribution for how to create your 
  109. --  own marshallers. 
  110. -- 
  111. --  </description> 
  112. --  <group>Signal handling</group> 
  113. --  <c_version>2.8.17</c_version> 
  114.  
  115. with Glib.Object; 
  116. with Gtk.Widget; 
  117. with Glib.Values; 
  118.  
  119. package Gtk.Marshallers is 
  120.  
  121.    --  <doc_ignore>Do not create automatic documentation for this package 
  122.  
  123.    type General_Handler is access procedure; 
  124.  
  125.    -------------------------------------------------------------- 
  126.    --  Return Marshallers: Return a value, don't have user data 
  127.    -------------------------------------------------------------- 
  128.  
  129.    generic 
  130.       type Widget_Type is new Glib.Object.GObject_Record with private; 
  131.       type Return_Type is (<>); 
  132.    package Return_Marshallers is 
  133.  
  134.       type Handler_Proxy is access function 
  135.         (Widget  : access Widget_Type'Class; 
  136.          Params  : Glib.Values.GValues; 
  137.          Cb      : General_Handler) return Return_Type; 
  138.  
  139.       type Marshaller is record 
  140.          Func  : General_Handler;   --  User callback 
  141.          Proxy : Handler_Proxy;     --  Handler_Proxy for this callback 
  142.       end record; 
  143.  
  144.       --  Basic Marshaller 
  145.       generic 
  146.          type Base_Type is private; 
  147.          with function Conversion 
  148.            (Value : Glib.Values.GValue) return Base_Type; 
  149.  
  150.       package Generic_Marshaller is 
  151.          type Handler is access function 
  152.            (Widget : access Widget_Type'Class; 
  153.             Param  : Base_Type) return Return_Type; 
  154.  
  155.          function To_Marshaller (Cb : Handler) return Marshaller; 
  156.  
  157.          function Emit_By_Name 
  158.            (Object : access Widget_Type'Class; 
  159.             Name   : Glib.Signal_Name; 
  160.             Param  : Base_Type) return Return_Type; 
  161.          --  The function above should be used when Base_Type can be passed 
  162.          --  as is to C. 
  163.  
  164.          generic 
  165.             with function Conversion (Param : Base_Type) return System.Address; 
  166.          function Emit_By_Name_Generic 
  167.            (Object : access Widget_Type'Class; 
  168.             Name   : Glib.Signal_Name; 
  169.             Param  : Base_Type) return Return_Type; 
  170.          --  Provide an explicit conversion function for PARAM. 
  171.  
  172.       private 
  173.          function Call 
  174.            (Widget : access Widget_Type'Class; 
  175.             Params : Glib.Values.GValues; 
  176.             Cb     : General_Handler) return Return_Type; 
  177.  
  178.          Call_Access : constant Handler_Proxy := Call'Access; 
  179.       end Generic_Marshaller; 
  180.  
  181.       --  Widget Marshaller 
  182.       generic 
  183.          type Base_Type is new Gtk.Widget.Gtk_Widget_Record with private; 
  184.          type Access_Type is access all Base_Type'Class; 
  185.       package Generic_Widget_Marshaller is 
  186.          type Handler is access function 
  187.            (Widget : access Widget_Type'Class; 
  188.             Param  : access Base_Type'Class) return Return_Type; 
  189.  
  190.          function To_Marshaller (Cb : Handler) return Marshaller; 
  191.  
  192.          function Emit_By_Name 
  193.            (Object : access Widget_Type'Class; 
  194.             Name   : Glib.Signal_Name; 
  195.             Param  : access Base_Type'Class) return Return_Type; 
  196.  
  197.       private 
  198.          function Call 
  199.            (Widget : access Widget_Type'Class; 
  200.             Params : Glib.Values.GValues; 
  201.             Cb     : General_Handler) return Return_Type; 
  202.  
  203.          Call_Access : constant Handler_Proxy := Call'Access; 
  204.       end Generic_Widget_Marshaller; 
  205.  
  206.       --  Void Marshaller 
  207.       package Void_Marshaller is 
  208.          type Handler is access function 
  209.            (Widget : access Widget_Type'Class) return Return_Type; 
  210.  
  211.          function To_Marshaller (Cb : Handler) return Marshaller; 
  212.  
  213.          function Emit_By_Name 
  214.            (Object : access Widget_Type'Class; 
  215.             Name   : Glib.Signal_Name) return Return_Type; 
  216.  
  217.       private 
  218.          function Call 
  219.            (Widget : access Widget_Type'Class; 
  220.             Params : Glib.Values.GValues; 
  221.             Cb     : General_Handler) return Return_Type; 
  222.  
  223.          Call_Access : constant Handler_Proxy := Call'Access; 
  224.       end Void_Marshaller; 
  225.    end Return_Marshallers; 
  226.  
  227.    -------------------------------------------------------------- 
  228.    --  User_Return_Marshallers: Return a value, have a user data 
  229.    -------------------------------------------------------------- 
  230.  
  231.    generic 
  232.       type Widget_Type is new Glib.Object.GObject_Record with private; 
  233.       type Return_Type is (<>); 
  234.       type User_Type (<>) is private; 
  235.    package User_Return_Marshallers is 
  236.  
  237.       type Handler_Proxy is access function 
  238.         (Widget    : access Widget_Type'Class; 
  239.          Params    : Glib.Values.GValues; 
  240.          Cb        : General_Handler; 
  241.          User_Data : User_Type) return Return_Type; 
  242.  
  243.       type Marshaller is record 
  244.          Func  : General_Handler; 
  245.          Proxy : Handler_Proxy; 
  246.       end record; 
  247.  
  248.       --  Basic Marshaller 
  249.       generic 
  250.          type Base_Type is private; 
  251.          with function Conversion 
  252.            (Value : Glib.Values.GValue) return Base_Type; 
  253.  
  254.       package Generic_Marshaller is 
  255.          type Handler is access function 
  256.            (Widget    : access Widget_Type'Class; 
  257.             Param     : Base_Type; 
  258.             User_Data : User_Type) return Return_Type; 
  259.          function To_Marshaller (Cb : Handler) return Marshaller; 
  260.  
  261.          function Emit_By_Name 
  262.            (Object : access Widget_Type'Class; 
  263.             Name   : Glib.Signal_Name; 
  264.             Param  : Base_Type) return Return_Type; 
  265.          --  The function above should be used when BASE_TYPE can be passed 
  266.          --  as is to C. 
  267.  
  268.          generic 
  269.             with function Conversion (Param : Base_Type) return System.Address; 
  270.          function Emit_By_Name_Generic 
  271.            (Object : access Widget_Type'Class; 
  272.             Name   : Glib.Signal_Name; 
  273.             Param  : Base_Type) return Return_Type; 
  274.          --  Provide an explicit conversion function for PARAM. 
  275.       private 
  276.          function Call 
  277.            (Widget    : access Widget_Type'Class; 
  278.             Params    : Glib.Values.GValues; 
  279.             Cb        : General_Handler; 
  280.             User_Data : User_Type) return Return_Type; 
  281.  
  282.          Call_Access : constant Handler_Proxy := Call'Access; 
  283.       end Generic_Marshaller; 
  284.  
  285.       --  Widget Marshaller 
  286.       generic 
  287.          type Base_Type is new Gtk.Widget.Gtk_Widget_Record with private; 
  288.          type Access_Type is access all Base_Type'Class; 
  289.       package Generic_Widget_Marshaller is 
  290.          type Handler is access function 
  291.            (Widget    : access Widget_Type'Class; 
  292.             Param     : access Base_Type'Class; 
  293.             User_Data : User_Type) return Return_Type; 
  294.  
  295.          function To_Marshaller (Cb : Handler) return Marshaller; 
  296.  
  297.          function Emit_By_Name 
  298.            (Object : access Widget_Type'Class; 
  299.             Name   : Glib.Signal_Name; 
  300.             Param  : access Base_Type'Class) return Return_Type; 
  301.  
  302.       private 
  303.          function Call 
  304.            (Widget    : access Widget_Type'Class; 
  305.             Params    : Glib.Values.GValues; 
  306.             Cb        : General_Handler; 
  307.             User_Data : User_Type) return Return_Type; 
  308.  
  309.          Call_Access : constant Handler_Proxy := Call'Access; 
  310.       end Generic_Widget_Marshaller; 
  311.  
  312.       --  Void Marshaller 
  313.       package Void_Marshaller is 
  314.          type Handler is access function 
  315.            (Widget    : access Widget_Type'Class; 
  316.             User_Data : User_Type) return Return_Type; 
  317.  
  318.          function To_Marshaller (Cb : Handler) return Marshaller; 
  319.  
  320.          function Emit_By_Name 
  321.            (Object : access Widget_Type'Class; 
  322.             Name   : Glib.Signal_Name) return Return_Type; 
  323.  
  324.       private 
  325.          function Call 
  326.            (Widget    : access Widget_Type'Class; 
  327.             Params    : Glib.Values.GValues; 
  328.             Cb        : General_Handler; 
  329.             User_Data : User_Type) return Return_Type; 
  330.  
  331.          Call_Access : constant Handler_Proxy := Call'Access; 
  332.       end Void_Marshaller; 
  333.  
  334.    end User_Return_Marshallers; 
  335.  
  336.    ----------------- 
  337.    --  Callback_Marshallers: Do not return a value, no user data 
  338.    ----------------- 
  339.  
  340.    generic 
  341.       type Widget_Type is new Glib.Object.GObject_Record with private; 
  342.    package Void_Marshallers is 
  343.  
  344.       type Handler_Proxy is access procedure 
  345.         (Widget : access Widget_Type'Class; 
  346.          Params : Glib.Values.GValues; 
  347.          Cb     : General_Handler); 
  348.  
  349.       type Marshaller is record 
  350.          Func  : General_Handler; 
  351.          Proxy : Handler_Proxy; 
  352.       end record; 
  353.  
  354.       --  Basic Marshaller 
  355.       generic 
  356.          type Base_Type is private; 
  357.          with function Conversion 
  358.            (Value : Glib.Values.GValue) return Base_Type; 
  359.  
  360.       package Generic_Marshaller is 
  361.          type Handler is access procedure 
  362.            (Widget : access Widget_Type'Class; 
  363.             Param  : Base_Type); 
  364.  
  365.          function To_Marshaller (Cb : Handler) return Marshaller; 
  366.  
  367.          procedure Emit_By_Name 
  368.            (Object : access Widget_Type'Class; 
  369.             Name   : Glib.Signal_Name; 
  370.             Param  : Base_Type); 
  371.          --  The function above should be used when BASE_TYPE can be passed 
  372.          --  as is to C. 
  373.  
  374.          generic 
  375.             with function Conversion (Param : Base_Type) return System.Address; 
  376.          procedure Emit_By_Name_Generic 
  377.            (Object : access Widget_Type'Class; 
  378.             Name   : Glib.Signal_Name; 
  379.             Param  : Base_Type); 
  380.          --  Provide an explicit conversion function for PARAM. 
  381.  
  382.       private 
  383.          procedure Call 
  384.            (Widget : access Widget_Type'Class; 
  385.             Params : Glib.Values.GValues; 
  386.             Cb     : General_Handler); 
  387.  
  388.          Call_Access : constant Handler_Proxy := Call'Access; 
  389.       end Generic_Marshaller; 
  390.  
  391.       generic 
  392.          type Base_Type_1 is private; 
  393.          with function Conversion 
  394.            (Value : Glib.Values.GValue) return Base_Type_1; 
  395.          type Base_Type_2 is private; 
  396.          with function Conversion 
  397.            (Value : Glib.Values.GValue) return Base_Type_2; 
  398.  
  399.       package Generic_Marshaller_2 is 
  400.          type Handler is access procedure 
  401.            (Widget  : access Widget_Type'Class; 
  402.             Param_1 : Base_Type_1; 
  403.             Param_2 : Base_Type_2); 
  404.  
  405.          function To_Marshaller (Cb : Handler) return Marshaller; 
  406.  
  407.          procedure Emit_By_Name 
  408.            (Object  : access Widget_Type'Class; 
  409.             Name    : Glib.Signal_Name; 
  410.             Param_1 : Base_Type_1; 
  411.             Param_2 : Base_Type_2); 
  412.          --  The function above should be used when BASE_TYPE can be passed 
  413.          --  as is to C. 
  414.  
  415.          generic 
  416.             with function Conversion 
  417.                             (Param : Base_Type_1) return System.Address; 
  418.             with function Conversion 
  419.                             (Param : Base_Type_2) return System.Address; 
  420.          procedure Emit_By_Name_Generic 
  421.            (Object  : access Widget_Type'Class; 
  422.             Name    : Glib.Signal_Name; 
  423.             Param_1 : Base_Type_1; 
  424.             Param_2 : Base_Type_2); 
  425.          --  Provide an explicit conversion function for PARAM. 
  426.  
  427.       private 
  428.          procedure Call 
  429.            (Widget : access Widget_Type'Class; 
  430.             Params : Glib.Values.GValues; 
  431.             Cb     : General_Handler); 
  432.  
  433.          Call_Access : constant Handler_Proxy := Call'Access; 
  434.       end Generic_Marshaller_2; 
  435.  
  436.       --  Widget Marshaller 
  437.       generic 
  438.          type Base_Type is new Gtk.Widget.Gtk_Widget_Record with private; 
  439.          type Access_Type is access all Base_Type'Class; 
  440.       package Generic_Widget_Marshaller is 
  441.          type Handler is access procedure 
  442.            (Widget : access Widget_Type'Class; 
  443.             Param  : access Base_Type'Class); 
  444.  
  445.          function To_Marshaller (Cb : Handler) return Marshaller; 
  446.  
  447.          procedure Emit_By_Name 
  448.            (Object : access Widget_Type'Class; 
  449.             Name   : Glib.Signal_Name; 
  450.             Param  : access Base_Type'Class); 
  451.  
  452.       private 
  453.          procedure Call 
  454.            (Widget : access Widget_Type'Class; 
  455.             Params : Glib.Values.GValues; 
  456.             Cb     : General_Handler); 
  457.  
  458.          Call_Access : constant Handler_Proxy := Call'Access; 
  459.       end Generic_Widget_Marshaller; 
  460.  
  461.       --  Void Marshaller 
  462.       package Void_Marshaller is 
  463.          type Handler is access procedure (Widget : access Widget_Type'Class); 
  464.  
  465.          function To_Marshaller (Cb : Handler) return Marshaller; 
  466.  
  467.          procedure Emit_By_Name 
  468.            (Object : access Widget_Type'Class; 
  469.             Name   : Glib.Signal_Name); 
  470.  
  471.       private 
  472.          procedure Call 
  473.            (Widget : access Widget_Type'Class; 
  474.             Params : Glib.Values.GValues; 
  475.             Cb     : General_Handler); 
  476.  
  477.          Call_Access : constant Handler_Proxy := Call'Access; 
  478.       end Void_Marshaller; 
  479.  
  480.    end Void_Marshallers; 
  481.  
  482.    ---------------------------------------------------------------------- 
  483.    --  User_Callback_Marshallers: Do not return a value, have user data 
  484.    ---------------------------------------------------------------------- 
  485.  
  486.    generic 
  487.       type Widget_Type is new Glib.Object.GObject_Record with private; 
  488.       type User_Type (<>) is private; 
  489.    package User_Void_Marshallers is 
  490.       type Handler_Proxy is access procedure 
  491.         (Widget    : access Widget_Type'Class; 
  492.          Params    : Glib.Values.GValues; 
  493.          Cb        : General_Handler; 
  494.          User_Data : User_Type); 
  495.  
  496.       type Marshaller is record 
  497.          Func  : General_Handler; 
  498.          Proxy : Handler_Proxy; 
  499.       end record; 
  500.  
  501.       --  Basic Marshaller 
  502.       generic 
  503.          type Base_Type is private; 
  504.          with function Conversion 
  505.            (Value : Glib.Values.GValue) return Base_Type; 
  506.  
  507.       package Generic_Marshaller is 
  508.          type Handler is access procedure 
  509.            (Widget    : access Widget_Type'Class; 
  510.             Param     : Base_Type; 
  511.             User_Data : User_Type); 
  512.  
  513.          function To_Marshaller (Cb : Handler) return Marshaller; 
  514.  
  515.          procedure Emit_By_Name 
  516.            (Object : access Widget_Type'Class; 
  517.             Name   : Glib.Signal_Name; 
  518.             Param  : Base_Type); 
  519.          --  The function above should be used when BASE_TYPE can be passed 
  520.          --  as is to C. 
  521.  
  522.          generic 
  523.             with function Conversion (Param : Base_Type) return System.Address; 
  524.          procedure Emit_By_Name_Generic 
  525.            (Object : access Widget_Type'Class; 
  526.             Name   : Glib.Signal_Name; 
  527.             Param  : Base_Type); 
  528.          --  Provide an explicit conversion function for PARAM. 
  529.  
  530.       private 
  531.          procedure Call 
  532.            (Widget    : access Widget_Type'Class; 
  533.             Params    : Glib.Values.GValues; 
  534.             Cb        : General_Handler; 
  535.             User_Data : User_Type); 
  536.  
  537.          Call_Access : constant Handler_Proxy := Call'Access; 
  538.       end Generic_Marshaller; 
  539.  
  540.       generic 
  541.          type Base_Type_1 is private; 
  542.          with function Conversion 
  543.            (Value : Glib.Values.GValue) return Base_Type_1; 
  544.          type Base_Type_2 is private; 
  545.          with function Conversion 
  546.            (Value : Glib.Values.GValue) return Base_Type_2; 
  547.  
  548.       package Generic_Marshaller_2 is 
  549.  
  550.          type Handler is access procedure 
  551.            (Widget    : access Widget_Type'Class; 
  552.             Param_1   : Base_Type_1; 
  553.             Param_2   : Base_Type_2; 
  554.             User_Data : User_Type); 
  555.  
  556.          function To_Marshaller (Cb : Handler) return Marshaller; 
  557.  
  558.          procedure Emit_By_Name 
  559.            (Object  : access Widget_Type'Class; 
  560.             Name    : Glib.Signal_Name; 
  561.             Param_1 : Base_Type_1; 
  562.             Param_2 : Base_Type_2); 
  563.          --  The function above should be used when BASE_TYPE can be passed 
  564.          --  as is to C. 
  565.  
  566.          generic 
  567.             with function Conversion 
  568.                             (Param : Base_Type_1) return System.Address; 
  569.             with function Conversion 
  570.                             (Param : Base_Type_2) return System.Address; 
  571.          procedure Emit_By_Name_Generic 
  572.            (Object  : access Widget_Type'Class; 
  573.             Name    : Glib.Signal_Name; 
  574.             Param_1 : Base_Type_1; 
  575.             Param_2 : Base_Type_2); 
  576.          --  Provide an explicit conversion function for PARAM. 
  577.  
  578.       private 
  579.          procedure Call 
  580.            (Widget    : access Widget_Type'Class; 
  581.             Params    : Glib.Values.GValues; 
  582.             Cb        : General_Handler; 
  583.             User_Data : User_Type); 
  584.  
  585.          Call_Access : constant Handler_Proxy := Call'Access; 
  586.       end Generic_Marshaller_2; 
  587.  
  588.       --  Widget Marshaller 
  589.       generic 
  590.          type Base_Type is new Gtk.Widget.Gtk_Widget_Record with private; 
  591.          type Access_Type is access all Base_Type'Class; 
  592.       package Generic_Widget_Marshaller is 
  593.          type Handler is access procedure 
  594.            (Widget    : access Widget_Type'Class; 
  595.             Param     : access Base_Type'Class; 
  596.             User_Data : User_Type); 
  597.  
  598.          function To_Marshaller (Cb : Handler) return Marshaller; 
  599.  
  600.          procedure Emit_By_Name 
  601.            (Object : access Widget_Type'Class; 
  602.             Name   : Glib.Signal_Name; 
  603.             Param  : access Base_Type'Class); 
  604.  
  605.       private 
  606.          procedure Call 
  607.            (Widget    : access Widget_Type'Class; 
  608.             Params    : Glib.Values.GValues; 
  609.             Cb        : General_Handler; 
  610.             User_Data : User_Type); 
  611.  
  612.          Call_Access : constant Handler_Proxy := Call'Access; 
  613.       end Generic_Widget_Marshaller; 
  614.  
  615.       --  Void Marshaller 
  616.       package Void_Marshaller is 
  617.          type Handler is access procedure 
  618.            (Widget    : access Widget_Type'Class; 
  619.             User_Data : User_Type); 
  620.  
  621.          function To_Marshaller (Cb : Handler) return Marshaller; 
  622.  
  623.          procedure Emit_By_Name 
  624.            (Object : access Widget_Type'Class; 
  625.             Name   : Glib.Signal_Name); 
  626.  
  627.       private 
  628.          procedure Call 
  629.            (Widget    : access Widget_Type'Class; 
  630.             Params    : Glib.Values.GValues; 
  631.             Cb        : General_Handler; 
  632.             User_Data : User_Type); 
  633.  
  634.          Call_Access : constant Handler_Proxy := Call'Access; 
  635.       end Void_Marshaller; 
  636.  
  637.    end User_Void_Marshallers; 
  638.  
  639.    --  </doc_ignore> 
  640. end Gtk.Marshallers;