forked from enlightenment/efl
efl_ui_clickable: move repeat event
Summary: the repeat event is only emitted by the implementations of efl_ui_autorepeat. Additionally, the event should only be used by those who implement this interface. Depends on D8832 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike, segfaultxavi Subscribers: jpeg, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8813
This commit is contained in:
parent
4a7dc32f61
commit
d29edceade
|
@ -156,7 +156,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|||
}
|
||||
cmid.hint_align_set(ax, ay);
|
||||
}, std::placeholders::_1);
|
||||
efl::eolian::event_add(efl::ui::Clickable::repeated_event, up, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, up, btn_cursors_move);
|
||||
|
||||
auto btn_cursors_release = std::bind(
|
||||
[wmid] ()
|
||||
|
@ -185,7 +185,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|||
left.hint_fill_set(false, true);
|
||||
left.hint_align_set(0.0, 0.5);
|
||||
box_inferior.pack_end(left);
|
||||
efl::eolian::event_add(efl::ui::Clickable::repeated_event, left, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, left, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Clickable::unpressed_event, left, btn_cursors_release);
|
||||
|
||||
efl::ui::Image icon_left(instantiate, win);
|
||||
|
@ -205,7 +205,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|||
right.hint_fill_set(false, true);
|
||||
right.hint_align_set(0.0, 0.5);
|
||||
box_inferior.pack_end(right);
|
||||
efl::eolian::event_add(efl::ui::Clickable::repeated_event, right, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, right, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Clickable::unpressed_event, right, btn_cursors_release);
|
||||
|
||||
efl::ui::Image icon_right(instantiate, win);
|
||||
|
@ -219,7 +219,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|||
down.hint_fill_set(true, false);
|
||||
down.hint_align_set(0.5, 0.0);
|
||||
box.pack_end(down);
|
||||
efl::eolian::event_add(efl::ui::Clickable::repeated_event, down, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, down, btn_cursors_move);
|
||||
efl::eolian::event_add(efl::ui::Clickable::unpressed_event, down, btn_cursors_release);
|
||||
|
||||
efl::ui::Image icon_down(instantiate, win);
|
||||
|
|
|
@ -45,4 +45,7 @@ interface @beta Efl.Ui.Autorepeat {
|
|||
}
|
||||
}
|
||||
}
|
||||
events {
|
||||
repeated: void; [[Called when a repeated event is emitted]]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,5 @@ interface @beta Efl.Ui.Clickable
|
|||
unpressed: Efl.Object; [[Called when the object is no longer pressed]]
|
||||
/* FIXME: Might be NULL */
|
||||
longpressed: Efl.Object; [[Called when the object receives a long press]]
|
||||
repeated: void; [[Called when the object receives repeated presses/clicks]]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,8 +131,11 @@ _autorepeat_send(void *data)
|
|||
{
|
||||
ELM_BUTTON_DATA_GET_OR_RETURN_VAL(data, sd, ECORE_CALLBACK_CANCEL);
|
||||
|
||||
efl_event_callback_legacy_call
|
||||
(data, EFL_UI_EVENT_REPEATED, NULL);
|
||||
if (elm_widget_is_legacy(data))
|
||||
evas_object_smart_callback_call(data, "repeated", NULL);
|
||||
else
|
||||
efl_event_callback_call(data, EFL_UI_AUTOREPEAT_EVENT_REPEATED, NULL);
|
||||
|
||||
if (!sd->repeating)
|
||||
{
|
||||
sd->timer = NULL;
|
||||
|
|
|
@ -462,7 +462,7 @@ _btn_create(Eo *obj, const char *style, char *part)
|
|||
efl_ui_autorepeat_gap_timeout_set(efl_added, INTERVAL),
|
||||
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
|
||||
_inc_dec_btn_clicked_cb, obj),
|
||||
efl_event_callback_add(efl_added, EFL_UI_EVENT_REPEATED,
|
||||
efl_event_callback_add(efl_added, EFL_UI_AUTOREPEAT_EVENT_REPEATED,
|
||||
_inc_dec_btn_repeated_cb, obj),
|
||||
efl_content_set(efl_part(obj, part), efl_added));
|
||||
}
|
||||
|
|
|
@ -1101,12 +1101,12 @@ _button_clicked_cb(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_button_repeat_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_button_repeat_cb(void *data, Evas_Object *object, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Color_Bar_Data *cb_data = data;
|
||||
double x, y, step;
|
||||
|
||||
if (event->object == cb_data->rbt) step = 1.0 / BASE_STEP;
|
||||
if (object == cb_data->rbt) step = 1.0 / BASE_STEP;
|
||||
else step = -1.0 / BASE_STEP;
|
||||
|
||||
edje_object_part_drag_value_get(cb_data->colorbar, "elm.arrow", &x, &y);
|
||||
|
@ -1294,8 +1294,8 @@ _color_bars_add(Evas_Object *obj)
|
|||
(sd->cb_data[i]->lbt, _elm_config->longpress_timeout);
|
||||
elm_button_autorepeat_gap_timeout_set
|
||||
(sd->cb_data[i]->lbt, (1.0 / _elm_config->fps));
|
||||
efl_event_callback_add
|
||||
(sd->cb_data[i]->lbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]);
|
||||
evas_object_smart_callback_add
|
||||
(sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]);
|
||||
|
||||
/* load right button */
|
||||
if (!sd->cb_data[i]->rbt) sd->cb_data[i]->rbt = elm_button_add(sd->col_bars_area);
|
||||
|
@ -1312,8 +1312,8 @@ _color_bars_add(Evas_Object *obj)
|
|||
(sd->cb_data[i]->rbt, _elm_config->longpress_timeout);
|
||||
elm_button_autorepeat_gap_timeout_set
|
||||
(sd->cb_data[i]->rbt, (1.0 / _elm_config->fps));
|
||||
efl_event_callback_add
|
||||
(sd->cb_data[i]->rbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]);
|
||||
evas_object_smart_callback_add
|
||||
(sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue