File: own_marshaller.adb

package info (click to toggle)
libgtkada 2.24.4dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,208 kB
  • ctags: 1,676
  • sloc: ada: 119,686; ansic: 4,719; sh: 3,003; makefile: 690; xml: 338; perl: 70
file content (79 lines) | stat: -rw-r--r-- 2,508 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

with Gtk.Marshallers;  use Gtk.Marshallers;
with Unchecked_Conversion;

package body Own_Marshaller is

   ---------------------
   -- My_General_Tips --
   ---------------------

   procedure My_General_Tips (Tips   : access Gtk_Tips_Query_Record'Class;
                              Params : Gtk.Arguments.Gtk_Args)
   is
      --  Have to do the conversion by hand
      Widget : Gtk_Widget := Gtk_Widget (Gtk.Arguments.To_Object (Params, 1));
      Text   : String     := Gtk.Arguments.To_String (Params, 2);
      Tips_P : String     := Gtk.Arguments.To_String (Params, 3);

   begin
      null;  --  Whatever you want here
   end My_General_Tips;


   ----------------------
   -- My_Specific_Tips --
   ----------------------

   procedure My_Specific_Tips (Tips   : access Gtk_Tips_Query_Record'Class;
                               Widget : access Gtk_Widget_Record'Class;
                               Text   : String;
                               Tips_P : String)
   is
   begin
      null;  --  Whatever you want here
   end My_Specific_Tips;

   ----------------------------
   -- My_Tips_Marshaller_Pkg --
   ----------------------------

   package body My_Tips_Marshaller_Pkg is

      function To_Handler is new Unchecked_Conversion
        (Gtk.Marshallers.General_Handler, Handler);
      function To_General_Handler is new Unchecked_Conversion
        (Handler, Gtk.Marshallers.General_Handler);

      ------------------------
      -- My_Tips_Marshaller --
      ------------------------

      procedure My_Tips_Marshaller (Tips   : access Gtk_Tips_Query_Record'Class;
                                    Params : Gtk.Arguments.Gtk_Args;
                                    Cb     : Gtk.Marshallers.General_Handler)
      is
         My_Cb : Handler := To_Handler (Cb);
      begin
         --  Basically, we do the same thing as in My_General_Tips above
         My_Cb (Tips,
                Gtk_Widget (Gtk.Arguments.To_Object (Params, 1)),
                Gtk.Arguments.To_String (Params, 2),
                Gtk.Arguments.To_String (Params, 3));
      end My_Tips_Marshaller;

      -------------------
      -- To_Marshaller --
      -------------------

      function To_Marshaller (Cb : Handler)
                             return Tips_Handlers.Marshallers.Marshaller
      is
      begin
         return (Func  => To_General_Handler (Cb),
                 Proxy => My_Tips_Marshaller'Access);
      end To_Marshaller;

   end My_Tips_Marshaller_Pkg;

end Own_Marshaller;