Elementary: Few more missing functions.

This commit is contained in:
Kai Huuhko 2013-09-25 02:34:54 +03:00
parent 6107bc15b4
commit a1d45bb167
8 changed files with 211 additions and 3 deletions

View File

@ -1,5 +1,5 @@
from efl.evas cimport Eina_Bool, Eina_List, Evas_Object, Evas_Smart_Cb, \
Evas_Coord, Eina_Compare_Cb
Evas_Coord, Eina_Compare_Cb, const_Evas_Object
from object_item cimport Elm_Object_Item
from general cimport Elm_Tooltip_Item_Content_Cb
from enums cimport Elm_Genlist_Item_Scrollto_Type, Elm_Scroller_Policy, \
@ -96,3 +96,5 @@ cdef extern from "Elementary.h":
const_char * elm_gengrid_item_cursor_style_get(Elm_Object_Item *item)
void elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *item, Eina_Bool engine_only)
Eina_Bool elm_gengrid_item_cursor_engine_only_get(Elm_Object_Item *item)
Elm_Object_Item * elm_gengrid_nth_item_get(const_Evas_Object *obj, unsigned int nth)
Elm_Object_Item * elm_gengrid_at_xy_item_get(const_Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret)

View File

@ -1668,6 +1668,52 @@ cdef class Gengrid(Object):
def highlight_mode_get(self, fill):
return bool(elm_gengrid_highlight_mode_get(self.obj))
def nth_item_get(self, unsigned int nth):
"""nth_item_get(int nth) -> :py:class:`GengridItem`
Get the nth item, in a given gengrid widget, placed at position
``nth``, in its internal items list
:param nth: The number of the item to grab (0 being the first)
:return: The item stored in the object at position ``nth`` or
``None``, if there's no item with that index (and on errors)
:since: 1.8
"""
return _object_item_to_python(elm_gengrid_nth_item_get(self.obj, nth))
def at_xy_item_get(self, int x, int y):
"""at_xy_item_get(int x, int y) -> (GengridItem, int xposret, int yposret)
Get the item that is at the x, y canvas coords.
:param x: The input x coordinate
:param y: The input y coordinate
:return: (:py:class:`GengridItem`, **int** xposret, **int** yposret)
This returns the item at the given coordinates (which are canvas
relative, not object-relative). If an item is at that coordinate,
that item handle is returned, and if @p xposret is not NULL, the
integer pointed to is set to a value of -1, 0 or 1, depending if
the coordinate is on the left portion of that item (-1), on the
middle section (0) or on the right part (1).
if @p yposret is not NULL, the
integer pointed to is set to a value of -1, 0 or 1, depending if
the coordinate is on the upper portion of that item (-1), on the
middle section (0) or on the lower part (1). If NULL is returned as
an item (no item found there), then posret may indicate -1 or 1
based if the coordinate is above or below all items respectively in
the gengrid.
"""
cdef:
int xposret, yposret
Elm_Object_Item *ret
ret = elm_gengrid_at_xy_item_get(self.obj, x, y, &xposret, &yposret)
return _object_item_to_python(ret), xposret, yposret
def callback_activated_add(self, func, *args, **kwargs):
self._callback_add_full("activated", _cb_object_item_conv,

View File

@ -1,4 +1,5 @@
from efl.evas cimport Eina_Bool, Eina_List, Eina_Compare_Cb, Evas_Object, Evas_Smart_Cb, Evas_Coord
from efl.evas cimport Eina_Bool, Eina_List, Eina_Compare_Cb, \
Evas_Object, const_Evas_Object, Evas_Smart_Cb, Evas_Coord
from object cimport Object
from object_item cimport Elm_Object_Item
from general cimport Elm_Tooltip_Item_Content_Cb
@ -112,6 +113,9 @@ cdef extern from "Elementary.h":
Eina_Bool elm_genlist_highlight_mode_get(Evas_Object *obj)
void elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode)
Elm_Object_Select_Mode elm_genlist_select_mode_get(Evas_Object *obj)
Elm_Object_Item * elm_genlist_nth_item_get(const_Evas_Object *obj, unsigned int nth)
void elm_genlist_focus_on_selection_set(Evas_Object *obj, Eina_Bool enabled)
Eina_Bool elm_genlist_focus_on_selection_get(const_Evas_Object *obj)
cdef class GenlistItemClass(object):
cdef:

View File

@ -624,6 +624,44 @@ cdef class GenlistWidget(Object):
def select_mode_get(self):
return elm_genlist_select_mode_get(self.obj)
def nth_item_get(self, int nth):
"""
Get the nth item, in a given genlist widget, placed at
position ``nth``, in its internal items list
:param nth: The number of the item to grab (0 being the first)
:return: The item stored in the object at position ``nth`` or
``None``, if there's no item with that index (and on errors)
:since: 1.8
"""
return _object_item_to_python(elm_genlist_nth_item_get(self.obj, nth))
property focus_on_selection:
"""
Focus upon items selection mode
:type: bool
When enabled, every selection of an item inside the genlist will
automatically set focus to its first focusable widget from the
left. This is true of course if the selection was made by
clicking an unfocusable area in an item or selecting it with a
key movement. Clicking on a focusable widget inside an item will
couse this particular item to get focus as usual.
"""
def __set__(self, bint enabled):
elm_genlist_focus_on_selection_set(self.obj, enabled)
def __get__(self):
return bool(elm_genlist_focus_on_selection_get(self.obj))
def callback_activated_add(self, func, *args, **kwargs):
self._callback_add_full("activated", _cb_object_item_conv,
func, *args, **kwargs)

View File

