summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>2014-07-31 16:12:36 +0300
committerVyacheslav Reutskiy <v.reutskiy@samsung.com>2014-07-31 16:12:36 +0300
commit8472715b711f72e87afd5f381ac8798acd15c2e8 (patch)
tree7df3eb82f6e3ac97738a2d873173cc0751393e76
parenta7a9c01a557599268db0e001fb64cf7500f9e261 (diff)
parentb73398eb0aa15035ca1923e21c1c1a85ef8e25fe (diff)
Merge branch 'develop'0.1.5
-rw-r--r--NEWS9
-rw-r--r--configure.ac2
-rw-r--r--data/themes/default.edc2
-rw-r--r--data/themes/macro.edc2
-rw-r--r--data/themes/widgets/combobox.edc21
-rw-r--r--data/themes/widgets/images/dropdown-list-bg.pngbin264 -> 0 bytes
-rw-r--r--data/themes/widgets/scroller.edc12
-rw-r--r--data/themes/widgets/tabs.edc2
-rw-r--r--examples/combobox_example.c12
-rw-r--r--src/lib/Ewe.h34
-rw-r--r--src/lib/Makefile.am1
-rw-r--r--src/lib/ewe_combobox.c129
-rw-r--r--src/lib/ewe_entry.c1
-rw-r--r--src/lib/ewe_main.h8
-rw-r--r--src/lib/ewe_widget_combobox.h2
-rw-r--r--src/lib/ewe_widget_entry.h1
16 files changed, 128 insertions, 110 deletions
diff --git a/NEWS b/NEWS
index 2f400c4..eab2ed5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,14 @@
1========= 1=========
2Ewe 0.1.4 2Ewe 0.1.5
3========= 3=========
4 4
5Changes since 0.1.4
6-------------------
7
8Fixes:
9 * Combobox: refactoring;
10 * Combobox: update style for drop down list.
11
5Changes since 0.1.3 12Changes since 0.1.3
6------------------- 13-------------------
7 14
diff --git a/configure.ac b/configure.ac
index 764bca1..6b07b80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1EWE_VERSION([0], [1], [4]) 1EWE_VERSION([0], [1], [5])
2 2
3AC_INIT([ewe], [ewe_version], [enlightenment-devel@lists.sourceforge.net]) 3AC_INIT([ewe], [ewe_version], [enlightenment-devel@lists.sourceforge.net])
4AC_PREREQ([2.60]) 4AC_PREREQ([2.60])
diff --git a/data/themes/default.edc b/data/themes/default.edc
index 3dda8e0..ab632c7 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -1,3 +1,5 @@
1data.item: "version" "110";
2
1collections { 3collections {
2 #include "macro.edc" 4 #include "macro.edc"
3 #include "text_styles.edc" 5 #include "text_styles.edc"
diff --git a/data/themes/macro.edc b/data/themes/macro.edc
index fa89931..459c972 100644
--- a/data/themes/macro.edc
+++ b/data/themes/macro.edc
@@ -40,7 +40,7 @@ fonts {
40 40
41#define COMBOBOX_ITEM_TEXT_COLOR 174 176 177 255; 41#define COMBOBOX_ITEM_TEXT_COLOR 174 176 177 255;
42#define COMBOBOX_ITEM_MOUSEIN_BG 38 39 41 255; 42#define COMBOBOX_ITEM_MOUSEIN_BG 38 39 41 255;
43#define COMBOBOX_ITEM_PADDING 10 0; 43#define COMBOBOX_ITEM_PADDING 5 0;
44#define COMBOBOX_TEXT_COLOR 213 213 213 255; 44#define COMBOBOX_TEXT_COLOR 213 213 213 255;
45 45
46#define ENTRY_GLOW_SUCCESS_COLOR 0 213 0 255; 46#define ENTRY_GLOW_SUCCESS_COLOR 0 213 0 255;
diff --git a/data/themes/widgets/combobox.edc b/data/themes/widgets/combobox.edc
index c790510..d109315 100644
--- a/data/themes/widgets/combobox.edc
+++ b/data/themes/widgets/combobox.edc
@@ -184,26 +184,19 @@ group { name: "ewe/combobox/base/default";
184} 184}
185 185
186group { name: "ewe/combobox/expander/default"; 186group { name: "ewe/combobox/expander/default";
187 images {
188 image: "dropdown-list-bg.png" COMP;
189 }
190 parts{ 187 parts{
191 part { name: "bg"; 188 part { name: "bg";
192 type: IMAGE; 189 type: RECT;
193 description { state: "default" 0.0; 190 description { state: "default" 0.0;
194 image { 191 color: 52 53 55 255;
195 normal: "dropdown-list-bg.png";
196 border: 4 4 4 4;
197 }
198 color: WHITE_COLOR;
199 } 192 }
200 } 193 }
201 part { name: "top.offset"; 194 part { name: "top.offset";
202 type: SPACER; 195 type: SPACER;
203 description { state: "default"; 196 description { state: "default";
204 align: 0.0 0.0; 197 align: 0.0 0.0;
205 min: 5 5; 198 min: 2 2;
206 max: 5 5; 199 max: 2 2;
207 rel1.to: "bg"; 200 rel1.to: "bg";
208 } 201 }
209 } 202 }
@@ -211,8 +204,8 @@ group { name: "ewe/combobox/expander/default";
211 type: SPACER; 204 type: SPACER;
212 description { state: "default"; 205 description { state: "default";
213 align: 1.0 1.0; 206 align: 1.0 1.0;
214 min: 5 15; 207 min: 2 2;
215 max: 5 15; 208 max: 2 2;
216 rel2.to: "bg"; 209 rel2.to: "bg";
217 } 210 }
218 } 211 }
@@ -266,7 +259,7 @@ group {name: "ewe/combobox/item/content/default";
266 text { 259 text {
267 font: FN; 260 font: FN;
268 size: 12; 261 size: 12;
269 align: 0.0 0.0; 262 align: 0.0 0.5;
270 } 263 }
271 rel1 { 264 rel1 {
272 to: "left.offset"; 265 to: "left.offset";
diff --git a/data/themes/widgets/images/dropdown-list-bg.png b/data/themes/widgets/images/dropdown-list-bg.png
deleted file mode 100644
index 2bacf39..0000000
--- a/data/themes/widgets/images/dropdown-list-bg.png
+++ /dev/null
Binary files differ
diff --git a/data/themes/widgets/scroller.edc b/data/themes/widgets/scroller.edc
index a5eb66c..9feceec 100644
--- a/data/themes/widgets/scroller.edc
+++ b/data/themes/widgets/scroller.edc
@@ -47,7 +47,6 @@ group { name: "ewe/scroller/base/default";
47 description { state: "hidden" 0.0; 47 description { state: "hidden" 0.0;
48 inherit: "default" 0.0; 48 inherit: "default" 0.0;
49 min: 0 0; 49 min: 0 0;
50 max: 0 -1;
51 } 50 }
52 } 51 }
53 part { name: "cross"; 52 part { name: "cross";
@@ -157,19 +156,15 @@ group { name: "ewe/scroller/base/default";
157 align: 0.0 1.0; 156 align: 0.0 1.0;
158 rel1 { 157 rel1 {
159 relative: 0.0 1.0; 158 relative: 0.0 1.0;
160 offset: 0 -2;
161 } 159 }
162 rel2 { 160 rel2 {
163 relative: 0.0 1.0; 161 relative: 0.0 1.0;
164 to_x: "sb_vbar"; 162 to_x: "sb_vbar";
165 offset: -1 -2;
166 } 163 }
167 } 164 }
168 description { state: "hidden" 0.0; 165 description { state: "hidden" 0.0;
169 inherit: "default" 0.0; 166 inherit: "default" 0.0;
170 min: 0 0; 167 min: 0 0;
171 max: -1 0;
172 rel2.offset: 0 8;
173 } 168 }
174 } 169 }
175 part { name: "sb_hbar_base"; 170 part { name: "sb_hbar_base";
@@ -180,7 +175,6 @@ group { name: "ewe/scroller/base/default";
180 rel1 { 175 rel1 {
181 relative: 0.0 0.0; 176 relative: 0.0 0.0;
182 to: "sb_hbar"; 177 to: "sb_hbar";
183 offset: -1 -1;
184 } 178 }
185 rel2 { 179 rel2 {
186 relative: 1.0 1.0; 180 relative: 1.0 1.0;
@@ -264,7 +258,6 @@ group { name: "ewe/scroller/base/default";
264 type: SWALLOW; 258 type: SWALLOW;
265 clip_to: "clipper"; 259 clip_to: "clipper";
266 description { state: "default" 0.0; 260 description { state: "default" 0.0;
267 rel1.offset: 0 1;
268 rel2 { 261 rel2 {
269 relative: 0.0 0.0; 262 relative: 0.0 0.0;
270 to_x: "sb_vbar"; 263 to_x: "sb_vbar";
@@ -276,7 +269,6 @@ group { name: "ewe/scroller/base/default";
276 type: SWALLOW; 269 type: SWALLOW;
277 clip_to: "clipper"; 270 clip_to: "clipper";
278 description { state: "default" 0.0; 271 description { state: "default" 0.0;
279 rel1.offset: 0 1;
280 rel2 { 272 rel2 {
281 relative: 0.0 0.0; 273 relative: 0.0 0.0;
282 to_x: "sb_vbar"; 274 to_x: "sb_vbar";
@@ -303,7 +295,6 @@ group { name: "ewe/scroller/base/default";
303 border: 2 2 2 2; 295 border: 2 2 2 2;
304 } 296 }
305 fill.smooth: 0; 297 fill.smooth: 0;
306 min: 8 8;
307 max: 8 -1; 298 max: 8 -1;
308 rel1.to: "sb_vbar_base"; 299 rel1.to: "sb_vbar_base";
309 rel2 { 300 rel2 {
@@ -322,15 +313,12 @@ group { name: "ewe/scroller/base/default";
322 border: 2 2 2 2; 313 border: 2 2 2 2;
323 } 314 }
324 fill.smooth: 0; 315 fill.smooth: 0;
325 min: 8 8;
326 max: -1 8; 316 max: -1 8;
327 rel1 { 317 rel1 {
328 to: "sb_hbar_base"; 318 to: "sb_hbar_base";
329 offset: 0 -1;
330 } 319 }
331 rel2 { 320 rel2 {
332 to: "sb_hbar_base"; 321 to: "sb_hbar_base";
333 offset: 1 0;
334 } 322 }
335 } 323 }
336 } 324 }
diff --git a/data/themes/widgets/tabs.edc b/data/themes/widgets/tabs.edc
index 44426b2..b8dab76 100644
--- a/data/themes/widgets/tabs.edc
+++ b/data/themes/widgets/tabs.edc
@@ -51,7 +51,7 @@ group { name: "ewe/tabs/vertical/default";
51 part { name: "bg"; 51 part { name: "bg";
52 type: RECT; 52 type: RECT;
53 description { state: "default" 0.0; 53 description { state: "default" 0.0;
54 color: TABS_BG_COLOR; 54 color: TRANSPARENT_COLOR;
55 } 55 }
56 } 56 }
57 part { name: "tabs_area"; 57 part { name: "tabs_area";
diff --git a/examples/combobox_example.c b/examples/combobox_example.c
index 60eafcf..792da17 100644
--- a/examples/combobox_example.c
+++ b/examples/combobox_example.c
@@ -32,6 +32,7 @@ static void _fcb(void *data,
32EAPI_MAIN int 32EAPI_MAIN int
33elm_main(int argc, char **argv) 33elm_main(int argc, char **argv)
34{ 34{
35 int i;
35 Evas_Object *win, *cb; 36 Evas_Object *win, *cb;
36 ewe_init(0, 0); 37 ewe_init(0, 0);
37 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 38 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -51,17 +52,20 @@ elm_main(int argc, char **argv)
51 ewe_combobox_select_item_set(cb, 0); 52 ewe_combobox_select_item_set(cb, 0);
52 evas_object_smart_callback_add(cb, "selected", _sel, NULL); 53 evas_object_smart_callback_add(cb, "selected", _sel, NULL);
53 54
54 printf("Raiden's index before item deleting is %d\n", item->index); 55 for(i = 0; i < 30; i++)
56 ewe_combobox_item_add(cb, "Kung Lao");
57 /* printf("Raiden's index before item deleting is %d\n", item->index);
55 ewe_combobox_item_del(cb, it); 58 ewe_combobox_item_del(cb, it);
56 printf("Raiden's index after item deleting is %d\n", item->index); 59 printf("Raiden's index after item deleting is %d\n", item->index);*/
57 60
58 // ewe_combobox_items_list_free(cb ,EINA_TRUE); 61 // ewe_combobox_items_list_free(cb ,EINA_TRUE);
59 62
60 evas_object_resize(cb, 220, 70); 63 evas_object_resize(cb, 300, 200);
61 evas_object_move(cb, 100, 100); 64 evas_object_move(cb, 150, 150);
62 evas_object_show(cb); 65 evas_object_show(cb);
63 66
64 evas_object_resize(win, 500, 500); 67 evas_object_resize(win, 500, 500);
68 evas_object_move(win, 900, 500);
65 evas_object_show(win); 69 evas_object_show(win);
66 70
67 elm_run(); 71 elm_run();
diff --git a/src/lib/Ewe.h b/src/lib/Ewe.h
index 93d2c19..6c6df34 100644
--- a/src/lib/Ewe.h
+++ b/src/lib/Ewe.h
@@ -19,6 +19,40 @@
19#ifndef ELEMENTARY_WIDGET_EXTENSIONS_H 19#ifndef ELEMENTARY_WIDGET_EXTENSIONS_H
20#define ELEMENTARY_WIDGET_EXTENSIONS_H 20#define ELEMENTARY_WIDGET_EXTENSIONS_H
21 21
22#include <Elementary.h>
23
24#ifdef EAPI
25# undef EAPI
26#endif
27
28#ifdef _WIN32
29# ifdef EWE_BUILD
30# ifdef DLL_EXPORT
31# define EAPI __declspec(dllexport)
32# else
33# define EAPI
34# endif
35# else
36# define EAPI __declspec(dllimport)
37# endif
38#else
39# ifdef __GNUC__
40# if __GNUC__ >= 4
41# define EAPI __attribute__ ((visibility("default")))
42# else
43# define EAPI
44# endif
45# else
46# define EAPI
47# endif
48#endif
49
22#include "ewe_main.h" 50#include "ewe_main.h"
51#include "ewe_statusbar.h"
52#include "ewe_combobox.h"
53#include "ewe_ruler.h"
54#include "ewe_entry.h"
55#include "ewe_tabs.h"
56#include "ewe_win.h"
23 57
24#endif /* ELEMENTARY_WIDGET_EXTENTIONS */ 58#endif /* ELEMENTARY_WIDGET_EXTENTIONS */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index cfa3380..c0b4883 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
20-DEFL_EO_API_SUPPORT \ 20-DEFL_EO_API_SUPPORT \
21-DEFL_BETA_API_SUPPORT \ 21-DEFL_BETA_API_SUPPORT \
22-DELM_INTERNAL_API_ARGESFSDFEFC \ 22-DELM_INTERNAL_API_ARGESFSDFEFC \
23-DEWE_BUILD \
23@ELEMENTARY_CFLAGS@ 24@ELEMENTARY_CFLAGS@
24 25
25lib_LTLIBRARIES = libewe.la 26lib_LTLIBRARIES = libewe.la
diff --git a/src/lib/ewe_combobox.c b/src/lib/ewe_combobox.c
index efba027..1704043 100644
--- a/src/lib/ewe_combobox.c
+++ b/src/lib/ewe_combobox.c
@@ -8,9 +8,7 @@ EAPI Eo_Op EWE_OBJ_COMBOBOX_BASE_ID = EO_NOOP;
8#define MY_CLASS EWE_COMBOBOX_CLASS 8#define MY_CLASS EWE_COMBOBOX_CLASS
9#define MY_CLASS_NAME "Ewe_Combobox" 9#define MY_CLASS_NAME "Ewe_Combobox"
10#define MY_CLASS_NAME_LEGACY "ewe_combobox" 10#define MY_CLASS_NAME_LEGACY "ewe_combobox"
11#define NON_ITEM_PADDING 32
12#define MIN_ITEMS 5 11#define MIN_ITEMS 5
13#include <Ecore_X.h>
14 12
15static void _focus_out_cb(void *, Evas_Object *, void *); 13static void _focus_out_cb(void *, Evas_Object *, void *);
16 14
@@ -77,7 +75,7 @@ _exp_window_create(Evas **evas, Ewe_Combobox_Smart_Data *sd)
77 Evas_Object *win; 75 Evas_Object *win;
78 76
79 win = ewe_win_add(sd->top_win, "expand_window", EWE_WIN_DROPDOWN_MENU); 77 win = ewe_win_add(sd->top_win, "expand_window", EWE_WIN_DROPDOWN_MENU);
80 elm_win_autodel_set(win, EINA_FALSE); 78 elm_win_autodel_set(win, EINA_TRUE);
81 elm_win_borderless_set(win, EINA_TRUE); 79 elm_win_borderless_set(win, EINA_TRUE);
82 elm_win_focus_highlight_enabled_set(win, EINA_TRUE); 80 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
83 elm_win_activate(win); 81 elm_win_activate(win);
@@ -87,13 +85,13 @@ _exp_window_create(Evas **evas, Ewe_Combobox_Smart_Data *sd)
87 evas_object_show(win); 85 evas_object_show(win);
88 *evas = evas_object_evas_get(win); 86 *evas = evas_object_evas_get(win);
89 87
90 sd->bg = edje_object_add(*evas); 88 sd->expander = edje_object_add(*evas);
91 edje_object_file_set(sd->bg, EWE_THEME, "ewe/combobox/expander/default"); 89 edje_object_file_set(sd->expander, EWE_THEME, "ewe/combobox/expander/default");
92 evas_object_show(sd->bg); 90 evas_object_show(sd->expander);
93 91
94 sd->scroller = elm_scroller_add(win); 92 sd->scroller = elm_scroller_add(win);
95 elm_object_style_set(sd->scroller, "ewe/default"); 93 elm_object_style_set(sd->scroller, "ewe/default");
96 edje_object_part_swallow(sd->bg, "swallow.part", sd->scroller); 94 edje_object_part_swallow(sd->expander, "swallow.part", sd->scroller);
97 evas_object_size_hint_weight_set(sd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 95 evas_object_size_hint_weight_set(sd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
98 elm_scroller_policy_set(sd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); 96 elm_scroller_policy_set(sd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
99 evas_object_focus_set(sd->scroller, EINA_TRUE); 97 evas_object_focus_set(sd->scroller, EINA_TRUE);
@@ -110,71 +108,68 @@ _exp_window_create(Evas **evas, Ewe_Combobox_Smart_Data *sd)
110static void 108static void
111_expand(Evas_Object *obj) 109_expand(Evas_Object *obj)
112{ 110{
113 int xw, yw, sh, list_count; 111 int top_widget_pos_x, top_widget_pos_y, sc_y_offset, screen_high, list_count;
114 Eina_List *l; 112 Eina_List *l;
115 Evas_Coord x, y, w, h, hh, minh; 113 Evas_Coord combo_x, combo_y, combo_width, combo_high, expander_h, item_h;
116 Evas_Object *win, *cwin; 114 Evas_Object *popup_win;
117 Evas *evas = NULL; 115 Evas *evas = NULL;
118 Ecore_X_Screen *exs;
119 Ewe_Combobox_Item *item; 116 Ewe_Combobox_Item *item;
120 int item_show_down = 0, item_show_up = 0, bg_minw = 0, bg_minh = 0; 117 int item_show_down = 0, item_show_up = 0;
118 int expander_minw = 10, expander_minh = 20;
119 combo_high = item_h = 20;
121 120
122 EWE_COMBOBOX_DATA_GET(obj, sd); 121 EWE_COMBOBOX_DATA_GET(obj, sd);
123 sd->expanded = EINA_TRUE; 122 sd->expanded = EINA_TRUE;
124 list_count = eina_list_count(sd->items); 123 evas_object_geometry_get(sd->combobox, &combo_x, &combo_y, &combo_width, NULL);
125 evas_object_geometry_get(sd->combobox, &x, &y, &w, &h);
126 edje_object_signal_emit(sd->combobox, "ewe,state,expanded", "ewe"); 124 edje_object_signal_emit(sd->combobox, "ewe,state,expanded", "ewe");
127 edje_object_signal_emit(sd->combobox, "btn,hide", "ewe"); 125 edje_object_signal_emit(sd->combobox, "btn,hide", "ewe");
128 126
129 exs = ecore_x_default_screen_get(); 127 elm_win_screen_position_get(sd->top_win, &top_widget_pos_x, &top_widget_pos_y);
130 ecore_x_screen_size_get(exs, NULL, &sh); 128 elm_win_screen_size_get(sd->top_win, NULL, &sc_y_offset, NULL, &screen_high);
131
132 win = elm_object_top_widget_get(sd->obj);
133 elm_win_screen_position_get(win, &xw, &yw);
134 129
135 x += xw; 130 screen_high += sc_y_offset;
136 y += h + yw; 131 combo_x += top_widget_pos_x;
132 combo_y += combo_high + top_widget_pos_y;
137 133
138 cwin = _exp_window_create(&evas, sd); 134 popup_win = _exp_window_create(&evas, sd);
139 edje_object_size_min_calc(sd->bg, &bg_minw, &bg_minh);
140 135
141 if (list_count == 0) hh = NON_ITEM_PADDING; 136 EINA_LIST_FOREACH(sd->items, l, item)
142 else
143 { 137 {
144 EINA_LIST_FOREACH(sd->items, l, item) 138 item->content = edje_object_add(evas);
145 { 139 if (item->style)
146 item->content = edje_object_add(evas); 140 edje_object_file_set(item->content, EWE_THEME, item->style);
147 if (item->style) 141 else
148 edje_object_file_set(item->content, EWE_THEME, item->style); 142 edje_object_file_set(item->content, EWE_THEME,
149 else 143 "ewe/combobox/item/content/default");
150 edje_object_file_set(item->content, EWE_THEME, "ewe/combobox/item/content/default"); 144 evas_object_resize(item->content, combo_width - expander_minw, item_h);
151 edje_object_size_min_calc(item->content, NULL, &minh); 145 edje_object_part_text_set(item->content, "ewe.text", item->title);
152 evas_object_resize(item->content, w - bg_minw, minh); 146 evas_object_show(item->content);
153 edje_object_part_text_set(item->content, "ewe.text", item->title); 147 evas_object_box_append(sd->items_box, item->content);
154 evas_object_show(item->content); 148 edje_object_signal_callback_add(item->content, "select", "ewe",
155 evas_object_box_append(sd->items_box, item->content); 149 _selected_cb, item);
156 edje_object_signal_callback_add(item->content, "select", "ewe", _selected_cb, item); 150 }
157 } 151
158 item_show_down = floor((sh - y - bg_minh) / minh); 152 list_count = eina_list_count(sd->items);
159 item_show_up = floor((y - h - bg_minh) / minh); 153 expander_h = list_count * item_h + expander_minh / 2;
160 hh = (list_count * minh) + bg_minh;
161 154
162 if (hh > sh - y) 155 if (expander_h > screen_high - combo_y)
156 {
157 item_show_down = floor((screen_high - combo_y - expander_minh) / item_h);
158 if (item_show_down >= MIN_ITEMS)
159 expander_h = (item_show_down * item_h) + (expander_minh / 2);
160 else if (expander_h < combo_y)
161 combo_y -= combo_high + expander_h;
162 else
163 { 163 {
164 if (item_show_down >= MIN_ITEMS) 164 item_show_up = floor((combo_y - combo_high - expander_minh) / item_h);
165 hh = (item_show_down * minh) + (bg_minh / 2); 165 expander_h = (item_show_up * item_h) + (expander_minh / 2);
166 else if (hh < y) 166 combo_y -= combo_high + expander_h;
167 y = y - h - (list_count * minh) - bg_minh;
168 else
169 {
170 hh = (item_show_up * minh) + (bg_minh / 2);
171 y = y - h - hh;
172 }
173 } 167 }
174 } 168 }
169
175 evas_object_smart_callback_call(sd->obj, "expanded", evas); 170 evas_object_smart_callback_call(sd->obj, "expanded", evas);
176 evas_object_resize(sd->bg, w, hh); 171 evas_object_resize(sd->expander, combo_width, expander_h);
177 evas_object_geometry_set(cwin, x, y, w, hh); 172 evas_object_geometry_set(popup_win, combo_x, combo_y, combo_width, expander_h);
178} 173}
179 174
180static void 175static void
@@ -183,14 +178,13 @@ _on_clicked(void *data,
183 const char *emission EINA_UNUSED, 178 const char *emission EINA_UNUSED,
184 const char *source EINA_UNUSED) 179 const char *source EINA_UNUSED)
185{ 180{
186 Evas_Object *object = (Evas_Object *) data; 181 Ewe_Combobox_Smart_Data *sd = (Ewe_Combobox_Smart_Data *) data;
187 EWE_COMBOBOX_DATA_GET(object, sd);
188 if (!eina_list_count(sd->items)) 182 if (!eina_list_count(sd->items))
189 { 183 {
190 printf("Combobox is empty\n"); 184 ERR("Combobox items list is empty");
191 return; 185 return;
192 } 186 }
193 _expand(object); 187 _expand(sd->obj);
194} 188}
195 189
196/*----------------------internal realisation API------------------------------*/ 190/*----------------------internal realisation API------------------------------*/
@@ -207,6 +201,7 @@ _ewe_combobox_text_set(Eo *obj EINA_UNUSED,
207 Ewe_Combobox_Smart_Data *sd, 201 Ewe_Combobox_Smart_Data *sd,
208 Eina_Stringshare *title) 202 Eina_Stringshare *title)
209{ 203{
204 if (!title) title = "";
210 edje_object_part_text_set(sd->combobox, "ewe.text", title); 205 edje_object_part_text_set(sd->combobox, "ewe.text", title);
211 return EINA_TRUE; 206 return EINA_TRUE;
212} 207}
@@ -242,7 +237,7 @@ _ewe_combobox_item_del(Eo *obj,
242 237
243 if (sd->selected) 238 if (sd->selected)
244 { 239 {
245 if (item->index == sd->selected->index) 240 if (item == sd->selected)
246 { 241 {
247 selindex = item->index - 1; 242 selindex = item->index - 1;
248 if (selindex >= 0) 243 if (selindex >= 0)
@@ -254,7 +249,7 @@ _ewe_combobox_item_del(Eo *obj,
254 sd->items = eina_list_remove(sd->items, item); 249 sd->items = eina_list_remove(sd->items, item);
255 _item_data_free(item); 250 _item_data_free(item);
256 251
257 l = eina_list_nth_list(sd->items, item->index + 1); 252 l = eina_list_nth_list(sd->items, item->index);
258 for (data = eina_list_data_get(l); l ; 253 for (data = eina_list_data_get(l); l ;
259 l = eina_list_next(l), data = eina_list_data_get(l)) 254 l = eina_list_next(l), data = eina_list_data_get(l))
260 data->index--; 255 data->index--;
@@ -292,11 +287,12 @@ _ewe_combobox_item_title_set(Eo *obj EINA_UNUSED,
292 int index, 287 int index,
293 Eina_Stringshare *title) 288 Eina_Stringshare *title)
294{ 289{
295 if (((int)eina_list_count(sd->items) < (index + 1)) 290 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0) || (!title))
296 || (index < 0) || (!title)) return EINA_FALSE; 291 return EINA_FALSE;
297 Ewe_Combobox_Item *item; 292 Ewe_Combobox_Item *item;
298 item = eina_list_nth(sd->items, index); 293 item = eina_list_nth(sd->items, index);
299 eina_stringshare_del(item->title); 294 eina_stringshare_del(item->title);
295 if (!title) title = "";
300 item->title = eina_stringshare_add(title); 296 item->title = eina_stringshare_add(title);
301 if (item == sd->selected) 297 if (item == sd->selected)
302 edje_object_part_text_set(sd->combobox, "ewe.text", item->title); 298 edje_object_part_text_set(sd->combobox, "ewe.text", item->title);
@@ -309,7 +305,8 @@ _ewe_combobox_item_title_get(Eo *obj EINA_UNUSED,
309 Ewe_Combobox_Smart_Data *sd, 305 Ewe_Combobox_Smart_Data *sd,
310 const int index) 306 const int index)
311{ 307{
312 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0)) return NULL; 308 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0))
309 return NULL;
313 Ewe_Combobox_Item *item; 310 Ewe_Combobox_Item *item;
314 item = eina_list_nth(sd->items, index); 311 item = eina_list_nth(sd->items, index);
315 return item->title; 312 return item->title;
@@ -320,7 +317,8 @@ _ewe_combobox_select_item_set(Eo *obj EINA_UNUSED,
320 Ewe_Combobox_Smart_Data *sd, 317 Ewe_Combobox_Smart_Data *sd,
321 int index) 318 int index)
322{ 319{
323 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0)) return EINA_FALSE; 320 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0))
321 return EINA_FALSE;
324 Ewe_Combobox_Item *item; 322 Ewe_Combobox_Item *item;
325 item = eina_list_nth(sd->items, index); 323 item = eina_list_nth(sd->items, index);
326 sd->selected = item; 324 sd->selected = item;
@@ -387,7 +385,7 @@ _ewe_combobox_evas_object_smart_add(Eo *obj, Ewe_Combobox_Smart_Data *sd)
387 sd->combobox = edje_object_add(evas_object_evas_get(obj)); 385 sd->combobox = edje_object_add(evas_object_evas_get(obj));
388 evas_object_smart_member_add(sd->combobox, obj); 386 evas_object_smart_member_add(sd->combobox, obj);
389 edje_object_file_set(sd->combobox, EWE_THEME, "ewe/combobox/base/default"); 387 edje_object_file_set(sd->combobox, EWE_THEME, "ewe/combobox/base/default");
390 edje_object_signal_callback_add(sd->combobox, "clicked", "ewe", _on_clicked, obj); 388 edje_object_signal_callback_add(sd->combobox, "clicked", "ewe", _on_clicked, sd);
391 sd->items = NULL; 389 sd->items = NULL;
392} 390}
393 391
@@ -469,5 +467,4 @@ _ewe_combobox_class_constructor(Eo_Class *klass)
469} 467}
470 468
471#include "ewe_combobox.eo.c" 469#include "ewe_combobox.eo.c"
472#undef NON_ITEM_PADDING
473#undef MIN_ITEMS 470#undef MIN_ITEMS
diff --git a/src/lib/ewe_entry.c b/src/lib/ewe_entry.c
index 3e5c83f..3e48ab2 100644
--- a/src/lib/ewe_entry.c
+++ b/src/lib/ewe_entry.c
@@ -1,5 +1,6 @@
1#include "ewe_private.h" 1#include "ewe_private.h"
2#include "ewe_widget_entry.h" 2#include "ewe_widget_entry.h"
3#include "Ewe.h"
3 4
4#define MY_CLASS EWE_ENTRY_CLASS 5#define MY_CLASS EWE_ENTRY_CLASS
5 6
diff --git a/src/lib/ewe_main.h b/src/lib/ewe_main.h
index 15fdb98..4358583 100644
--- a/src/lib/ewe_main.h
+++ b/src/lib/ewe_main.h
@@ -19,14 +19,6 @@
19#ifndef EWE_MAIN_H 19#ifndef EWE_MAIN_H
20#define EWE_MAIN_H 20#define EWE_MAIN_H
21 21
22#include <Elementary.h>
23#include "ewe_statusbar.h"
24#include "ewe_combobox.h"
25#include "ewe_ruler.h"
26#include "ewe_entry.h"
27#include "ewe_tabs.h"
28#include "ewe_win.h"
29
30/** 22/**
31 * Initialize Elementary Widget Extensions library 23 * Initialize Elementary Widget Extensions library
32 * 24 *
diff --git a/src/lib/ewe_widget_combobox.h b/src/lib/ewe_widget_combobox.h
index 0f5a038..88f2c1d 100644
--- a/src/lib/ewe_widget_combobox.h
+++ b/src/lib/ewe_widget_combobox.h
@@ -28,7 +28,7 @@ typedef struct _Ewe_Combobox_Smart_Data Ewe_Combobox_Smart_Data;
28struct _Ewe_Combobox_Smart_Data 28struct _Ewe_Combobox_Smart_Data
29{ 29{
30 Eo *obj; 30 Eo *obj;
31 Evas_Object *combobox, *scroller, *bg; 31 Evas_Object *combobox, *scroller, *expander;
32 Evas_Object *items_box; 32 Evas_Object *items_box;
33 Evas_Object *win, *top_win; 33 Evas_Object *win, *top_win;
34 Eina_List *items; 34 Eina_List *items;
diff --git a/src/lib/ewe_widget_entry.h b/src/lib/ewe_widget_entry.h
index db9cca5..69f9c7b 100644
--- a/src/lib/ewe_widget_entry.h
+++ b/src/lib/ewe_widget_entry.h
@@ -3,7 +3,6 @@
3 3
4#include <regex.h> 4#include <regex.h>
5#include <elm_widget_entry.h> 5#include <elm_widget_entry.h>
6#include "ewe_main.h"
7 6
8typedef struct _Ewe_Entry_Data Ewe_Entry_Data; 7typedef struct _Ewe_Entry_Data Ewe_Entry_Data;
9struct _Ewe_Entry_Data { 8struct _Ewe_Entry_Data {