summaryrefslogtreecommitdiff
path: root/efl
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-01 17:31:09 +0200
committerdavemds <dave@gurumeditation.it>2014-08-01 17:31:09 +0200
commitf5dd70b70fd9e1ae529b6f55c1c81bff3677da16 (patch)
tree02fd93d3ed9ce9ef3572fc35d0e055a3793797da /efl
parentd8174aea3d6f185eca3a84934ef4bba67d713b91 (diff)
Gengrid: implemented search_by_text_item_get(), with a proper test
Diffstat (limited to 'efl')
-rw-r--r--efl/elementary/gengrid.pxd4
-rw-r--r--efl/elementary/gengrid_widget.pxi40
2 files changed, 43 insertions, 1 deletions
diff --git a/efl/elementary/gengrid.pxd b/efl/elementary/gengrid.pxd
index cc705c6..a8f5bb9 100644
--- a/efl/elementary/gengrid.pxd
+++ b/efl/elementary/gengrid.pxd
@@ -4,7 +4,7 @@ from efl.c_eo cimport Eo
4from object_item cimport Elm_Object_Item 4from object_item cimport Elm_Object_Item
5from general cimport Elm_Tooltip_Item_Content_Cb 5from general cimport Elm_Tooltip_Item_Content_Cb
6from enums cimport Elm_Genlist_Item_Scrollto_Type, Elm_Object_Select_Mode, \ 6from enums cimport Elm_Genlist_Item_Scrollto_Type, Elm_Object_Select_Mode, \
7 Elm_Object_Multi_Select_Mode 7 Elm_Object_Multi_Select_Mode, Elm_Glob_Match_Flags
8from efl.ecore.enums cimport Ecore_Pos_Map 8from efl.ecore.enums cimport Ecore_Pos_Map
9 9
10cdef extern from "Elementary.h": 10cdef extern from "Elementary.h":
@@ -101,3 +101,5 @@ cdef extern from "Elementary.h":
101 Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *item) 101 Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *item)
102 Elm_Object_Item * elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth) 102 Elm_Object_Item * elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth)
103 Elm_Object_Item * elm_gengrid_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret) 103 Elm_Object_Item * elm_gengrid_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret)
104 Elm_Object_Item * elm_gengrid_search_by_text_item_get(const Evas_Object *obj, Elm_Object_Item *item_to_search_from, const char *part_name, const char *pattern, Elm_Glob_Match_Flags flags)
105
diff --git a/efl/elementary/gengrid_widget.pxi b/efl/elementary/gengrid_widget.pxi
index b0a8900..4e6af66 100644
--- a/efl/elementary/gengrid_widget.pxi
+++ b/efl/elementary/gengrid_widget.pxi
@@ -558,6 +558,46 @@ cdef class Gengrid(Object):
558 return _object_item_to_python(ret), xposret, yposret 558 return _object_item_to_python(ret), xposret, yposret
559 559
560 560
561 def search_by_text_item_get(self, GengridItem item_to_search_from,
562 part_name, pattern, Elm_Glob_Match_Flags flags):
563 """Search gengrid item by given string.
564
565 This function uses globs (like "\*.jpg") for searching and takes
566 search flags as last parameter. That is a bitfield with values
567 to be ored together or 0 for no flags.
568
569 :param item_to_search_from: item to start search from, or None to
570 search from the first item.
571 :type item_to_search_from: :py:class:`GengridItem`
572 :param part_name: Name of the TEXT part of gengrid item to search
573 string in (usually "elm.text").
574 :type part_name: string
575 :param pattern: The search pattern.
576 :type pattern: string
577 :param flags: Search flags
578 :type flags: :ref:`Elm_Glob_Match_Flags`
579
580 :return: The first item found
581 :rtype: :py:class:`GengridItem`
582
583 .. versionadded:: 1.11
584
585 """
586 cdef Elm_Object_Item *from_item = NULL
587
588 if isinstance(part_name, unicode):
589 part_name = PyUnicode_AsUTF8String(part_name)
590 if isinstance(pattern, unicode):
591 pattern = PyUnicode_AsUTF8String(pattern)
592 if item_to_search_from is not None:
593 from_item = _object_item_from_python(item_to_search_from)
594
595 return _object_item_to_python(elm_gengrid_search_by_text_item_get(
596 self.obj, from_item,
597 <const char *>part_name if part_name is not None else NULL,
598 <const char *>pattern if pattern is not None else NULL,
599 flags))
600
561 # 601 #
562 # TODO: Drag and Drop 602 # TODO: Drag and Drop
563 # ============= 603 # =============