summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_item_container.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-06 09:34:42 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-08-06 09:34:42 -0400
commit63d3af3ce938c1efc8b44075075f2caa55a63a49 (patch)
treec86dbf20f7ae54945b82f261d27eb2ee908694b2 /src/bin/elementary/test_ui_item_container.c
parent49e8334024f81017acc37b3aa42d015b0ec500e3 (diff)
efl_ui_collection: implement initial focus behaviour
Summary: the behaviour here is that the next item according to the direction is getting focused. This sounds easy but is quite complex given the fact that the items might be hidden. This is the first draft for this, to see how good it performes. Reviewers: zmike, stefan_schmidt, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9496
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_item_container.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/bin/elementary/test_ui_item_container.c b/src/bin/elementary/test_ui_item_container.c
index e87a6ba..e1e7654 100644
--- a/src/bin/elementary/test_ui_item_container.c
+++ b/src/bin/elementary/test_ui_item_container.c
@@ -14,6 +14,16 @@ _selection_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
14} 14}
15 15
16static void 16static void
17_focus_item_cb(void *data, const Efl_Event *ev EINA_UNUSED)
18{
19 Efl_Ui_Widget *element_0 = efl_pack_content_get(data, 0);
20
21 EINA_SAFETY_ON_NULL_RETURN(element_0);
22
23 efl_ui_focus_manager_focus_set(data, element_0);
24}
25
26static void
17_scroll_to_animated_cb(void *data, const Efl_Event *ev EINA_UNUSED) 27_scroll_to_animated_cb(void *data, const Efl_Event *ev EINA_UNUSED)
18{ 28{
19 Efl_Ui_Widget *element_1154 = efl_pack_content_get(data, 1154); 29 Efl_Ui_Widget *element_1154 = efl_pack_content_get(data, 1154);
@@ -168,29 +178,36 @@ void create_item_container_ui(Efl_Ui_Position_Manager_Entity *manager, const Efl
168 { 178 {
169 _add_item(o); 179 _add_item(o);
170 } 180 }
171 efl_pack_table(tbl, o, 1, 0, 1, 11); 181 efl_pack_table(tbl, o, 1, 0, 1, 12);
172 ctx->c = o; 182 ctx->c = o;
173 183
174 o = efl_add(EFL_UI_BUTTON_CLASS, tbl, 184 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
175 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 185 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
176 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 186 efl_gfx_hint_align_set(efl_added, 0, 0.5));
187 efl_text_set(o, "Focus item 0");
188 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _focus_item_cb, item_container);
189 efl_pack_table(tbl, o, 0, 1, 1, 1);
190
191 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
192 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
193 efl_gfx_hint_align_set(efl_added, 0, 0.5));
177 efl_text_set(o, "Scroll to 1154 ANIMATED"); 194 efl_text_set(o, "Scroll to 1154 ANIMATED");
178 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _scroll_to_animated_cb, item_container); 195 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _scroll_to_animated_cb, item_container);
179 efl_pack_table(tbl, o, 0, 1, 1, 1); 196 efl_pack_table(tbl, o, 0, 2, 1, 1);
180 197
181 o = efl_add(EFL_UI_BUTTON_CLASS, tbl, 198 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
182 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 199 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
183 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 200 efl_gfx_hint_align_set(efl_added, 0, 0.5));
184 efl_text_set(o, "Scroll to 10"); 201 efl_text_set(o, "Scroll to 10");
185 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _scroll_to_cb, item_container); 202 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _scroll_to_cb, item_container);
186 efl_pack_table(tbl, o, 0, 2, 1, 1); 203 efl_pack_table(tbl, o, 0, 3, 1, 1);
187 204
188 o = efl_add(EFL_UI_BUTTON_CLASS, tbl, 205 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
189 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 206 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
190 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 207 efl_gfx_hint_align_set(efl_added, 0, 0.5));
191 efl_text_set(o, "Change min size of 0"); 208 efl_text_set(o, "Change min size of 0");
192 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _change_min_size_cb, item_container); 209 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _change_min_size_cb, item_container);
193 efl_pack_table(tbl, o, 0, 3, 1, 1); 210 efl_pack_table(tbl, o, 0, 4, 1, 1);
194 211
195 o = efl_add(EFL_UI_CHECK_CLASS, tbl, 212 o = efl_add(EFL_UI_CHECK_CLASS, tbl,
196 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 213 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
@@ -198,14 +215,14 @@ void create_item_container_ui(Efl_Ui_Position_Manager_Entity *manager, const Efl
198 efl_text_set(o, "Vertical"); 215 efl_text_set(o, "Vertical");
199 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_cb, item_container); 216 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_cb, item_container);
200 efl_ui_check_selected_set(o, EINA_TRUE); 217 efl_ui_check_selected_set(o, EINA_TRUE);
201 efl_pack_table(tbl, o, 0, 4, 1, 1); 218 efl_pack_table(tbl, o, 0, 5, 1, 1);
202 219
203 o = efl_add(EFL_UI_CHECK_CLASS, tbl, 220 o = efl_add(EFL_UI_CHECK_CLASS, tbl,
204 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 221 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
205 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 222 efl_gfx_hint_align_set(efl_added, 0, 0.5));
206 efl_text_set(o, "Match Vertical"); 223 efl_text_set(o, "Match Vertical");
207 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_match_content_cb, ctx); 224 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_match_content_cb, ctx);
208 efl_pack_table(tbl, o, 0, 5, 1, 1); 225 efl_pack_table(tbl, o, 0, 6, 1, 1);
209 ctx->v = o; 226 ctx->v = o;
210 227
211 o = efl_add(EFL_UI_CHECK_CLASS, tbl, 228 o = efl_add(EFL_UI_CHECK_CLASS, tbl,
@@ -213,7 +230,7 @@ void create_item_container_ui(Efl_Ui_Position_Manager_Entity *manager, const Efl
213 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 230 efl_gfx_hint_align_set(efl_added, 0, 0.5));
214 efl_text_set(o, "Match Horizontal"); 231 efl_text_set(o, "Match Horizontal");
215 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_match_content_cb, ctx); 232 efl_event_callback_add(o, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _selection_changed_match_content_cb, ctx);
216 efl_pack_table(tbl, o, 0, 6, 1, 1); 233 efl_pack_table(tbl, o, 0, 7, 1, 1);
217 efl_gfx_entity_size_set(win, EINA_SIZE2D(260, 200)); 234 efl_gfx_entity_size_set(win, EINA_SIZE2D(260, 200));
218 ctx->h = o; 235 ctx->h = o;
219 236
@@ -222,27 +239,27 @@ void create_item_container_ui(Efl_Ui_Position_Manager_Entity *manager, const Efl
222 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 239 efl_gfx_hint_align_set(efl_added, 0, 0.5));
223 efl_text_set(o, "Remove all items"); 240 efl_text_set(o, "Remove all items");
224 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _remove_all_cb, item_container); 241 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _remove_all_cb, item_container);
225 efl_pack_table(tbl, o, 0, 7, 1, 1); 242 efl_pack_table(tbl, o, 0, 8, 1, 1);
226 243
227 o = efl_add(EFL_UI_BUTTON_CLASS, tbl, 244 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
228 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 245 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
229 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 246 efl_gfx_hint_align_set(efl_added, 0, 0.5));
230 efl_text_set(o, "Add 1 item"); 247 efl_text_set(o, "Add 1 item");
231 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _add_one_item, item_container); 248 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _add_one_item, item_container);
232 efl_pack_table(tbl, o, 0, 8, 1, 1); 249 efl_pack_table(tbl, o, 0, 9, 1, 1);
233 250
234 o = efl_add(EFL_UI_BUTTON_CLASS, tbl, 251 o = efl_add(EFL_UI_BUTTON_CLASS, tbl,
235 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 252 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
236 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 253 efl_gfx_hint_align_set(efl_added, 0, 0.5));
237 efl_text_set(o, "Add 1000 item"); 254 efl_text_set(o, "Add 1000 item");
238 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _add_thousend_items, item_container); 255 efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _add_thousend_items, item_container);
239 efl_pack_table(tbl, o, 0, 9, 1, 1); 256 efl_pack_table(tbl, o, 0, 10, 1, 1);
240 257
241 bx = efl_add(EFL_UI_RADIO_BOX_CLASS, tbl, 258 bx = efl_add(EFL_UI_RADIO_BOX_CLASS, tbl,
242 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), 259 efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
243 efl_gfx_hint_align_set(efl_added, 0, 0.5)); 260 efl_gfx_hint_align_set(efl_added, 0, 0.5));
244 efl_event_callback_add(bx, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _select_value_cb, item_container); 261 efl_event_callback_add(bx, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _select_value_cb, item_container);
245 efl_pack_table(tbl, bx, 0, 10, 1, 1); 262 efl_pack_table(tbl, bx, 0, 11, 1, 1);
246 o = efl_add(EFL_UI_RADIO_CLASS, bx, 263 o = efl_add(EFL_UI_RADIO_CLASS, bx,
247 efl_ui_radio_state_value_set(efl_added, EFL_UI_SELECT_MODE_SINGLE)); 264 efl_ui_radio_state_value_set(efl_added, EFL_UI_SELECT_MODE_SINGLE));
248 efl_text_set(o, "Singleselect"); 265 efl_text_set(o, "Singleselect");