New 1.17 API: elm.Ctxpopup "geometry,update" smart cb
This commit is contained in:
parent
9809eb2739
commit
86aa8c5138
|
@ -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
|
||||
====================
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue