diff options
author | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 12:19:20 +0100 |
---|---|---|
committer | Dave Andreoli <dave@gurumeditation.it> | 2016-01-23 12:19:20 +0100 |
commit | 4f8dfc195f98bd1a12efe4f1c5d2259e75d2b4c1 (patch) | |
tree | c4d4d9d448e30a238fb7029a955782141faf0eaf /efl | |
parent | 078d440e05c370daeada4c1ad3f3526a74844995 (diff) |
New elm widget: Combobox
with docs and example
Diffstat (limited to 'efl')
-rw-r--r-- | efl/elementary/__init__.pyx | 1 | ||||
-rw-r--r-- | efl/elementary/combobox.pxi | 116 | ||||
-rw-r--r-- | efl/elementary/combobox_cdef.pxi | 9 |
3 files changed, 126 insertions, 0 deletions
diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx index 2c0ca00..b3f7382 100644 --- a/efl/elementary/__init__.pyx +++ b/efl/elementary/__init__.pyx | |||
@@ -610,6 +610,7 @@ include "calendar.pxi" | |||
610 | include "check.pxi" | 610 | include "check.pxi" |
611 | include "clock.pxi" | 611 | include "clock.pxi" |
612 | include "colorselector.pxi" | 612 | include "colorselector.pxi" |
613 | include "combobox.pxi" | ||
613 | include "configuration.pxi" | 614 | include "configuration.pxi" |
614 | include "conformant.pxi" | 615 | include "conformant.pxi" |
615 | include "ctxpopup.pxi" | 616 | include "ctxpopup.pxi" |
diff --git a/efl/elementary/combobox.pxi b/efl/elementary/combobox.pxi new file mode 100644 index 0000000..5253468 --- /dev/null +++ b/efl/elementary/combobox.pxi | |||
@@ -0,0 +1,116 @@ | |||
1 | # Copyright (C) 2007-2015 various contributors (see AUTHORS) | ||
2 | # | ||
3 | # This file is part of Python-EFL. | ||
4 | # | ||
5 | # Python-EFL is free software; you can redistribute it and/or | ||
6 | # modify it under the terms of the GNU Lesser General Public | ||
7 | # License as published by the Free Software Foundation; either | ||
8 | # version 3 of the License, or (at your option) any later version. | ||
9 | # | ||
10 | # Python-EFL is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | # Lesser General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU Lesser General Public License | ||
16 | # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. | ||
17 | # | ||
18 | |||
19 | include "combobox_cdef.pxi" | ||
20 | |||
21 | cdef class _Combobox(Object): | ||
22 | def __init__(self, evasObject parent, *args, **kwargs): | ||
23 | self._set_obj(elm_combobox_add(parent.obj)) | ||
24 | self._set_properties_from_keyword_args(kwargs) | ||
25 | |||
26 | property expanded: | ||
27 | """ Returns whether the combobox is expanded or not. | ||
28 | |||
29 | :type: bool (**readonly**) | ||
30 | |||
31 | """ | ||
32 | def __get__(self): | ||
33 | return bool(elm_combobox_expanded_get(self.obj)) | ||
34 | |||
35 | def expanded_get(self): | ||
36 | return bool(elm_combobox_expanded_get(self.obj)) | ||
37 | |||
38 | def hover_begin(self): | ||
39 | """ This triggers the combobox popup from code, the same as if the user | ||
40 | had clicked the button. | ||
41 | """ | ||
42 | elm_combobox_hover_begin(self.obj) | ||
43 | |||
44 | def hover_end(self): | ||
45 | """ This dismisses the combobox popup as if the user had clicked | ||
46 | outside the hover. | ||
47 | """ | ||
48 | elm_combobox_hover_end(self.obj) | ||
49 | |||
50 | def callback_dismissed_add(self, func, *args, **kwargs): | ||
51 | """ The combobox hover has been dismissed """ | ||
52 | self._callback_add("dismissed", func, args, kwargs) | ||
53 | |||
54 | def callback_dismissed_del(self, func): | ||
55 | self._callback_del("dismissed", func) | ||
56 | |||
57 | def callback_expanded_add(self, func, *args, **kwargs): | ||
58 | """ The combobox hover has been expanded """ | ||
59 | self._callback_add("expanded", func, args, kwargs) | ||
60 | |||
61 | def callback_expanded_del(self, func): | ||
62 | self._callback_del("expanded", func) | ||
63 | |||
64 | def callback_clicked_add(self, func, *args, **kwargs): | ||
65 | """ The combobox button has been clicked """ | ||
66 | self._callback_add("clicked", func, args, kwargs) | ||
67 | |||
68 | def callback_clicked_del(self, func): | ||
69 | self._callback_del("clicked", func) | ||
70 | |||
71 | def callback_item_selected_add(self, func, *args, **kwargs): | ||
72 | """ An item has been selected """ | ||
73 | self._callback_add_full("item,selected", _cb_object_item_conv, | ||
74 | func, args, kwargs) | ||
75 | |||
76 | def callback_item_selected_del(self, func): | ||
77 | self._callback_del_full("item,selected", _cb_object_item_conv, func) | ||
78 | |||
79 | def callback_item_pressed_add(self, func, *args, **kwargs): | ||
80 | """ An item has been pressed """ | ||
81 | self._callback_add_full("item,pressed", _cb_object_item_conv, | ||
82 | func, args, kwargs) | ||
83 | |||
84 | def callback_item_pressed_del(self, func): | ||
85 | self._callback_del_full("item,pressed", _cb_object_item_conv, func) | ||
86 | |||
87 | def callback_filter_done_add(self, func, *args, **kwargs): | ||
88 | """ Item filtering is done """ | ||
89 | self._callback_add("filter,done", func, args, kwargs) | ||
90 | |||
91 | def callback_filter_done_del(self, func): | ||
92 | self._callback_del("filter,done", func) | ||
93 | |||
94 | |||
95 | class Combobox(_Combobox, Button, Entry, Genlist, Hover): | ||
96 | """ | ||
97 | |||
98 | This is the class that actually implements the widget. | ||
99 | |||
100 | .. versionadded:: 1.17 | ||
101 | |||
102 | """ | ||
103 | def __init__(self, evasObject parent, *args, **kwargs): | ||
104 | """Combobox(...) | ||
105 | |||
106 | :param parent: The parent object | ||
107 | :type parent: :py:class:`efl.evas.Object` | ||
108 | :param \**kwargs: All the remaining keyword arguments are interpreted | ||
109 | as properties of the instance | ||
110 | |||
111 | """ | ||
112 | _Combobox.__init__(self, parent, *args, **kwargs) | ||
113 | |||
114 | |||
115 | |||
116 | _object_mapping_register("Elm_Combobox", Combobox) | ||
diff --git a/efl/elementary/combobox_cdef.pxi b/efl/elementary/combobox_cdef.pxi new file mode 100644 index 0000000..8df1cdc --- /dev/null +++ b/efl/elementary/combobox_cdef.pxi | |||
@@ -0,0 +1,9 @@ | |||
1 | cdef extern from "Elementary.h": | ||
2 | |||
3 | ctypedef cEo Elm_Combobox | ||
4 | |||
5 | Evas_Object * elm_combobox_add(Evas_Object *parent) | ||
6 | Eina_Bool elm_combobox_expanded_get(const Elm_Combobox *obj) | ||
7 | void elm_combobox_hover_begin(Elm_Combobox *obj) | ||
8 | void elm_combobox_hover_end(Elm_Combobox *obj) | ||
9 | |||