[Pkg-e-commits] [SCM] Python bindings for Evas branch, upstream-vcs, updated. a2d7e40fb9fbbe948f479174a461f735a2f530fb
cmarcelo
cmarcelo at alioth.debian.org
Sat May 24 16:31:59 UTC 2008
The following commit has been merged in the upstream-vcs branch:
commit b409f8f3a4b9091d020fd3940385b8f1608ccfd0
Author: cmarcelo <cmarcelo>
Date: Tue Apr 1 21:05:53 2008 +0000
Python-Evas: adding support for new EVAS_CALLBACK_HOLD.
diff --git a/evas/decorators.py b/evas/decorators.py
index 4c62df2..c6bedd5 100644
--- a/evas/decorators.py
+++ b/evas/decorators.py
@@ -73,3 +73,7 @@ def restack_callback(func):
def del_callback(func):
func.evas_event_callback = evas.EVAS_CALLBACK_DEL
return staticmethod(func)
+
+def hold_callback(func):
+ func.evas_event_callback = evas.EVAS_CALLBACK_HOLD
+ return staticmethod(func)
diff --git a/evas/evas.c_evas_object.pxi b/evas/evas.c_evas_object.pxi
index 785d087..8051379 100644
--- a/evas/evas.c_evas_object.pxi
+++ b/evas/evas.c_evas_object.pxi
@@ -196,7 +196,7 @@ cdef public class Object [object PyEvasObject, type PyEvasObject_Type]:
on_mouse_move_del, on_mouse_out_add, on_mouse_out_del, on_mouse_up_add,
on_mouse_up_del, on_mouse_wheel_add, on_mouse_wheel_del, on_move_add,
on_move_del, on_resize_add, on_resize_del, on_restack_add,
- on_restack_del, on_show_add, on_show_del
+ on_restack_del, on_show_add, on_show_del, on_hold_add, on_hold_del
@group Often unused: render_op_set, render_op_get, render_op,
color_interpolation_set, color_interpolation_get, color_interpolation,
anti_alias_set, anti_alias_get, anti_alias, pointer_mode_set,
@@ -1099,6 +1099,14 @@ cdef public class Object [object PyEvasObject, type PyEvasObject_Type]:
"Same as event_callback_del(EVAS_CALLBACK_DEL, ...)"
self.event_callback_del(EVAS_CALLBACK_FREE, func)
+ def on_hold_add(self, func, *a, **k):
+ "Same as event_callback_add(EVAS_CALLBACK_HOLD, ...)"
+ self.event_callback_add(EVAS_CALLBACK_HOLD, func, *a, **k)
+
+ def on_hold_del(self, func):
+ "Same as event_callback_del(EVAS_CALLBACK_HOLD, ...)"
+ self.event_callback_del(EVAS_CALLBACK_HOLD, func)
+
def pass_events_get(self):
"@rtype: bool"
return bool(evas_object_pass_events_get(self.obj))
diff --git a/evas/evas.c_evas_object_callbacks.pxi b/evas/evas.c_evas_object_callbacks.pxi
index 8521185..4b7cb49 100644
--- a/evas/evas.c_evas_object_callbacks.pxi
+++ b/evas/evas.c_evas_object_callbacks.pxi
@@ -138,9 +138,18 @@ cdef void cb_del(void *data, Evas *e,
cb_dispatcher2(<Object>data, EVAS_CALLBACK_DEL)
+cdef void cb_hold(void *data, Evas *e,
+ Evas_Object *obj, void *e_inf) with gil:
+ cdef EventHold event
+ event = EventHold()
+ event._set_obj(e_inf)
+ cb_dispatcher(<Object>data, event, EVAS_CALLBACK_HOLD)
+ event._unset_obj()
+
+
cdef int evas_event_callbacks_len
-cdef evas_event_callback_t evas_event_callbacks[17]
-evas_event_callbacks_len = 17
+cdef evas_event_callback_t evas_event_callbacks[18]
+evas_event_callbacks_len = 18
evas_event_callbacks[<int>EVAS_CALLBACK_MOUSE_IN] = cb_mouse_in
evas_event_callbacks[<int>EVAS_CALLBACK_MOUSE_OUT] = cb_mouse_out
evas_event_callbacks[<int>EVAS_CALLBACK_MOUSE_DOWN] = cb_mouse_down
@@ -158,3 +167,4 @@ evas_event_callbacks[<int>EVAS_CALLBACK_MOVE] = cb_move
evas_event_callbacks[<int>EVAS_CALLBACK_RESIZE] = cb_resize
evas_event_callbacks[<int>EVAS_CALLBACK_RESTACK] = cb_restack
evas_event_callbacks[<int>EVAS_CALLBACK_DEL] = cb_del
+evas_event_callbacks[<int>EVAS_CALLBACK_HOLD] = cb_hold
diff --git a/evas/evas.c_evas_object_events.pxi b/evas/evas.c_evas_object_events.pxi
index 387358b..989d609 100644
--- a/evas/evas.c_evas_object_events.pxi
+++ b/evas/evas.c_evas_object_events.pxi
@@ -463,3 +463,40 @@ cdef class EventKeyUp:
def __set__(self, flags):
self._check_validity()
self.obj.event_flags = flags
+
+
+cdef class EventHold:
+ cdef void _set_obj(self, void *ptr):
+ self.obj = <Evas_Event_Hold*>ptr
+
+ cdef void _unset_obj(self):
+ self.obj = NULL
+
+ cdef void _check_validity(self) except *:
+ if self.obj == NULL:
+ raise ValueError("EventHold object is invalid.")
+
+ def __str__(self):
+ self._check_validity()
+ return ("%s(hold=%d, timestamp=%d, event_flags=%#x)") % \
+ (self.__class__.__name__, self.hold,
+ self.obj.timestamp, self.event_flags)
+
+ property hold:
+ def __get__(self):
+ self._check_validity()
+ return self.obj.hold
+
+ property timestamp:
+ def __get__(self):
+ self._check_validity()
+ return self.obj.timestamp
+
+ property event_flags:
+ def __get__(self):
+ self._check_validity()
+ return <int>self.obj.event_flags
+
+ def __set__(self, flags):
+ self._check_validity()
+ self.obj.event_flags = flags
diff --git a/include/evas/c_evas.pxd b/include/evas/c_evas.pxd
index 24f2da3..71f88cd 100644
--- a/include/evas/c_evas.pxd
+++ b/include/evas/c_evas.pxd
@@ -24,6 +24,7 @@ cdef extern from "Evas.h":
EVAS_CALLBACK_RESIZE
EVAS_CALLBACK_RESTACK
EVAS_CALLBACK_DEL
+ EVAS_CALLBACK_HOLD
cdef enum Evas_Load_Error:
@@ -233,6 +234,12 @@ cdef extern from "Evas.h":
unsigned int timestamp
Evas_Event_Flags event_flags
+ ctypedef struct Evas_Event_Hold:
+ int hold
+ void *data
+ unsigned int timestamp
+ Evas_Event_Flags event_flags
+
####################################################################
# Other typedefs
@@ -647,6 +654,14 @@ cdef class EventKeyUp:
cdef void _check_validity(self) except *
+cdef class EventHold:
+ cdef Evas_Event_Hold *obj
+
+ cdef void _set_obj(self, void *ptr)
+ cdef void _unset_obj(self)
+ cdef void _check_validity(self) except *
+
+
cdef public class Canvas [object PyEvasCanvas, type PyEvasCanvas_Type]:
cdef Evas *obj
--
Python bindings for Evas
More information about the Pkg-e-commits
mailing list