summaryrefslogtreecommitdiff
path: root/src/lib/edje/efl_layout_signal.eo
blob: 708dc3279a52e6468fd95992d2646cf736bde0d2 (plain) (blame)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
  Edje signaling interface.

  Note: This API must be manually bound in other languages as this uses function
  pointers! This is by design, to keep the API simplhe API simple.

  If function pointers really become allowed in EO this needs to be altered to
  match that.
*/

type Efl.Signal_Cb: __undefined_type; [[Signal callback.]]

interface Efl.Layout.Signal
{
   [[Layouts asynchronous messaging and signaling interface.

     @since 1.21
   ]]
   methods {
      // FIXME: There is no message_handler in EO!
      message_send {
         [[Sends an (Edje) message to a given Edje object

           This function sends an Edje message to obj and to all of its child
           objects, if it has any (swallowed objects are one kind of child
           object). Only a few types are supported:
             - int,
             - float/double,
             - string/stringshare,
             - arrays of int, float, double or strings.

           Messages can go both ways, from code to theme, or theme to code.

           The id argument as a form of code and theme defining a common
           interface on message communication. One should define the same IDs on
           both code and EDC declaration, to individualize messages (binding
           them to a given context).
         ]]
         params {
            @in id: int; [[A identification number for the message to be sent]]
            @in msg: const(any_value); [[The message's payload]]
         }
      }
      signal_callback_add {
         [[Adds a callback for an arriving Edje signal, emitted by
           a given Edje object.

           Edje signals are one of the communication interfaces between code and
           a given Edje object's theme. With signals, one can communicate two
           string values at a time, which are:
           - "emission" value: the name of the signal, in general
           - "source" value: a name for the signal's context, in general

           Signals can go both ways, from code to theme, or theme to code.

           Though there are those common uses for the two strings, one is free
           to use them however they like.

           Signal callback registration is powerful, in the way that blobs may
           be used to match multiple signals at once. All the "*?[\" set of
           $fnmatch() operators can be used, both for emission and source.

           Edje has internal signals it will emit, automatically, on various
           actions taking place on group parts. For example, the mouse cursor
           being moved, pressed, released, etc., over a given part's area, all
           generate individual signals.

           With something like emission = "mouse,down,*", source = "button.*"
           where "button.*" is the pattern for the names of parts implementing
           buttons on an interface, you'd be registering for notifications on
           events of mouse buttons being pressed down on either of those parts
           (those events all have the "mouse,down," common prefix on their
           names, with a suffix giving the button number). The actual emission
           and source strings of an event will be passed in as the emission and
           source parameters of the callback function (e.g. "mouse,down,2" and
           "button.close"), for each of those events.

           See also the Edje Data Collection Reference for EDC files.

           See @.signal_emit on how to emit signals from code to a an object
           See @.signal_callback_del.
         ]]
         params {
            @in emission: string; [[The signal's "emission" string]]
            @in source: string; [[The signal's "source" string]]
            @in func: Efl.Signal_Cb;
               [[The callback function to be executed when the signal is emitted.]]
            @in data: void_ptr; [[A pointer to data to pass to $func.]]
         }
         return: bool; [[$true in case of success, $false in case of error.]]
      }
      signal_callback_del {
         [[Removes a signal-triggered callback from an object.

           This function removes a callback, previously attached to the emission
           of a signal, from the object  obj. The parameters emission, source
           and func must match exactly those passed to a previous call to
           @.signal_callback_add().

           See @.signal_callback_add.
         ]]
         params {
            @in emission: string; [[The signal's "emission" string]]
            @in source: string; [[The signal's "source" string]]
            @in func: Efl.Signal_Cb;
               [[The callback function to be executed when the signal is emitted.]]
            @in data: void_ptr; [[A pointer to data to pass to $func.]]
         }
         return: bool; [[$true in case of success, $false in case of error.]]
      }
      signal_emit {
         [[Sends/emits an Edje signal to this layout.

           This function sends a signal to the object. An Edje program, at the
           EDC specification level, can respond to a signal by having declared
           matching "signal" and "source" fields on its block.

           See also the Edje Data Collection Reference for EDC files.

           See @.signal_callback_add() for more on Edje signals.
         ]]
         params {
            @in emission: string; [[The signal's "emission" string]]
            @in source: string; [[The signal's "source" string]]
         }
      }
      signal_process {
         [[Processes an object's messages and signals queue.

           This function goes through the object message queue processing the
           pending messages for this specific Edje object. Normally they'd be
           processed only at idle time.

           If $recurse is $true, this function will be called recursively on all
           subobjects.
         ]]
         // FIXME: Should be $true by default!
         params {
            recurse: bool @optional; [[Whether to process messages on children
                                       objects.]]
         }
      }
   }
}