forked from enlightenment/efl
test_list: Added clicked callback to buttons and made focus highlight optional.
This commit is contained in:
parent
27f98b1e01
commit
e61185831d
|
@ -1280,6 +1280,14 @@ test_list_focus_focus_check_changed(void *data, Evas_Object *obj,
|
|||
test_list_focus_focus_on_selection_set(data, obj, nextstate);
|
||||
}
|
||||
|
||||
static void
|
||||
test_list_focus_focus_highlight_check_changed(void *data, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_win_focus_highlight_enabled_set((Evas_Object *)data,
|
||||
elm_check_state_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
test_list_focus_focus_animate_check_changed(void *data, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -1346,6 +1354,13 @@ _sel_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
timer = ecore_timer_add(1.5, _select_timer_cb, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
printf("Button clicked: %s\n", (char *)data);
|
||||
}
|
||||
|
||||
static void
|
||||
_test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||
{
|
||||
|
@ -1371,6 +1386,8 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
|||
btn = elm_button_add(bx);
|
||||
elm_object_text_set(btn, "Up");
|
||||
elm_box_pack_end(bx, btn);
|
||||
evas_object_smart_callback_add(btn, "clicked",
|
||||
_focus_button_clicked_cb, "Up");
|
||||
evas_object_show(btn);
|
||||
|
||||
bx2 = elm_box_add(bx);
|
||||
|
@ -1383,6 +1400,8 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
|||
btn = elm_button_add(bx2);
|
||||
elm_object_text_set(btn, "Left");
|
||||
elm_box_pack_end(bx2, btn);
|
||||
evas_object_smart_callback_add(btn, "clicked",
|
||||
_focus_button_clicked_cb, "Left");
|
||||
evas_object_show(btn);
|
||||
|
||||
li = elm_list_add(win);
|
||||
|
@ -1404,11 +1423,15 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
|||
btn = elm_button_add(bx2);
|
||||
elm_object_text_set(btn, "Right");
|
||||
elm_box_pack_end(bx2, btn);
|
||||
evas_object_smart_callback_add(btn, "clicked",
|
||||
_focus_button_clicked_cb, "Right");
|
||||
evas_object_show(btn);
|
||||
|
||||
btn = elm_button_add(bx);
|
||||
elm_object_text_set(btn, "Down");
|
||||
elm_box_pack_end(bx, btn);
|
||||
evas_object_smart_callback_add(btn, "clicked",
|
||||
_focus_button_clicked_cb, "Down");
|
||||
evas_object_show(btn);
|
||||
|
||||
// Options
|
||||
|
@ -1424,6 +1447,16 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
|||
elm_object_content_set(fr, bx_opt);
|
||||
evas_object_show(bx_opt);
|
||||
|
||||
chk = elm_check_add(bx_opt);
|
||||
elm_object_text_set(chk, "Focus Highlight");
|
||||
elm_check_state_set(chk, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_smart_callback_add(chk, "changed",
|
||||
test_list_focus_focus_highlight_check_changed,
|
||||
win);
|
||||
elm_box_pack_end(bx_opt, chk);
|
||||
evas_object_show(chk);
|
||||
|
||||
chk = elm_check_add(bx_opt);
|
||||
elm_object_text_set(chk, "Focus Animation");
|
||||
elm_check_state_set(chk, EINA_TRUE);
|
||||
|
|
Loading…
Reference in New Issue