2018-01-28 20:22:26 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
2019-03-07 07:39:06 -08:00
|
|
|
#include <Efl_Ui.h>
|
2018-01-28 20:22:26 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
|
|
|
|
static void
|
efl_input_clickable: increase the time interval for repeated counter
Summary:
The repeated counter in Efl.Input.Clickable_Clicked can be used to
identify double click or triple click.
Previously, the repeated counter in Efl.Input.Clickable_Clicked was
calculated within the time interval 0.1 second.
Now, the time interval for the repeated counter is increased to 0.25
second. It seems that 0.25 second is more appropriate to identify if the
two consecutive clicks should be considered together.
(e.g. considered as double click or triple click)
Moreover, in ecore_event and edje, 0.25 second is already used as a time
interval for double click.
Test Plan:
1. Run Efl.Ui.Button in elementary_test
2. Do double click or triple click the buttons
Reviewers: segfaultxavi, bu5hm4n, YOhoho
Reviewed By: segfaultxavi, YOhoho
Subscribers: YOhoho, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9485
2019-08-02 01:43:45 -07:00
|
|
|
_clicked(void *data EINA_UNUSED, const Efl_Event *ev)
|
2018-01-28 20:22:26 -08:00
|
|
|
{
|
efl_input_clickable: increase the time interval for repeated counter
Summary:
The repeated counter in Efl.Input.Clickable_Clicked can be used to
identify double click or triple click.
Previously, the repeated counter in Efl.Input.Clickable_Clicked was
calculated within the time interval 0.1 second.
Now, the time interval for the repeated counter is increased to 0.25
second. It seems that 0.25 second is more appropriate to identify if the
two consecutive clicks should be considered together.
(e.g. considered as double click or triple click)
Moreover, in ecore_event and edje, 0.25 second is already used as a time
interval for double click.
Test Plan:
1. Run Efl.Ui.Button in elementary_test
2. Do double click or triple click the buttons
Reviewers: segfaultxavi, bu5hm4n, YOhoho
Reviewed By: segfaultxavi, YOhoho
Subscribers: YOhoho, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9485
2019-08-02 01:43:45 -07:00
|
|
|
Efl_Input_Clickable_Clicked *clicked = ev->info;
|
|
|
|
printf("Button is clicked!!! repeated(%d) button(%d)\n", clicked->repeated, clicked->button);
|
2018-01-28 20:22:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_pressed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
printf("Button is pressed!!!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_unpressed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
printf("Button is unpressed!!!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
test_ui_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eo *win, *bx, *btn;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2019-12-11 23:29:19 -08:00
|
|
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
2019-09-20 05:57:09 -07:00
|
|
|
efl_text_set(efl_added, "Efl.Ui.Button"),
|
2018-01-28 20:22:26 -08:00
|
|
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE)
|
|
|
|
);
|
|
|
|
|
|
|
|
bx = efl_add(EFL_UI_BOX_CLASS, win,
|
|
|
|
efl_content_set(win, efl_added),
|
2019-05-24 09:30:31 -07:00
|
|
|
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));
|
2018-01-28 20:22:26 -08:00
|
|
|
|
|
|
|
// Text Only Button
|
|
|
|
efl_add(EFL_UI_BUTTON_CLASS, bx,
|
|
|
|
efl_text_set(efl_added, "Text"),
|
|
|
|
efl_pack(bx, efl_added),
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _clicked, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_PRESSED, _pressed, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_UNPRESSED, _unpressed, NULL)
|
2018-01-28 20:22:26 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
// Icon Only Button
|
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
|
|
|
|
btn = efl_add(EFL_UI_BUTTON_CLASS, bx,
|
|
|
|
efl_pack(bx, efl_added),
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _clicked, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_PRESSED, _pressed, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_UNPRESSED, _unpressed, NULL)
|
2018-01-28 20:22:26 -08:00
|
|
|
);
|
|
|
|
efl_add(EFL_UI_IMAGE_CLASS, btn,
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_set(efl_added, buf),
|
2018-01-28 20:22:26 -08:00
|
|
|
efl_content_set(btn, efl_added)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Text + Icon Button
|
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
|
|
|
|
btn = efl_add(EFL_UI_BUTTON_CLASS, bx,
|
|
|
|
efl_text_set(efl_added, "Text + Icon"),
|
|
|
|
efl_pack(bx, efl_added),
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _clicked, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_PRESSED, _pressed, NULL),
|
|
|
|
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_UNPRESSED, _unpressed, NULL)
|
2018-01-28 20:22:26 -08:00
|
|
|
);
|
|
|
|
efl_add(EFL_UI_IMAGE_CLASS, btn,
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_set(efl_added, buf),
|
2018-01-28 20:22:26 -08:00
|
|
|
efl_content_set(btn, efl_added)
|
|
|
|
);
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400));
|
2018-01-28 20:22:26 -08:00
|
|
|
}
|
|
|
|
|