Enlightenment CVS committal Author : barbieri Project : e17 Module : proto
Dir : e17/proto/python-efl/python-evas/evas Modified Files: __init__.py evas.c_evas.pxd evas.c_evas.pyx evas.c_evas_object.pxi python.pxd Added Files: evas.c_evas_object_smart.pxi Log Message: Implement SmartObject and allow user-defined Evas objects. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- __init__.py 30 Apr 2007 20:17:48 -0000 1.1 +++ __init__.py 5 May 2007 02:33:18 -0000 1.2 @@ -67,6 +67,25 @@ obj.viewport_set(*viewport) return obj +class SmartObject(c_evas.SmartObject): + def __new__(type, canvas, size=None, pos=None, geometry=None, color=None, + name=None, *args, **kargs): + if type is SmartObject or type is c_evas.SmartObject: + raise TypeError("Must not instantiate SmartObject, but subclasses") + obj = c_evas.SmartObject.__new__(type, canvas) + obj._new_obj() + if size: + obj.size_set(*size) + if pos: + obj.pos_set(*pos) + if geometry: + obj.geometry_set(*geometry) + if color: + obj.color_set(*c_evas.color_parse(color)) + if name: + obj.name_set(name) + return obj + class Rectangle(c_evas.Rectangle): def __new__(type, canvas, size=None, pos=None, geometry=None, color=None, =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas.pxd,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas.c_evas.pxd 5 May 2007 02:20:31 -0000 1.2 +++ evas.c_evas.pxd 5 May 2007 02:33:18 -0000 1.3 @@ -74,6 +74,9 @@ EVAS_TEXTBLOCK_TEXT_RAW EVAS_TEXTBLOCK_TEXT_PLAIN + ctypedef enum Evas_Smart_Class_Version: + EVAS_SMART_CLASS_VERSION + #################################################################### # Structures @@ -99,6 +102,21 @@ ctypedef struct Evas_Smart ctypedef struct Evas_Native_Surface + ctypedef struct Evas_Smart_Class: + char *name + int version + void (*add)(Evas_Object *o) + void (*delete "del")(Evas_Object *o) + void (*move)(Evas_Object *o, int x, int y) + void (*resize)(Evas_Object *o, int w, int h) + void (*show)(Evas_Object *o) + void (*hide)(Evas_Object *o) + void (*color_set)(Evas_Object *o, int r, int g, int b, int a) + void (*clip_set)(Evas_Object *o, Evas_Object *clip) + void (*clip_unset)(Evas_Object *o) + void *data + + ctypedef struct Evas_Point: int x int y @@ -323,6 +341,27 @@ Evas_Bool evas_object_propagate_events_get(Evas_Object *obj) + #################################################################### + # Rectangle Object + # + void evas_smart_free(Evas_Smart *s) + Evas_Smart *evas_smart_class_new(Evas_Smart_Class *sc) + Evas_Smart_Class *evas_smart_class_get(Evas_Smart *s) + + void *evas_smart_data_get(Evas_Smart *s) + + Evas_Object *evas_object_smart_add(Evas *e, Evas_Smart *s) + void evas_object_smart_member_add(Evas_Object *obj, Evas_Object *smart_obj) + void evas_object_smart_member_del(Evas_Object *obj) + Evas_Object *evas_object_smart_parent_get(Evas_Object *obj) + Evas_List *evas_object_smart_members_get(Evas_Object *obj) + Evas_Smart *evas_object_smart_smart_get(Evas_Object *obj) + void *evas_object_smart_data_get(Evas_Object *obj) + void evas_object_smart_data_set(Evas_Object *obj, void *data) + void evas_object_smart_callback_add(Evas_Object *obj, char *event, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data) + void *evas_object_smart_callback_del(Evas_Object *obj, char *event, void (*func) (void *data, Evas_Object *obj, void *event_info)) + void evas_object_smart_callback_call(Evas_Object *obj, char *event, void *event_info) + #################################################################### # Rectangle Object @@ -491,6 +530,18 @@ cdef int _unset_obj(self) except 0 cdef int _set_obj(self, Evas_Object *obj) except 0 + + +cdef class SmartObject(Object): + cdef object _smart_callbacks + cdef object _m_delete + cdef object _m_move + cdef object _m_resize + cdef object _m_show + cdef object _m_hide + cdef object _m_color_set + cdef object _m_clip_set + cdef object _m_clip_unset cdef class Rectangle(Object): =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas.pyx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas.c_evas.pyx 3 May 2007 15:29:51 -0000 1.2 +++ evas.c_evas.pyx 5 May 2007 02:33:18 -0000 1.3 @@ -162,6 +162,7 @@ include "evas.c_evas_object_events.pxi" include "evas.c_evas_object_callbacks.pxi" include "evas.c_evas_object.pxi" +include "evas.c_evas_object_smart.pxi" include "evas.c_evas_object_rectangle.pxi" include "evas.c_evas_object_line.pxi" include "evas.c_evas_object_image.pxi" =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_object.pxi,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas.c_evas_object.pxi 5 May 2007 02:20:31 -0000 1.2 +++ evas.c_evas_object.pxi 5 May 2007 02:33:18 -0000 1.3 @@ -652,3 +652,13 @@ def __set__(self, int value): self.propagate_events_set(value) + + def parent_get(self): + "Get object's parent, in the case it was added to some SmartObject." + cdef Evas_Object *obj + obj = evas_object_smart_parent_get(self.obj) + return Object_from_instance(obj) + + property parent: + def __get__(self): + return self.parent_get() =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/python.pxd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- python.pxd 30 Apr 2007 20:17:48 -0000 1.1 +++ python.pxd 5 May 2007 02:33:18 -0000 1.2 @@ -75,6 +75,8 @@ int PyObject_AsReadBuffer(obj, void **buffer, Py_ssize_t *buffer_len) except -1 int PyObject_AsWriteBuffer(obj, void **buffer, Py_ssize_t *buffer_len) except -1 + # methodobject.h + object PyMethod_New(object func, object self, object cls) cdef extern from "Numeric/arrayobject.h": ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs