kuuko pushed a commit to branch master.

commit 0ce7f8447152b26efd21e424c70fe1c785439a80
Author: Kai Huuhko <[email protected]>
Date:   Sat Apr 13 19:12:19 2013 +0000

    Elementary: Add some missing API to Toolbar.
---
 efl/elementary/enums.pxd   |   7 +++
 efl/elementary/toolbar.pxd |  31 ++++++-----
 efl/elementary/toolbar.pyx | 128 +++++++++++++++++++++++++++++++++++++++------
 3 files changed, 137 insertions(+), 29 deletions(-)

diff --git a/efl/elementary/enums.pxd b/efl/elementary/enums.pxd
index be11359..5d48085 100644
--- a/efl/elementary/enums.pxd
+++ b/efl/elementary/enums.pxd
@@ -364,6 +364,13 @@ cdef extern from "Elementary.h":
         ELM_THUMB_ANIMATION_STOP
         ELM_THUMB_ANIMATION_LAST
 
+    ctypedef enum Elm_Toolbar_Item_Scrollto_Type:
+        ELM_TOOLBAR_ITEM_SCROLLTO_NONE
+        ELM_TOOLBAR_ITEM_SCROLLTO_IN
+        ELM_TOOLBAR_ITEM_SCROLLTO_FIRST
+        ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE
+        ELM_TOOLBAR_ITEM_SCROLLTO_LAST
+
     ctypedef enum Elm_Toolbar_Shrink_Mode:
         ELM_TOOLBAR_SHRINK_NONE
         ELM_TOOLBAR_SHRINK_HIDE
diff --git a/efl/elementary/toolbar.pxd b/efl/elementary/toolbar.pxd
index 46356fe..ea91d61 100644
--- a/efl/elementary/toolbar.pxd
+++ b/efl/elementary/toolbar.pxd
@@ -1,6 +1,7 @@
-from efl.evas cimport Eina_Bool, Evas_Object, Evas_Smart_Cb
+from efl.evas cimport Eina_Bool, Evas_Object, const_Evas_Object, Evas_Smart_Cb
 from object_item cimport Elm_Object_Item, ObjectItem
-from enums cimport Elm_Object_Select_Mode, Elm_Toolbar_Shrink_Mode, 
Elm_Icon_Lookup_Order
+from enums cimport Elm_Object_Select_Mode, Elm_Toolbar_Shrink_Mode, \
+    Elm_Icon_Lookup_Order, Elm_Toolbar_Item_Scrollto_Type
 from libc.string cimport const_char
 
 cdef extern from "Elementary.h":
@@ -17,9 +18,9 @@ cdef extern from "Elementary.h":
     void                     elm_toolbar_icon_order_lookup_set(Evas_Object 
*obj, Elm_Icon_Lookup_Order order)
     Elm_Icon_Lookup_Order    elm_toolbar_icon_order_lookup_get(Evas_Object 
*obj)
     Elm_Object_Item         *elm_toolbar_item_append(Evas_Object *obj, 
const_char *icon, const_char *label, Evas_Smart_Cb func, void *data)
-    Elm_Object_Item         *elm_toolbar_item_prepend(Evas_Object *obj, 
const_char *icon, const_char *label, Evas_Smart_Cb func, void *data)
-    Elm_Object_Item         *elm_toolbar_item_insert_before(Evas_Object *obj, 
Elm_Object_Item *before, const_char *icon, const_char *label, Evas_Smart_Cb 
func, void *data)
-    Elm_Object_Item         *elm_toolbar_item_insert_after(Evas_Object *obj, 
Elm_Object_Item *after, const_char *icon, const_char *label, Evas_Smart_Cb 
func, void *data)
+    # TODO: Elm_Object_Item         *elm_toolbar_item_prepend(Evas_Object 
*obj, const_char *icon, const_char *label, Evas_Smart_Cb func, void *data)
+    # TODO: Elm_Object_Item         
*elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, 
const_char *icon, const_char *label, Evas_Smart_Cb func, void *data)
+    # TODO: Elm_Object_Item         *elm_toolbar_item_insert_after(Evas_Object 
*obj, Elm_Object_Item *after, const_char *icon, const_char *label, 
Evas_Smart_Cb func, void *data)
     Elm_Object_Item         *elm_toolbar_first_item_get(Evas_Object *obj)
     Elm_Object_Item         *elm_toolbar_last_item_get(Evas_Object *obj)
     Elm_Object_Item         *elm_toolbar_item_next_get(Elm_Object_Item *item)
@@ -35,12 +36,14 @@ cdef extern from "Elementary.h":
     const_char *             elm_toolbar_item_icon_get(Elm_Object_Item *item)
     Evas_Object             *elm_toolbar_item_object_get(Elm_Object_Item *item)
     Evas_Object             *elm_toolbar_item_icon_object_get(Elm_Object_Item 
*item)
-    Eina_Bool                elm_toolbar_item_icon_memfile_set(Elm_Object_Item 
*item, const_char *img, const_char *size, const_char *format, const_char *key)
+    # TODO: Eina_Bool                
elm_toolbar_item_icon_memfile_set(Elm_Object_Item *item, const_char *img, 
const_char *size, const_char *format, const_char *key)
     Eina_Bool                elm_toolbar_item_icon_file_set(Elm_Object_Item 
*item, const_char *file, const_char *key)
     void                     elm_toolbar_item_separator_set(Elm_Object_Item 
*item, Eina_Bool separator)
     Eina_Bool                elm_toolbar_item_separator_get(Elm_Object_Item 
*item)
     void                     elm_toolbar_shrink_mode_set(Evas_Object *obj, 
Elm_Toolbar_Shrink_Mode shrink_mode)
     Elm_Toolbar_Shrink_Mode  elm_toolbar_shrink_mode_get(Evas_Object *obj)
+    void                     elm_toolbar_transverse_expanded_set(Evas_Object 
*obj, Eina_Bool transverse_expanded)
+    Eina_Bool                
elm_toolbar_transverse_expanded_get(const_Evas_Object *obj)
     void                     elm_toolbar_homogeneous_set(Evas_Object *obj, 
Eina_Bool homogeneous)
     Eina_Bool                elm_toolbar_homogeneous_get(Evas_Object *obj)
     void                     elm_toolbar_menu_parent_set(Evas_Object *obj, 
Evas_Object *parent)
@@ -50,12 +53,12 @@ cdef extern from "Elementary.h":
     void                     elm_toolbar_item_menu_set(Elm_Object_Item *item, 
Eina_Bool menu)
     Evas_Object             *elm_toolbar_item_menu_get(Elm_Object_Item *item)
     Elm_Toolbar_Item_State  *elm_toolbar_item_state_add(Elm_Object_Item *item, 
const_char *icon, const_char *label, Evas_Smart_Cb func, void *data)
-    Eina_Bool                elm_toolbar_item_state_del(Elm_Object_Item *item, 
Elm_Toolbar_Item_State *state)
-    Eina_Bool                elm_toolbar_item_state_set(Elm_Object_Item *item, 
Elm_Toolbar_Item_State *state)
-    void                     elm_toolbar_item_state_unset(Elm_Object_Item 
*item)
-    Elm_Toolbar_Item_State  *elm_toolbar_item_state_get(Elm_Object_Item *item)
-    Elm_Toolbar_Item_State  *elm_toolbar_item_state_next(Elm_Object_Item *item)
-    Elm_Toolbar_Item_State  *elm_toolbar_item_state_prev(Elm_Object_Item *item)
+    # TODO: Eina_Bool                
elm_toolbar_item_state_del(Elm_Object_Item *item, Elm_Toolbar_Item_State *state)
+    # TODO: Eina_Bool                
elm_toolbar_item_state_set(Elm_Object_Item *item, Elm_Toolbar_Item_State *state)
+    # TODO: void                     
elm_toolbar_item_state_unset(Elm_Object_Item *item)
+    # TODO: Elm_Toolbar_Item_State  
*elm_toolbar_item_state_get(Elm_Object_Item *item)
+    # TODO: Elm_Toolbar_Item_State  
*elm_toolbar_item_state_next(Elm_Object_Item *item)
+    # TODO: Elm_Toolbar_Item_State  
*elm_toolbar_item_state_prev(Elm_Object_Item *item)
     void                     elm_toolbar_horizontal_set(Evas_Object *obj, 
Eina_Bool horizontal)
     Eina_Bool                elm_toolbar_horizontal_get(Evas_Object *obj)
     unsigned int             elm_toolbar_items_count(Evas_Object *obj)
@@ -64,3 +67,7 @@ cdef extern from "Elementary.h":
     void                     elm_toolbar_select_mode_set(Evas_Object *obj, 
Elm_Object_Select_Mode mode)
     Elm_Object_Select_Mode   elm_toolbar_select_mode_get(Evas_Object *obj)
 
+    void                     elm_toolbar_reorder_mode_set(Evas_Object *obj, 
Eina_Bool reorder_mode)
+    Eina_Bool                elm_toolbar_reorder_mode_get(const_Evas_Object 
*obj)
+    void                     elm_toolbar_item_show(Elm_Object_Item *it, 
Elm_Toolbar_Item_Scrollto_Type type)
+    void                     elm_toolbar_item_bring_in(Elm_Object_Item *it, 
Elm_Toolbar_Item_Scrollto_Type type)
diff --git a/efl/elementary/toolbar.pyx b/efl/elementary/toolbar.pyx
index 311857c..6c05cbe 100644
--- a/efl/elementary/toolbar.pyx
+++ b/efl/elementary/toolbar.pyx
@@ -107,6 +107,33 @@ Default text parts of the toolbar items that you can use 
for are:
 
     Expand all items according the size of the toolbar.
 
+
+.. _Elm_Toolbar_Item_Scrollto_Type:
+
+.. rubric:: Toolbar item scrollto types
+
+    Where to position the item in the toolbar.
+
+.. data:: ELM_TOOLBAR_ITEM_SCROLLTO_NONE
+
+    No scrollto
+
+.. data:: ELM_TOOLBAR_ITEM_SCROLLTO_IN
+
+    To the nearest viewport
+
+.. data:: ELM_TOOLBAR_ITEM_SCROLLTO_FIRST
+
+    To the first of viewport
+
+.. data:: ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE
+
+    To the middle of viewport
+
+.. data:: ELM_TOOLBAR_ITEM_SCROLLTO_LAST
+
+    To the last of viewport
+
 """
 
 include "widget_header.pxi"
@@ -135,6 +162,12 @@ ELM_TOOLBAR_SHRINK_MENU = enums.ELM_TOOLBAR_SHRINK_MENU
 ELM_TOOLBAR_SHRINK_EXPAND = enums.ELM_TOOLBAR_SHRINK_EXPAND
 ELM_TOOLBAR_SHRINK_LAST = enums.ELM_TOOLBAR_SHRINK_LAST
 
+ELM_TOOLBAR_ITEM_SCROLLTO_NONE = enums.ELM_TOOLBAR_ITEM_SCROLLTO_NONE
+ELM_TOOLBAR_ITEM_SCROLLTO_IN = enums.ELM_TOOLBAR_ITEM_SCROLLTO_IN
+ELM_TOOLBAR_ITEM_SCROLLTO_FIRST = enums.ELM_TOOLBAR_ITEM_SCROLLTO_FIRST
+ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE = enums.ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE
+ELM_TOOLBAR_ITEM_SCROLLTO_LAST = enums.ELM_TOOLBAR_ITEM_SCROLLTO_LAST
+
 cdef class ToolbarItemState(object):
 
     """A state for a :py:class:`ToolbarItem`."""
@@ -332,27 +365,27 @@ cdef class ToolbarItem(ObjectItem):
     def icon_object_get(self):
         return 
object_from_instance(elm_toolbar_item_icon_object_get(self.item))
 
-    def icon_memfile_set(self, img, size, format, key):
-        """Set the icon associated with item to an image in a binary buffer.
+    # TODO:
+    # def icon_memfile_set(self, img, size, format, key):
+    #     """Set the icon associated with item to an image in a binary buffer.
 
