davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=86aa8c51383999a424d58bdc322fe231c53e39ea

commit 86aa8c51383999a424d58bdc322fe231c53e39ea
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sat Jan 23 14:33:01 2016 +0100

    New 1.17 API: elm.Ctxpopup "geometry,update" smart cb
---
 doc/elementary/ctxpopup.rst          |  2 ++
 efl/elementary/__init__.pyx          |  6 +++++-
 efl/elementary/ctxpopup.pxi          | 11 +++++++++++
 examples/elementary/test_ctxpopup.py |  4 ++++
 include/efl.evas.pxd                 | 14 ++++++++++++--
 5 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/doc/elementary/ctxpopup.rst b/doc/elementary/ctxpopup.rst
index e63e634..230e616 100644
--- a/doc/elementary/ctxpopup.rst
+++ b/doc/elementary/ctxpopup.rst
@@ -28,6 +28,8 @@ Emitted signals
   4. the parent object is resized due to the window rotation. Then ctxpopup is
   dismissed.
 
+- ``geometry,update`` - The geometry has changed (since 1.17)
+
 Layout content parts
 ====================
 
diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx
index b3f7382..69e3df8 100644
--- a/efl/elementary/__init__.pyx
+++ b/efl/elementary/__init__.pyx
@@ -21,7 +21,7 @@ from libc.string cimport memcpy, strdup
 from libc.stdlib cimport malloc, free
 from libc.stdint cimport uintptr_t
 
-from efl.evas cimport Object as evasObject
+from efl.evas cimport Object as evasObject, Evas_Coord_Rectangle, Rect
 
 from efl.utils.conversions cimport _touni, _ctouni, \
     python_list_strings_to_eina_list, eina_list_strings_to_python_list
@@ -599,6 +599,10 @@ cdef object _cb_string_conv(void *addr):
 cdef object _cb_object_item_conv(void *addr):
     return _object_item_to_python(<Elm_Object_Item *>addr)
 
+cdef object _cb_rectangle_conv(void *addr):
+    cdef Evas_Coord_Rectangle *geom = <Evas_Coord_Rectangle *>addr
+    return Rect(geom.x, geom.y, geom.w, geom.h)
+
 
 #include "access.pxi"
 include "actionslider.pxi"
diff --git a/efl/elementary/ctxpopup.pxi b/efl/elementary/ctxpopup.pxi
index 857fa97..5440ea5 100644
--- a/efl/elementary/ctxpopup.pxi
+++ b/efl/elementary/ctxpopup.pxi
@@ -395,5 +395,16 @@ cdef class Ctxpopup(LayoutClass):
     def callback_dismissed_del(self, func):
         self._callback_del("dismissed", func)
 
+    def callback_geometry_update_add(self, func, *args, **kwargs):
+        """the ctxpopup geometry has changed
+
+        .. versionadded:: 1.17
+
+        """
+        self._callback_add_full("geometry,update", _cb_rectangle_conv, func, 
args, kwargs)
+
+    def callback_geometry_update_del(self, func):
+        self._callback_del_full("geometry,update", _cb_rectangle_conv, func)
+
 
 _object_mapping_register("Elm_Ctxpopup", Ctxpopup)
diff --git a/examples/elementary/test_ctxpopup.py 
b/examples/elementary/test_ctxpopup.py
index fbe154a..e1b86f2 100644
--- a/examples/elementary/test_ctxpopup.py
+++ b/examples/elementary/test_ctxpopup.py
@@ -47,8 +47,12 @@ def cb_dismissed(cp):
     if "img" in cp.data:
         cp.data["img"].delete()
 
+def cb_geometry_update(cp, geom):
+    print("geometry,update", geom)
+
 def cb_item1(li, item):
     cp = Ctxpopup(li)
+    cp.callback_geometry_update_add(cb_geometry_update)
     it = item_new(cp, "Go to home folder", "home")
     it = item_new(cp, "Save file", "file")
     it = item_new(cp, "Delete file", "delete")
diff --git a/include/efl.evas.pxd b/include/efl.evas.pxd
index 6eac7ba..d6f7350 100644
--- a/include/efl.evas.pxd
+++ b/include/efl.evas.pxd
@@ -347,11 +347,21 @@ cdef extern from "Evas.h":
         int x
         int y
 
-    ctypedef struct Evas_Coord_Point: # Evas_Coord is int now
+    ctypedef struct Evas_Coord_Point:
         Evas_Coord x
         Evas_Coord y
 
-    ctypedef struct Evas_Coord_Precision_Point: # Evas_Coord is int now
+    ctypedef struct Evas_Coord_Size:
+        Evas_Coord w
+        Evas_Coord h
+
+    ctypedef struct Evas_Coord_Rectangle:
+        Evas_Coord x
+        Evas_Coord y
+        Evas_Coord w
+        Evas_Coord h
+
+    ctypedef struct Evas_Coord_Precision_Point:
         Evas_Coord x
         Evas_Coord y
         double xsub

-- 


Reply via email to