summaryrefslogtreecommitdiff
path: root/include/efl.ecore.pxd
blob: b1927780a124a302385e0eacf3637aa5e9794aee (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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# 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/>.

from efl.eina cimport *
from efl.c_eo cimport Eo as cEo
from efl.eo cimport Eo


cdef extern from "Ecore.h":

    ####################################################################
    # Define  (this are not really correct, but works)
    #
    cpdef enum:
        ECORE_EVENT_NONE
        ECORE_EVENT_SIGNAL_USER
        ECORE_EVENT_SIGNAL_HUP
        ECORE_EVENT_SIGNAL_EXIT
        ECORE_EVENT_SIGNAL_POWER
        ECORE_EVENT_SIGNAL_REALTIME
        ECORE_EVENT_MEMORY_STATE
        ECORE_EVENT_POWER_STATE
        ECORE_EVENT_LOCALE_CHANGED
        ECORE_EVENT_HOSTNAME_CHANGED
        ECORE_EVENT_SYSTEM_TIMEDATE_CHANGED
        ECORE_EVENT_COUNT

        ECORE_CALLBACK_CANCEL
        ECORE_CALLBACK_RENEW

        ECORE_CALLBACK_PASS_ON
        ECORE_CALLBACK_DONE

        ECORE_EXE_PRIORITY_INHERIT

    int ECORE_EXE_EVENT_ADD
    int ECORE_EXE_EVENT_DEL
    int ECORE_EXE_EVENT_DATA
    int ECORE_EXE_EVENT_ERROR

    ####################################################################
    # Enums
    #
    cpdef enum Ecore_Fd_Handler_Flags:
        ECORE_FD_READ
        ECORE_FD_WRITE
        ECORE_FD_ERROR
    ctypedef enum Ecore_Fd_Handler_Flags:
        pass

    cpdef enum Ecore_Exe_Flags:
        ECORE_EXE_NONE
        ECORE_EXE_PIPE_READ
        ECORE_EXE_PIPE_WRITE
        ECORE_EXE_PIPE_ERROR
        ECORE_EXE_PIPE_READ_LINE_BUFFERED
        ECORE_EXE_PIPE_ERROR_LINE_BUFFERED
        ECORE_EXE_PIPE_AUTO
        ECORE_EXE_RESPAWN
        ECORE_EXE_USE_SH
        ECORE_EXE_NOT_LEADER
        ECORE_EXE_TERM_WITH_PARENT
    ctypedef enum Ecore_Exe_Flags:
        pass

    cpdef enum Ecore_Pos_Map:
        ECORE_POS_MAP_LINEAR
        ECORE_POS_MAP_ACCELERATE
        ECORE_POS_MAP_DECELERATE
        ECORE_POS_MAP_SINUSOIDAL
        ECORE_POS_MAP_ACCELERATE_FACTOR
        ECORE_POS_MAP_DECELERATE_FACTOR
        ECORE_POS_MAP_SINUSOIDAL_FACTOR
        ECORE_POS_MAP_DIVISOR_INTERP
        ECORE_POS_MAP_BOUNCE
        ECORE_POS_MAP_SPRING
        ECORE_POS_MAP_CUBIC_BEZIER
    ctypedef enum Ecore_Pos_Map:
        pass

    cpdef enum Ecore_Animator_Source:
        ECORE_ANIMATOR_SOURCE_TIMER
        ECORE_ANIMATOR_SOURCE_CUSTOM
    ctypedef enum Ecore_Animator_Source:
        pass

    cpdef enum Ecore_Poller_Type:
        ECORE_POLLER_CORE
    ctypedef enum Ecore_Poller_Type:
        pass

    ####################################################################
    # Basic Types
    #
    ctypedef cEo Ecore_Timer
    ctypedef struct Ecore_Animator
    ctypedef cEo Ecore_Poller
    ctypedef struct Ecore_Idler
    ctypedef struct Ecore_Idle_Enterer
    ctypedef struct Ecore_Idle_Exiter

    ctypedef struct Ecore_Event_Handler
    ctypedef struct Ecore_Event

    ctypedef struct Ecore_Event_Signal_User:
        int number

    ctypedef struct Ecore_Event_Signal_Exit:
        unsigned int interrupt
        unsigned int quit
        unsigned int terminate

    ctypedef struct Ecore_Event_Signal_Realtime:
        int num

    ctypedef struct Ecore_Exe_Event_Add:
        Ecore_Exe *exe
        void      *ext_data

    ctypedef struct Ecore_Exe_Event_Del:
        int          pid
        int          exit_code
        Ecore_Exe   *exe
        int          exit_signal
        unsigned int exited
        unsigned int signalled
        void        *ext_data

    ctypedef struct Ecore_Exe_Event_Data:
        Ecore_Exe                 *exe
        void                      *data
        int                        size
        Ecore_Exe_Event_Data_Line *lines

    ctypedef struct Ecore_Exe_Event_Data_Line:
        char *line
        int   size

    ctypedef struct Ecore_Fd_Handler
    ctypedef struct Ecore_Exe

    ####################################################################
    # Other typedefs
    #
    ctypedef void (*Ecore_Cb)(void *data)
    ctypedef Eina_Bool (*Ecore_Task_Cb)(void *data)
    ctypedef Eina_Bool (*Ecore_Fd_Cb)(void *data, Ecore_Fd_Handler *fd_handler)
    ctypedef void (*Ecore_Fd_Prep_Cb)(void *data, Ecore_Fd_Handler *fd_handler)
    ctypedef Eina_Bool (*Ecore_Event_Handler_Cb)(void *data, int type, void *event)
    ctypedef void (*Ecore_End_Cb)(void *user_data, void *func_data)
    ctypedef void (*Ecore_Exe_Cb)(void *data, const Ecore_Exe *exe)
    ctypedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos)

    ####################################################################
    # Functions
    #
    int ecore_init()
    int ecore_shutdown()

    void ecore_main_loop_iterate() nogil
    void ecore_main_loop_begin() nogil
    void ecore_main_loop_quit()

    int ecore_main_loop_glib_integrate()
    void ecore_main_loop_glib_always_integrate_disable()

    double ecore_time_get()
    double ecore_loop_time_get()

    Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, void *data)
    Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, void *data)
    void           *ecore_animator_del(Ecore_Animator *animator)
    void            ecore_animator_frametime_set(double frametime)
    double          ecore_animator_frametime_get()

    Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data)
    void         *ecore_poller_del(Ecore_Poller *poller)
    Eina_Bool     ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval)
    int           ecore_poller_poller_interval_get(Ecore_Poller *poller)

    Ecore_Timer *ecore_timer_add(double t, Ecore_Task_Cb func, void *data)
    void        *ecore_timer_del(Ecore_Timer *timer)
    void         ecore_timer_freeze(Ecore_Timer *timer)
    void         ecore_timer_thaw(Ecore_Timer *timer)
    void         ecore_timer_interval_set(Ecore_Timer *timer, double t)
    double       ecore_timer_interval_get(Ecore_Timer *timer)
    void         ecore_timer_delay(Ecore_Timer *timer, double add)
    void         ecore_timer_reset(Ecore_Timer *timer)
    double       ecore_timer_pending_get(Ecore_Timer *timer)
    double       ecore_timer_precision_get()
    double       ecore_timer_precision_set(double value)

    Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, void *data)
    void        *ecore_idler_del(Ecore_Idler *idler)
    Ecore_Idler *ecore_idle_enterer_add(Ecore_Task_Cb func, void *data)
    void        *ecore_idle_enterer_del(Ecore_Idler *idler)
    Ecore_Idler *ecore_idle_exiter_add(Ecore_Task_Cb func, void *data)
    void        *ecore_idle_exiter_del(Ecore_Idler *idler)

    Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, void *data, Ecore_Fd_Cb buf_func, void *buf_data)
    void              ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, void *data)
    void             *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
    int               ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
    int               ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)
    void              ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)

    Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, void *data)
    void                *ecore_event_handler_del(Ecore_Event_Handler *event_handler)
    int                  ecore_event_type_new()
    Ecore_Event         *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
    void                *ecore_event_del(Ecore_Event *ev)

    void                  ecore_exe_run_priority_set(int pri)
    int                   ecore_exe_run_priority_get()
    Ecore_Exe            *ecore_exe_pipe_run(char *exe_cmd, Ecore_Exe_Flags flags, void *data)
    void                  ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
    int                   ecore_exe_send(Ecore_Exe *exe, const void *data, int size)
    void                  ecore_exe_close_stdin(Ecore_Exe *exe)
    void                  ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines)
    Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
    void                  ecore_exe_event_data_free(Ecore_Exe_Event_Data *data)
    void                 *ecore_exe_free(Ecore_Exe *exe)
    int                   ecore_exe_pid_get(Ecore_Exe *exe)
    void                  ecore_exe_tag_set(Ecore_Exe *exe, char *tag)
    const char *       ecore_exe_tag_get(Ecore_Exe *exe)
    const char *       ecore_exe_cmd_get(Ecore_Exe *exe)
    void                 *ecore_exe_data_get(Ecore_Exe *exe)
    Ecore_Exe_Flags       ecore_exe_flags_get(Ecore_Exe *exe)
    void                  ecore_exe_pause(Ecore_Exe *exe)
    void                  ecore_exe_continue(Ecore_Exe *exe)
    void                  ecore_exe_interrupt(Ecore_Exe *exe)
    void                  ecore_exe_quit(Ecore_Exe *exe)
    void                  ecore_exe_terminate(Ecore_Exe *exe)
    void                  ecore_exe_kill(Ecore_Exe *exe)
    void                  ecore_exe_signal(Ecore_Exe *exe, int num)
    void                  ecore_exe_hup(Ecore_Exe *exe)


cdef extern from "Ecore_File.h":

    cpdef enum Ecore_File_Event:
        ECORE_FILE_EVENT_NONE
        ECORE_FILE_EVENT_CREATED_FILE
        ECORE_FILE_EVENT_CREATED_DIRECTORY
        ECORE_FILE_EVENT_DELETED_FILE
        ECORE_FILE_EVENT_DELETED_DIRECTORY
        ECORE_FILE_EVENT_DELETED_SELF
        ECORE_FILE_EVENT_MODIFIED
        ECORE_FILE_EVENT_CLOSED
    ctypedef enum Ecore_File_Event:
        pass

    cpdef enum Ecore_File_Progress_Return:
        ECORE_FILE_PROGRESS_CONTINUE
        ECORE_FILE_PROGRESS_ABORT
    ctypedef enum Ecore_File_Progress_Return:
        pass

    ctypedef struct Ecore_File_Download_Job
    ctypedef struct Ecore_File_Monitor

    ctypedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status)
    ctypedef int  (*Ecore_File_Download_Progress_Cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow)
    ctypedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path)

    int       ecore_file_init()
    int       ecore_file_shutdown()
    void      ecore_file_download_abort(Ecore_File_Download_Job *job)
    void      ecore_file_download_abort_all()
    Eina_Bool ecore_file_download_protocol_available(const char *protocol)
    Eina_Bool ecore_file_download(const char *url, const char *dst,
                                  Ecore_File_Download_Completion_Cb completion_cb,
                                  Ecore_File_Download_Progress_Cb progress_cb,
                                  void *data,
                                  Ecore_File_Download_Job **job_ret)

    Ecore_File_Monitor *ecore_file_monitor_add(const char *path, Ecore_File_Monitor_Cb func, void *data)
    void                ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor)
    const char         *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor)


####################################################################
# Python classes
#
cdef class Timer(Eo):
    cdef double _interval
    cdef readonly object func, args, kargs
    cpdef bint _task_exec(self) except *


cdef class Animator(Eo):
    cdef readonly object func
    cdef readonly tuple args
    cdef readonly dict kargs
    cpdef bint _task_exec(self) except *
    # we cannot use Eo.obj here because animators are no more eo objects in C
    cdef Ecore_Animator *obj2


cdef class Poller(Eo):
    cdef readonly object func
    cdef readonly tuple args
    cdef readonly dict kargs
    cpdef bint _task_exec(self) except *


cdef class Idler(Eo):
    cdef readonly object func, args, kargs
    cpdef bint _task_exec(self) except *
    # we cannot use Eo.obj here because idlers are no more eo objects in C
    cdef Ecore_Idler *obj2


cdef class IdleEnterer(Idler):
    pass


cdef class IdleExiter(Idler):
    pass


cdef class FdHandler(object):
    cdef Ecore_Fd_Handler *obj
    cdef readonly object func
    cdef readonly object args
    cdef readonly object kargs
    cdef readonly object _prepare_callback

    cdef object _exec(self)


cdef class Exe(object):
    cdef Ecore_Exe *exe
    cdef readonly object __data
    cdef object __callbacks

    cdef int _set_obj(self, char *exe_cmd, int flags) except 0
    cdef int _unset_obj(self) except 0