@ -73,3 +73,7 @@ cdef extern from "Elementary.h":
Eina_Bool elm_gesture_layer_continues_enable_get(const_Evas_Object *obj)
void elm_gesture_layer_double_tap_timeout_set(Evas_Object *obj, double double_tap_timeout)
double elm_gesture_layer_double_tap_timeout_get(const_Evas_Object *obj)
void elm_gesture_layer_tap_finger_size_set(Evas_Object *obj, Evas_Coord sz)
Evas_Coord elm_gesture_layer_tap_finger_size_get(const_Evas_Object *obj)
# TODO: void elm_gesture_layer_tap_longpress_cb_add(Evas_Object *obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data)
# TODO: void elm_gesture_layer_tap_longpress_cb_del(Evas_Object *obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data)

View File

@ -792,5 +792,68 @@ cdef class GestureLayer(Object):
def __get__(self):
return elm_gesture_layer_double_tap_timeout_get(self.obj)
property tap_finger_size:
"""
The gesture layer finger-size for taps.
If not set, this size taken from elm_config.
Set to ZERO if you want GLayer to use system finger size value (default)
:type: int
:since: 1.8
"""
def __set__(self, int sz):
elm_gesture_layer_tap_finger_size_set(self.obj, sz)
def __get__(self):
return elm_gesture_layer_tap_finger_size_get(self.obj)
# TODO:
# def tap_longpress_cb_add(self, state, cb, *args, **kwargs):
# """tap_longpress_cb_add(state, cb, cb_data)
# This function adds a callback called during Tap + Long Tap sequence.
# :param state: state for the callback to add.
# :param cb: callback pointer
# :param data: user data for the callback.
# The callbacks will be called as followed:
# - start cbs on single tap start
# - move cbs on long press move
# - end cbs on long press end
# - abort cbs whenever in the sequence. The event info will be NULL, because it
# can be triggered from multiple events (timer expired, abort single/long taps).
# You can remove the callbacks by using elm_gesture_layer_tap_longpress_cb_del.
# :since: 1.8
# """
# if not callable(cb):
# raise TypeError("cb is not callable.")
# cb_data = (cb, args, kwargs)
# elm_gesture_layer_tap_longpress_cb_add(self.obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data)
# def tap_longpress_cb_del(self, state, cb, *args, **kwargs):
# """tap_longpress_cb_del(state, cb, cb_data)
# This function removes a callback called during Tap + Long Tap sequence.
# :param state: state for the callback to add.
# :param cb: callback pointer
# :param data: user data for the callback.
# The internal data used for the sequence will be freed ONLY when all the
# callbacks added via elm_gesture_layer_tap_longpress_cb_add are removed by
# this function.
# :since: 1.8
# """
# elm_gesture_layer_tap_longpress_cb_del(self.obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data)
_object_mapping_register("elm_gesture_layer", GestureLayer)

View File

@ -1,4 +1,5 @@
from efl.evas cimport Eina_Bool, Eina_List, Eina_Compare_Cb, Evas_Object, Evas_Smart_Cb
from efl.evas cimport Eina_Bool, Eina_List, Eina_Compare_Cb, \
Evas_Object, const_Evas_Object, Evas_Smart_Cb, Evas_Coord
from object_item cimport Elm_Object_Item, ObjectItem
from enums cimport Elm_List_Mode, Elm_Object_Select_Mode, Elm_Scroller_Policy
from libc.string cimport const_char
@ -39,3 +40,6 @@ cdef extern from "Elementary.h":
Elm_Object_Item *elm_list_first_item_get(Evas_Object *obj)
Elm_Object_Item *elm_list_last_item_get(Evas_Object *obj)
Elm_Object_Item *elm_list_at_xy_item_get(const_Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret)
void elm_list_focus_on_selection_set(Evas_Object *obj, Eina_Bool enabled)
Eina_Bool elm_list_focus_on_selection_get(const_Evas_Object *obj)

View File

@ -854,6 +854,53 @@ cdef class List(Object):
def last_item_get(self):
return _object_item_to_python(elm_list_last_item_get(self.obj))
def at_xy_item_get(self, int x, int y):
"""
Get the item that is at the x, y canvas coords.
:param x: The input x coordinate
:param y: The input y coordinate
:return: (:py:class:`ListItem`, int posret)
This returns the item at the given coordinates (which are canvas
relative, not object-relative). If an item is at that coordinate,
that item handle is returned, and if @p posret is not NULL, the
integer pointed to is set to a value of -1, 0 or 1, depending if
the coordinate is on the upper portion of that item (-1), on the
middle section (0) or on the lower part (1). If NULL is returned as
an item (no item found there), then posret may indicate -1 or 1
based if the coordinate is above or below all items respectively in
the list.
"""
cdef:
int posret
Elm_Object_Item *ret
ret = elm_list_at_xy_item_get(self.obj, x, y, &posret)
return _object_item_to_python(ret), posret
property focus_on_selection:
"""
Focus upon items selection mode
:type: bool
When enabled, every selection of an item inside the genlist will automatically set focus to
its first focusable widget from the left. This is true of course if the selection was made by
clicking an unfocusable area in an item or selecting it with a key movement. Clicking on a
focusable widget inside an item will couse this particular item to get focus as usual.
"""
def __set__(self, bint enabled):
elm_list_focus_on_selection_set(self.obj, enabled)
def __get__(self):
return bool(elm_list_focus_on_selection_get(self.obj))
def callback_activated_add(self, func, *args, **kwargs):
"""The user has double-clicked or pressed (enter|return|spacebar) on
an item. The ``event_info`` parameter is the item that was activated."""