diff options
author | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 14:33:01 +0100 |
---|---|---|
committer | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 14:33:01 +0100 |
commit | 86aa8c51383999a424d58bdc322fe231c53e39ea (patch) | |
tree | adb771ac653f34f25289cb94a2dbaecd1122218a | |
parent | 9809eb2739b64b11f0072a353308106dd5a4ece2 (diff) |
New 1.17 API: elm.Ctxpopup "geometry,update" smart cb
Diffstat (limited to '')
-rw-r--r-- | doc/elementary/ctxpopup.rst | 2 | ||||
-rw-r--r-- | efl/elementary/__init__.pyx | 6 | ||||
-rw-r--r-- | efl/elementary/ctxpopup.pxi | 11 | ||||
-rw-r--r-- | examples/elementary/test_ctxpopup.py | 4 | ||||
-rw-r--r-- | 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 | |||
28 | 4. the parent object is resized due to the window rotation. Then ctxpopup is | 28 | 4. the parent object is resized due to the window rotation. Then ctxpopup is |
29 | dismissed. | 29 | dismissed. |
30 | 30 | ||
31 | - ``geometry,update`` - The geometry has changed (since 1.17) | ||
32 | |||
31 | Layout content parts | 33 | Layout content parts |
32 | ==================== | 34 | ==================== |
33 | 35 | ||
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 | |||
21 | from libc.stdlib cimport malloc, free | 21 | from libc.stdlib cimport malloc, free |
22 | from libc.stdint cimport uintptr_t | 22 | from libc.stdint cimport uintptr_t |
23 | 23 | ||
24 | from efl.evas cimport Object as evasObject | 24 | from efl.evas cimport Object as evasObject, Evas_Coord_Rectangle, Rect |
25 | 25 | ||
26 | from efl.utils.conversions cimport _touni, _ctouni, \ | 26 | from efl.utils.conversions cimport _touni, _ctouni, \ |
27 | python_list_strings_to_eina_list, eina_list_strings_to_python_list | 27 | python_list_strings_to_eina_list, eina_list_strings_to_python_list |
@@ -599,6 +599,10 @@ cdef object _cb_string_conv(void *addr): | |||
599 | cdef object _cb_object_item_conv(void *addr): | 599 | cdef object _cb_object_item_conv(void *addr): |
600 | return _object_item_to_python(<Elm_Object_Item *>addr) | 600 | return _object_item_to_python(<Elm_Object_Item *>addr) |
601 | 601 | ||
602 | cdef object _cb_rectangle_conv(void *addr): | ||
603 | cdef Evas_Coord_Rectangle *geom = <Evas_Coord_Rectangle *>addr | ||
604 | return Rect(geom.x, geom.y, geom.w, geom.h) | ||
605 | |||
602 | 606 | ||
603 | #include "access.pxi" | 607 | #include "access.pxi" |
604 | include "actionslider.pxi" | 608 | 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): | |||
395 | def callback_dismissed_del(self, func): | 395 | def callback_dismissed_del(self, func): |
396 | self._callback_del("dismissed", func) | 396 | self._callback_del("dismissed", func) |
397 | 397 | ||
398 | def callback_geometry_update_add(self, func, *args, **kwargs): | ||
399 | """the ctxpopup geometry has changed | ||
400 | |||
401 | .. versionadded:: 1.17 | ||
402 | |||
403 | """ | ||
404 | self._callback_add_full("geometry,update", _cb_rectangle_conv, func, args, kwargs) | ||
405 | |||
406 | def callback_geometry_update_del(self, func): | ||
407 | self._callback_del_full("geometry,update", _cb_rectangle_conv, func) | ||
408 | |||
398 | 409 | ||
399 | _object_mapping_register("Elm_Ctxpopup", Ctxpopup) | 410 | _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): | |||
47 | if "img" in cp.data: | 47 | if "img" in cp.data: |
48 | cp.data["img"].delete() | 48 | cp.data["img"].delete() |
49 | 49 | ||
50 | def cb_geometry_update(cp, geom): | ||
51 | print("geometry,update", geom) | ||
52 | |||
50 | def cb_item1(li, item): | 53 | def cb_item1(li, item): |
51 | cp = Ctxpopup(li) | 54 | cp = Ctxpopup(li) |
55 | cp.callback_geometry_update_add(cb_geometry_update) | ||
52 | it = item_new(cp, "Go to home folder", "home") | 56 | it = item_new(cp, "Go to home folder", "home") |
53 | it = item_new(cp, "Save file", "file") | 57 | it = item_new(cp, "Save file", "file") |
54 | it = item_new(cp, "Delete file", "delete") | 58 | 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": | |||
347 | int x | 347 | int x |
348 | int y | 348 | int y |
349 | 349 | ||
350 | ctypedef struct Evas_Coord_Point: # Evas_Coord is int now | 350 | ctypedef struct Evas_Coord_Point: |
351 | Evas_Coord x | 351 | Evas_Coord x |
352 | Evas_Coord y | 352 | Evas_Coord y |
353 | 353 | ||
354 | ctypedef struct Evas_Coord_Precision_Point: # Evas_Coord is int now | 354 | ctypedef struct Evas_Coord_Size: |
355 | Evas_Coord w | ||
356 | Evas_Coord h | ||
357 | |||
358 | ctypedef struct Evas_Coord_Rectangle: | ||
359 | Evas_Coord x | ||
360 | Evas_Coord y | ||
361 | Evas_Coord w | ||
362 | Evas_Coord h | ||
363 | |||
364 | ctypedef struct Evas_Coord_Precision_Point: | ||
355 | Evas_Coord x | 365 | Evas_Coord x |
356 | Evas_Coord y | 366 | Evas_Coord y |
357 | double xsub | 367 | double xsub |