summaryrefslogtreecommitdiff
path: root/efl/evas/efl.evas_canvas_callbacks.pxi
blob: 0dabaf4a4640d415e835e6c372696084c08e8a07 (plain)
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Copyright (C) 2007-2016 various contributors (see AUTHORS)
#
# This file is part of Python-EFL.
#
# Python-EFL is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Python-EFL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.

import traceback

cdef int cb_canvas_dispatcher(Canvas self, event, int type) except 0:
    # iterate over copy since users may delete callback from callback
    lst = tuple(self._event_callbacks[type])
    for func, args, kargs in lst:
        try:
            func(self, event, *args, **kargs)
        except Exception:
            traceback.print_exc()
    return 1


cdef int cb_canvas_dispatcher2(Canvas self, int type) except 0:
    # iterate over copy since users may delete callback from callback
    lst = tuple(self._event_callbacks[type])
    for func, args, kargs in lst:
        try:
            func(self, *args, **kargs)
        except Exception:
            traceback.print_exc()
    return 1


cdef void cb_canvas_mouse_in(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_IN is not supported by canvas.")

cdef void cb_canvas_mouse_out(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_OUT is not supported by canvas.")

cdef void cb_canvas_mouse_down(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_DOWN is not supported by canvas.")

cdef void cb_canvas_mouse_up(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_UP is not supported by canvas.")

cdef void cb_canvas_mouse_move(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_MOVE is not supported by canvas.")

cdef void cb_canvas_multi_down(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MULTI_DOWN is not supported by canvas.")

cdef void cb_canvas_multi_up(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MULTI_UP is not supported by canvas.")

cdef void cb_canvas_multi_move(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MULTI_MOVE is not supported by canvas.")

cdef void cb_canvas_mouse_wheel(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOUSE_WHEEL is not supported by canvas.")

cdef void cb_canvas_free(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_FREE is not supported by canvas.")

cdef void cb_canvas_key_down(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_KEY_DOWN is not supported by canvas.")

cdef void cb_canvas_key_up(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_KEY_UP is not supported by canvas.")

cdef void cb_canvas_focus_in(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_FOCUS_IN is not supported by canvas.")

cdef void cb_canvas_focus_out(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_FOCUS_OUT is not supported by canvas.")

cdef void cb_canvas_show(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_SHOW is not supported by canvas.")

cdef void cb_canvas_hide(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_HIDE is not supported by canvas.")

cdef void cb_canvas_move(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_MOVE is not supported by canvas.")

cdef void cb_canvas_resize(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_RESIZE is not supported by canvas.")

cdef void cb_canvas_restack(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_RESTACK is not supported by canvas.")

cdef void cb_canvas_del(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_DEL is not supported by canvas.")

cdef void cb_canvas_hold(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_HOLD is not supported by canvas.")

cdef void cb_canvas_changed_size_hints(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_CHANGED_SIZE_HINTS is not supported by canvas.")

cdef void cb_canvas_image_preloaded(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_IMAGE_PRELOADED is not supported by canvas.")

cdef void cb_canvas_image_resize(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_IMAGE_RESIZE is not supported by canvas.")

cdef void cb_canvas_device_changed(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_DEVICE_CHANGED is not supported by canvas.")

cdef void cb_canvas_canvas_focus_in(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_CANVAS_FOCUS_IN)


cdef void cb_canvas_canvas_focus_out(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_CANVAS_FOCUS_OUT)


cdef void cb_canvas_render_flush_pre(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_FLUSH_PRE)


cdef void cb_canvas_render_flush_post(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_FLUSH_POST)


cdef void cb_canvas_canvas_object_focus_in(void *data, Evas *e, void *e_inf) with gil:
    cdef Evas_Object *obj = <Evas_Object*>e_inf
    o = object_from_instance(obj)
    cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN)


cdef void cb_canvas_canvas_object_focus_out(void *data, Evas *e, void *e_inf) with gil:
    cdef Evas_Object *obj = <Evas_Object*>e_inf
    o = object_from_instance(obj)
    cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT)


cdef void cb_canvas_image_unloaded(void *data, Evas *e, void *e_inf) with gil:
    print("EVAS_CALLBACK_IMAGE_UNLOADED is not supported by canvas.")

cdef void cb_canvas_render_pre(void *data, Evas *e, void *e_inf) with gil:
    #cdef Evas_Object *obj = <Evas_Object*>e_inf
    #o = object_from_instance(obj)
    #cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_RENDER_PRE)
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_PRE)


cdef void cb_canvas_render_post(void *data, Evas *e, void *e_inf) with gil:
    #cdef Evas_Object *obj = <Evas_Object*>e_inf
    #o = object_from_instance(obj)
    #cb_canvas_dispatcher(<Canvas>data, o, EVAS_CALLBACK_RENDER_POST)
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_RENDER_POST)

cdef void cb_canvas_axis_update(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_AXIS_UPDATE)

cdef void cb_canvas_viewport_resize(void *data, Evas *e, void *e_inf) with gil:
    cb_canvas_dispatcher2(<Canvas>data, EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE)


cdef int evas_canvas_event_callbacks_len
cdef Evas_Event_Cb evas_canvas_event_callbacks[36]
evas_canvas_event_callbacks_len = 36
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_IN] = cb_canvas_mouse_in
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_OUT] = cb_canvas_mouse_out
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_DOWN] = cb_canvas_mouse_down
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_UP] = cb_canvas_mouse_up
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_MOVE] = cb_canvas_mouse_move
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOUSE_WHEEL] = cb_canvas_mouse_wheel
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MULTI_DOWN] = cb_canvas_multi_down
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MULTI_UP] = cb_canvas_multi_up
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MULTI_MOVE] = cb_canvas_multi_move
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_FREE] = cb_canvas_free
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_KEY_DOWN] = cb_canvas_key_down
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_KEY_UP] = cb_canvas_key_up
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_FOCUS_IN] = cb_canvas_focus_in
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_FOCUS_OUT] = cb_canvas_focus_out
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_SHOW] = cb_canvas_show
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_HIDE] = cb_canvas_hide
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_MOVE] = cb_canvas_move
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RESIZE] = cb_canvas_resize
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RESTACK] = cb_canvas_restack
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_DEL] = cb_canvas_del
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_HOLD] = cb_canvas_hold
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CHANGED_SIZE_HINTS] = cb_canvas_changed_size_hints
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_IMAGE_PRELOADED] = cb_canvas_image_preloaded
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CANVAS_FOCUS_IN] = cb_canvas_canvas_focus_in
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CANVAS_FOCUS_OUT] = cb_canvas_canvas_focus_out
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RENDER_FLUSH_PRE] = cb_canvas_render_flush_pre
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RENDER_FLUSH_POST] = cb_canvas_render_flush_post
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN] = cb_canvas_canvas_object_focus_in
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT] = cb_canvas_canvas_object_focus_out
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_IMAGE_UNLOADED] = cb_canvas_image_unloaded
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RENDER_PRE] = cb_canvas_render_pre
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_RENDER_POST] = cb_canvas_render_post
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_IMAGE_RESIZE] = cb_canvas_image_resize
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_DEVICE_CHANGED] = cb_canvas_device_changed
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_AXIS_UPDATE] = cb_canvas_axis_update
evas_canvas_event_callbacks[<int>enums.EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE] = cb_canvas_viewport_resize