summaryrefslogtreecommitdiff
path: root/efl
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-27 20:52:10 +0100
committerdavemds <dave@gurumeditation.it>2014-02-27 20:52:10 +0100
commitc2a34f20ad2ba457b768b66d2730617a1e0d7279 (patch)
treec866fc2fc17334055245300b4b0c9e9148dea177 /efl
parent1bfb4d8922201821e5054e073e544ab6603cd046 (diff)
Python-EFL: Colorselector new 1.9 API
Diffstat (limited to 'efl')
-rw-r--r--efl/elementary/colorselector.pxd7
-rw-r--r--efl/elementary/colorselector.pyx44
2 files changed, 40 insertions, 11 deletions
diff --git a/efl/elementary/colorselector.pxd b/efl/elementary/colorselector.pxd
index c0f814a..8f6b018 100644
--- a/efl/elementary/colorselector.pxd
+++ b/efl/elementary/colorselector.pxd
@@ -1,5 +1,5 @@
1from efl.evas cimport Evas_Object, const_Evas_Object, const_Eina_List 1from efl.evas cimport Evas_Object, const_Evas_Object, const_Eina_List, Eina_Bool
2from object_item cimport Elm_Object_Item 2from object_item cimport Elm_Object_Item, const_Elm_Object_Item
3from enums cimport Elm_Colorselector_Mode 3from enums cimport Elm_Colorselector_Mode
4from libc.string cimport const_char 4from libc.string cimport const_char
5 5
@@ -16,3 +16,6 @@ cdef extern from "Elementary.h":
16 void elm_colorselector_palette_name_set(Evas_Object *obj, const_char *palette_name) 16 void elm_colorselector_palette_name_set(Evas_Object *obj, const_char *palette_name)
17 const_char * elm_colorselector_palette_name_get(Evas_Object *obj) 17 const_char * elm_colorselector_palette_name_get(Evas_Object *obj)
18 const_Eina_List * elm_colorselector_palette_items_get(const_Evas_Object *obj) 18 const_Eina_List * elm_colorselector_palette_items_get(const_Evas_Object *obj)
19 Eina_Bool elm_colorselector_palette_item_selected_get(const_Elm_Object_Item *it)
20 void elm_colorselector_palette_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
21 Elm_Object_Item * elm_colorselector_palette_selected_item_get(const_Evas_Object *obj)
diff --git a/efl/elementary/colorselector.pyx b/efl/elementary/colorselector.pyx
index 1d25540..f75817b 100644
--- a/efl/elementary/colorselector.pyx
+++ b/efl/elementary/colorselector.pyx
@@ -131,6 +131,26 @@ cdef class ColorselectorPaletteItem(ObjectItem):
131 def color_set(self, r, g, b, a): 131 def color_set(self, r, g, b, a):
132 elm_colorselector_palette_item_color_set(self.item, r, g, b, a) 132 elm_colorselector_palette_item_color_set(self.item, r, g, b, a)
133 133
134 property selected:
135 """Whenever the palette item is selected or not.
136
137 :type: bool
138
139 .. versionadded:: 1.9
140
141 """
142 def __get__(self):
143 return bool(elm_colorselector_palette_item_selected_get(self.item))
144
145 def __set__(self, bint selected):
146 elm_colorselector_palette_item_selected_set(self.item, selected)
147
148 def selected_get(self):
149 return bool(elm_colorselector_palette_item_selected_get(self.item))
150 def selected_set(self, bint selected):
151 elm_colorselector_palette_item_selected_set(self.item, selected)
152
153
134cdef class Colorselector(LayoutClass): 154cdef class Colorselector(LayoutClass):
135 155
136 """This is the class that actually implements the widget.""" 156 """This is the class that actually implements the widget."""
@@ -242,22 +262,28 @@ cdef class Colorselector(LayoutClass):
242 262
243 """ 263 """
244 cdef: 264 cdef:
245 const_Eina_List *lst = elm_colorselector_palette_items_get(self.obj)
246 Elm_Object_Item *obj_item
247 int r, g, b, a
248 list ret = list() 265 list ret = list()
249 ColorselectorPaletteItem item 266 const_Eina_List *lst = elm_colorselector_palette_items_get(self.obj)
250 267
251 while lst: 268 while lst:
252 obj_item = <Elm_Object_Item *>lst.data 269 ret.append(_object_item_to_python(<Elm_Object_Item *>lst.data))
253 elm_colorselector_palette_item_color_get(obj_item, &r, &g, &b, &a)
254 item = ColorselectorPaletteItem(r, g, b, a)
255 item._set_obj(obj_item)
256 ret.append(item)
257 lst = lst.next 270 lst = lst.next
258 271
259 return ret 272 return ret
260 273
274 def palette_selected_item_get(self):
275 """palette_selected_item_get()
276
277 Get the selected item in the palette.
278
279 :return: the selected item.
280 :rtype: list of :py:class:`ColorselectorPaletteItem`
281
282 .. versionadded:: 1.9
283
284 """
285 cdef Elm_Object_Item *it = elm_colorselector_palette_selected_item_get(self.obj)
286 return _object_item_to_python(it)
261 287
262 def callback_changed_add(self, func, *args, **kwargs): 288 def callback_changed_add(self, func, *args, **kwargs):
263 """When the color value changes on selector""" 289 """When the color value changes on selector"""