-        .. note:: The icon image set by this function can be changed
-            by :py:attr:`icon`.
+    #     .. note:: The icon image set by this function can be changed
+    #         by :py:attr:`icon`.
 
-        :param img: The binary data that will be used as an image
-        :param size: The size of binary data ``img``
-        :type size: int
-        :param format: Optional format of ``img`` to pass to the image loader
-        :type format: string
-        :param key: Optional key of ``img`` to pass to the image loader (eg.
-            if ``img`` is an edje file)
-        :type key: string
+    #     :param img: The binary data that will be used as an image
+    #     :param size: The size of binary data ``img``
+    #     :type size: int
+    #     :param format: Optional format of ``img`` to pass to the image loader
+    #     :type format: string
+    #     :param key: Optional key of ``img`` to pass to the image loader (eg.
+    #         if ``img`` is an edje file)
+    #     :type key: string
 
-        :return: (``True`` = success, ``False`` = error)
-        :rtype: bool
+    #     :return: (``True`` = success, ``False`` = error)
+    #     :rtype: bool
 
-        """
-        return False
-        #TODO: return bool(elm_toolbar_item_icon_memfile_set(self.item, img, 
size, format, key))
+    #     """
+    #     return bool(elm_toolbar_item_icon_memfile_set(self.item, img, size, 
format, key))
 
     property icon_file:
         """Set the icon associated with item to an image in a binary buffer.
@@ -469,6 +502,27 @@ cdef class ToolbarItem(ObjectItem):
     #TODO def state_prev(self):
         #return elm_toolbar_item_state_prev(self.item)
 
+    def show(self, Elm_Toolbar_Item_Scrollto_Type scrollto_type):
+        """Show this item, when the toolbar can be scrolled.
+
+        :see: :py:func:`bring_in`
+
+        :since: 1.8
+
+        """
+        elm_toolbar_item_show(self.item, scrollto_type)
+
+    def bring_in(self, Elm_Toolbar_Item_Scrollto_Type scrollto_type):
+        """Show this item with scroll animation, when the toolbar can be 
scrolled.
+
+        :see: :py:func:`show`
+
+        :since: 1.8
+
+        """
+        elm_toolbar_item_bring_in(self.item, scrollto_type)
+
+
 cdef class Toolbar(Object):
 
     """
@@ -757,6 +811,28 @@ cdef class Toolbar(Object):
     def shrink_mode_get(self):
         return elm_toolbar_shrink_mode_get(self.obj)
 
+    property transverse_expanded:
+        """Item's transverse expansion.
+
+        :type: bool
+
+        This will expand the transverse length of the item according the
+        transverse length of the toolbar. The default is what the transverse
+        length of the item is set according its min value (this property is 
False).
+
+        """
+        def __set__(self, value):
+            self.transverse_expanded_set(value)
+
+        def __get__(self):
+            return self.transverse_expanded_get()
+
+    cpdef transverse_expanded_set(self, transverse_expanded):
+        elm_toolbar_transverse_expanded_set(self.obj, transverse_expanded)
+
+    cpdef transverse_expanded_get(self):
+        return bool(elm_toolbar_transverse_expanded_get(self.obj))
+
     property homogeneous:
         """Homogeneous mode.
 
@@ -900,6 +976,24 @@ cdef class Toolbar(Object):
     def select_mode_get(self):
         return elm_toolbar_select_mode_get(self.obj)
 
+    property reorder_mode:
+        """Reorder mode
+
+        :type: bool
+
+        """
+        def __set__(self, value):
+            self.reorder_mode_set(value)
+
+        def __get__(self):
+            return self.reorder_mode_get()
+
+    cpdef reorder_mode_set(self, reorder_mode):
+        elm_toolbar_reorder_mode_set(self.obj, reorder_mode)
+
+    cpdef reorder_mode_get(self):
+        return bool(elm_toolbar_reorder_mode_get(self.obj))
+
     def callback_clicked_add(self, func, *args, **kwargs):
         """When the user clicks on a toolbar item and becomes selected."""
         self._callback_add("clicked", 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