source: "left_over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
+ program {
+ name: "left_bt_pressed_anim";
+ signal: "elm,left,anim,activate";
+ source: "elm";
+ action: STATE_SET "clicked" 0.0;
+ target: "left_bt";
+ target: "left_over3";
+ after: "left_bt_unpressed_anim";
+ }
+ program {
+ name: "left_bt_unpressed_anim";
+ action: STATE_SET "default" 0.0;
+ transition: DECELERATE 0.5;
+ target: "left_bt";
+ target: "left_over3";
+ }
program {
name: "right_bt_click";
source: "right_over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
+ program {
+ name: "right_bt_pressed_anim";
+ signal: "elm,right,anim,activate";
+ source: "elm";
+ action: STATE_SET "clicked" 0.0;
+ target: "right_bt";
+ target: "right_over3";
+ after: "right_bt_unpressed_anim";
+ }
+ program {
+ name: "right_bt_unpressed_anim";
+ action: STATE_SET "default" 0.0;
+ transition: DECELERATE 0.5;
+ target: "right_bt";
+ target: "right_over3";
+ }
+
program { name: "disable";
signal: "elm,state,disabled";
source: "elm";
static void _val_set(Evas_Object *obj);
static void _indicator_set(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
+static void _drag_up(void *data, Evas_Object *obj,
+ const char *emission, const char *source);
+static void _drag_down(void *data, Evas_Object *obj,
+ const char *emission, const char *source);
+static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
+ Evas_Callback_Type type, void *event_info);
static const char SIG_CHANGED[] = "changed";
static const char SIG_DELAY_CHANGED[] = "delay,changed";
{NULL, NULL}
};
+static Eina_Bool
+_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
+{
+ if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
+ Evas_Event_Key_Down *ev = event_info;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+ if (elm_widget_disabled_get(obj)) return EINA_FALSE;
+ if (!strcmp(ev->keyname, "Left")
+ || !strcmp(ev->keyname, "KP_Left"))
+ {
+ if (!wd->horizontal) return EINA_FALSE;
+ _drag_up(obj, NULL, NULL, NULL);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ else if (!strcmp(ev->keyname, "Right")
+ || !strcmp(ev->keyname, "KP_Right"))
+ {
+ if (!wd->horizontal) return EINA_FALSE;
+ _drag_down(obj, NULL, NULL, NULL);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ else if (!strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
+ {
+ if (wd->horizontal) return EINA_FALSE;
+ _drag_up(obj, NULL, NULL, NULL);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ else if (!strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
+ {
+ if (wd->horizontal) return EINA_FALSE;
+ _drag_down(obj, NULL, NULL, NULL);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ else return EINA_FALSE;
+}
+
static void
_del_hook(Evas_Object *obj)
{
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
+ elm_widget_event_hook_set(obj, _event_hook);
wd->horizontal = EINA_TRUE;
wd->val = 0.0;
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static Eina_Bool _timer_cb(void *data);
static void _on_focus_hook(void *data, Evas_Object *obj);
+static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
+ Evas_Callback_Type type, void *event_info);
+
+static Eina_Bool
+_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
+{
+ if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
+ Evas_Event_Key_Down *ev = event_info;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+ if (elm_widget_disabled_get(obj)) return EINA_FALSE;
+ if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left"))
+ {
+ elm_slideshow_previous(obj);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right"))
+ {
+ elm_slideshow_next(obj);
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ if (!strcmp(ev->keyname, "Return") || !strcmp(ev->keyname, "space"))
+ {
+ if (wd->timeout)
+ elm_slideshow_timeout_set(obj, 0);
+ else
+ elm_slideshow_timeout_set(obj, 3);
+
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
+}
static void
_del_hook(Evas_Object *obj)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
+ elm_widget_event_hook_set(obj, _event_hook);
wd->current = NULL;
wd->previous = NULL;
//static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static Eina_Bool _value_set(Evas_Object *obj, double delta);
static void _on_focus_hook(void *data, Evas_Object *obj);
+static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
+ Evas_Callback_Type type, void *event_info);
static void
_del_hook(Evas_Object *obj)
wd->delay = ecore_timer_add(0.2, _delay_change, data);
}
-static void
-_entry_event_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Evas_Event_Key_Down *ev = event_info;
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- if (!strcmp(ev->keyname, "Up")) _val_inc_start(data);
- else if (!strcmp(ev->keyname, "Down")) _val_dec_start(data);
-}
-
-static void
-_entry_event_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+static Eina_Bool
+_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
{
- Evas_Event_Key_Down *ev = event_info;
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- if (!strcmp(ev->keyname, "Up")) _val_inc_stop(data);
- else if (!strcmp(ev->keyname, "Down")) _val_dec_stop(data);
- else if (!strcmp(ev->keyname, "Escape")) _reset_value(data);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ if (elm_widget_disabled_get(obj)) return EINA_FALSE;
+ if (type == EVAS_CALLBACK_KEY_DOWN)
+ {
+ Evas_Event_Key_Down *ev = event_info;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+ else if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left")
+ || !strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
+ {
+ _val_dec_start(obj);
+ edje_object_signal_emit(wd->spinner, "elm,left,anim,activate", "elm");
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ else if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right")
+ || !strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
+ {
+ _val_inc_start(obj);
+ edje_object_signal_emit(wd->spinner, "elm,right,anim,activate", "elm");
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ }
+ else if (type == EVAS_CALLBACK_KEY_UP)
+ {
+ Evas_Event_Key_Down *ev = event_info;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+ if (!strcmp(ev->keyname, "Right") || !strcmp(ev->keyname, "KP_Right")
+ || !strcmp(ev->keyname, "Up") || !strcmp(ev->keyname, "KP_Up"))
+ _val_inc_stop(obj);
+ else if (!strcmp(ev->keyname, "Left") || !strcmp(ev->keyname, "KP_Left")
+ || !strcmp(ev->keyname, "Down") || !strcmp(ev->keyname, "KP_Down"))
+ _val_dec_stop(obj);
+ else return EINA_FALSE;
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
}
/**
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
+ elm_widget_event_hook_set(obj, _event_hook);
wd->val = 0.0;
wd->val_min = 0.0;
edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider",
0.0, 0.0);
- evas_object_event_callback_add(wd->spinner, EVAS_CALLBACK_KEY_DOWN,
- _entry_event_key_down, obj);
- evas_object_event_callback_add(wd->spinner, EVAS_CALLBACK_KEY_UP,
- _entry_event_key_up, obj);
-
wd->ent = elm_entry_add(obj);
elm_entry_single_line_set(wd->ent, 1);
evas_object_smart_callback_add(wd->ent, "activated", _entry_activated, obj);