davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=8b9e5901a37763f5166c11925193289c9e7007b8

commit 8b9e5901a37763f5166c11925193289c9e7007b8
Author: davemds <[email protected]>
Date:   Sun May 4 12:09:20 2014 +0200

    New item,focused/unfocused signals for the List widget
    
    Plus:
    * Object.focused_item
    * ObjectItem.focus
---
 efl/elementary/list.pyx        | 23 +++++++++++++++++++++++
 efl/elementary/object.pxd      |  3 +++
 efl/elementary/object.pyx      | 15 +++++++++++++++
 efl/elementary/object_item.pxd |  3 +++
 efl/elementary/object_item.pyx | 18 ++++++++++++++++++
 5 files changed, 62 insertions(+)

diff --git a/efl/elementary/list.pyx b/efl/elementary/list.pyx
index 4441b1d..35a6fad 100644
--- a/efl/elementary/list.pyx
+++ b/efl/elementary/list.pyx
@@ -56,6 +56,8 @@ Smart callbacks one can listen to:
 - ``language,changed`` - the program's language changed
 - ``focused`` - When the list has received focus. (since 1.8)
 - ``unfocused`` - When the list has lost focus. (since 1.8)
+- ``item,focused`` - When the list item has received focus. (since 1.10)
+- ``item,unfocused`` - When the list item has lost focus. (since 1.10)
 
 Available styles for it:
 
@@ -1074,6 +1076,27 @@ cdef class List(Object):
     def callback_unfocused_del(self, func):
         self._callback_del("unfocused", func)
 
+    def callback_item_focused_add(self, func, *args, **kwargs):
+        """When the list item has received focus.
+
+        .. versionadded:: 1.10
+
+        """
+        self._callback_add_full("item,focused", _cb_object_item_conv, func, 
*args, **kwargs)
+
+    def callback_item_focused_del(self, func):
+        self._callback_del_full("item,focused", _cb_object_item_conv, func)
+
+    def callback_item_unfocused_add(self, func, *args, **kwargs):
+        """When the list item has lost focus.
+
+        .. versionadded:: 1.10
+
+        """
+        self._callback_add_full("item,unfocused", _cb_object_item_conv, func, 
*args, **kwargs)
+
+    def callback_item_unfocused_del(self, func):
+        self._callback_del_full("item,unfocused", _cb_object_item_conv, func)
 
     property scroller_policy:
         """
diff --git a/efl/elementary/object.pxd b/efl/elementary/object.pxd
index 473d38a..b54e7dd 100644
--- a/efl/elementary/object.pxd
+++ b/efl/elementary/object.pxd
@@ -29,6 +29,8 @@ cdef extern from "Edje.h":
 cdef extern from "Elementary.h":
     ctypedef struct Elm_Theme
 
+    ctypedef struct Elm_Object_Item
+
     ctypedef struct Elm_Selection_Data:
         Evas_Coord       x, y
         Elm_Sel_Format   format
@@ -103,6 +105,7 @@ cdef extern from "Elementary.h":
     Eina_Bool               elm_object_tree_focus_allow_get(const Evas_Object 
*obj)
     Eina_Bool               elm_object_focus_highlight_style_set(Evas_Object 
*obj, const char *style)
     const char *            elm_object_focus_highlight_style_get(const 
Evas_Object *obj)
+    Elm_Object_Item *       elm_object_focused_item_get(const Evas_Object *obj)
 
     # Object - Mirroring (elm_mirroring.h)
     Eina_Bool               elm_object_mirrored_get(const Evas_Object *obj)
diff --git a/efl/elementary/object.pyx b/efl/elementary/object.pyx
index 92b3090..8ceca49 100644
--- a/efl/elementary/object.pyx
+++ b/efl/elementary/object.pyx
@@ -1122,6 +1122,21 @@ cdef class Object(evasObject):
     def focused_object_get(self):
         return object_from_instance(elm_object_focused_object_get(self.obj))
 
+    property focused_item:
+        """The focused object item in an object tree.
+
+        :return: Current focused item or None, if there is no focused item.
+
+        .. versionadded:: 1.10
+
+        """
+        def __get__(self):
+            return 
_object_item_to_python(elm_object_focused_item_get(self.obj))
+
+    def focused_item_get(self):
+        return _object_item_to_python(elm_object_focused_item_get(self.obj))
+
+
     property focus_highlight_style:
         """The focus highlight style name to be used.
 
diff --git a/efl/elementary/object_item.pxd b/efl/elementary/object_item.pxd
index c4fe57a..b013879 100644
--- a/efl/elementary/object_item.pxd
+++ b/efl/elementary/object_item.pxd
@@ -44,6 +44,9 @@ cdef extern from "Elementary.h":
     const char *    elm_object_item_cursor_style_get(const Elm_Object_Item *it)
     void            elm_object_item_cursor_engine_only_set(Elm_Object_Item 
*it, Eina_Bool engine_only)
     Eina_Bool       elm_object_item_cursor_engine_only_get(const 
Elm_Object_Item *it)
+    void            elm_object_item_focus_set(Elm_Object_Item *it, Eina_Bool 
focused)
+    Eina_Bool       elm_object_item_focus_get(const Elm_Object_Item *it)
+
 
     #TODO: Evas_Object *   elm_object_item_access_register(Elm_Object_Item 
*item)
     #TODO: void            elm_object_item_access_unregister(Elm_Object_Item 
*item)
diff --git a/efl/elementary/object_item.pyx b/efl/elementary/object_item.pyx
index 1185a5e..affef3c 100644
--- a/efl/elementary/object_item.pyx
+++ b/efl/elementary/object_item.pyx
@@ -609,6 +609,24 @@ cdef class ObjectItem(object):
     def cursor_engine_only_get(self):
         return elm_object_item_cursor_engine_only_get(self.item)
 
+    property focus:
+        """Whether the item is focused or not.
+
+        .. versionadded:: 1.10
+
+        """
+        def __set__(self, focused):
+            elm_object_item_focus_set(self.item, bool(focused))
+
+        def __get__(self):
+            return elm_object_item_focus_get(self.item)
+
+    def focus_set(self, focused):
+        elm_object_item_focus_set(self.item, bool(focused))
+    def focus_get(self):
+        return elm_object_item_focus_get(self.item)
+
+    
     # TODO: Accessibility
     # def access_unregister(self):
     #     """Unregister accessible object of the object item.

-- 


Reply via email to