kuuko pushed a commit to branch master.

commit 41ade8572dd375e025811148b4fb7f1c75a4db9f
Author: Kai Huuhko <[email protected]>
Date:   Fri Apr 19 20:11:47 2013 +0000

    Elementary: Add Entry context item properties label and icon.
---
 efl/elementary/entry.pxd |  6 ++++--
 efl/elementary/entry.pyx | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/efl/elementary/entry.pxd b/efl/elementary/entry.pxd
index ae6cedb..6e4d4db 100644
--- a/efl/elementary/entry.pxd
+++ b/efl/elementary/entry.pxd
@@ -28,6 +28,8 @@ cdef extern from "Elementary.h":
     ctypedef struct Elm_Entry_Context_Menu_Item:
         pass
 
+    ctypedef Elm_Entry_Context_Menu_Item const_Elm_Entry_Context_Menu_Item 
"const Elm_Entry_Context_Menu_Item"
+
     # Data for the elm_entry_filter_limit_size() entry filter.
     ctypedef struct Elm_Entry_Filter_Limit_Size:
         int max_char_count      # The maximum number of characters allowed.
@@ -133,5 +135,5 @@ cdef extern from "Elementary.h":
     const_char *            elm_entry_anchor_hover_style_get(Evas_Object *obj)
     void                    elm_entry_anchor_hover_end(Evas_Object *obj)
 
-    # TODO: const_char *            
elm_entry_context_menu_item_label_get(const_Elm_Entry_Context_Menu_Item *item)
-    # TODO: void                    
elm_entry_context_menu_item_icon_get(const_Elm_Entry_Context_Menu_Item *item, 
const_char **icon_file, const_char **icon_group, Elm_Icon_Type *icon_type)
+    const_char *            
elm_entry_context_menu_item_label_get(const_Elm_Entry_Context_Menu_Item *item)
+    void                    
elm_entry_context_menu_item_icon_get(const_Elm_Entry_Context_Menu_Item *item, 
const_char **icon_file, const_char **icon_group, Elm_Icon_Type *icon_type)
diff --git a/efl/elementary/entry.pyx b/efl/elementary/entry.pyx
index f172776..756263a 100644
--- a/efl/elementary/entry.pyx
+++ b/efl/elementary/entry.pyx
@@ -196,6 +196,7 @@ This widget emits the following signals:
 - "changed,user": The text within the entry was changed because of user
   interaction.
 - "activated": The enter key was pressed on a single line entry.
+- "aborted": The escape key was pressed on a single line entry. (since 1.7)
 - "press": A mouse button has been pressed on the entry.
 - "longpressed": A mouse button has been pressed and held for a couple
   seconds.
@@ -530,11 +531,47 @@ cdef class EntryContextMenuItem(object):
     """
 
     Type of contextual item that can be added in to long press menu.
+
     :since: 1.8
 
     """
     cdef Elm_Entry_Context_Menu_Item *item
 
+    property label:
+        """Get the text of the contextual menu item.
+
+        Gets the text of the contextual menu item of entry.
+
+        :type: unicode
+
+        :since: 1.8
+
+        """
+        def __get__(self):
+            return _ctouni(elm_entry_context_menu_item_label_get(self.item))
+
+    property icon:
+        """Get the icon object of the contextual menu item.
+
+        Gets the icon object packed in the contextual menu item of entry.
+
+        :type: (unicode **icon_file**, unicode **icon_group**, :ref:`Icon type 
<Elm_Icon_Type>` **icon_type**)
+
+        :since: 1.8
+
+        """
+        def __get__(self):
+            cdef:
+                const_char *icon_file, *icon_group
+                Elm_Icon_Type icon_type
+            elm_entry_context_menu_item_icon_get(self.item,
+                &icon_file,
+                &icon_group,
+                &icon_type)
+
+            return (_ctouni(icon_file), _ctouni(icon_group), icon_type)
+
+
 class EntryAnchorInfo(object):
     """
 
@@ -1809,6 +1846,13 @@ cdef class Entry(Object):
     def callback_activated_del(self, func):
         self._callback_del("activated", func)
 
+    def callback_aborted_add(self, func, *args, **kwargs):
+        """The enter key was pressed on a single line entry."""
+        self._callback_add("aborted", func, *args, **kwargs)
+
+    def callback_aborted_del(self, func):
+        self._callback_del("aborted", func)
+
     def callback_press_add(self, func, *args, **kwargs):
         """A mouse button has been pressed on the entry."""
         self._callback_add("press", func, *args, **kwargs)

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to