cdef class ExeEventFilter(object):
    cdef Ecore_Exe *exe
    cdef Ecore_Event_Handler *handler
    cdef readonly object owner
    cdef readonly int event_type
    cdef object callbacks


cdef class EventHandler(object):
    cdef Ecore_Event_Handler *obj
    cdef readonly int type
    cdef readonly object event_cls
    cdef readonly object func
    cdef readonly object args
    cdef readonly object kargs

    cdef int _set_obj(self, Ecore_Event_Handler *obj) except 0
    cdef int _unset_obj(self) except 0
    cdef Eina_Bool _exec(self, void *event) except 2


cdef class Event(object):
    cdef int _set_obj(self, void *obj) except 0
    cdef object _get_obj(self)


cdef class EventSignalUser(Event):
    cdef readonly object number


cdef class EventSignalHup(Event):
    pass


cdef class EventSignalExit(Event):
    cdef readonly object interrupt
    cdef readonly object quit
    cdef readonly object terminate


cdef class EventSignalPower(Event):
    pass


cdef class CustomEvent(Event):
    cdef readonly object obj


cdef class QueuedEvent:
    cdef Ecore_Event *obj
    cdef readonly object args

    cdef int _set_obj(self, Ecore_Event *ev) except 0
    cdef int _unset_obj(self) except 0


cdef class EventExeAdd(Event):
    cdef readonly object exe


cdef class EventExeDel(Event):
    cdef readonly object exe
    cdef readonly object pid
    cdef readonly object exit_code
    cdef readonly object exit_signal
    cdef readonly object exited
    cdef readonly object signalled


cdef class EventExeData(Event):
    cdef readonly object exe
    cdef readonly object data
    cdef readonly object size
    cdef readonly object lines


cdef class FileDownload:
    cdef Ecore_File_Download_Job *job
    cdef readonly object completion_cb
    cdef readonly object progress_cb
    cdef readonly object args
    cdef readonly object kargs

    cdef object _exec_completion(self, const char *file, int status)
    cdef object _exec_progress(self, const char *file,
                               long int dltotal, long int dlnow,
                               long int ultotal, long int ulnow)


cdef class FileMonitor:
    cdef Ecore_File_Monitor *mon
    cdef readonly object monitor_cb
    cdef readonly object args
    cdef readonly object kargs

    cdef object _exec_monitor(self, Ecore_File_Event event, const char *path)


cdef object _event_mapping_register(int type, cls)
cdef object _event_mapping_unregister(int type)
cdef object _event_mapping_get(int type)