Button animate when click with keyboard
authorTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Wed, 22 Sep 2010 17:45:53 +0000 (17:45 +0000)
committerTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Wed, 22 Sep 2010 17:45:53 +0000 (17:45 +0000)
Author:    Helen Fornazier <helen.fornazier@profusion.mobi>

SVN revision: 52601

data/themes/default.edc
src/lib/elm_button.c

index 77ba30f..5160eab 100644 (file)
@@ -979,6 +979,22 @@ collections {
            after: "button_unclick_anim";
         }
         program {
+           name:   "button_pressed_anim";
+           signal: "elm,anim,activate";
+           source: "elm";
+           action: STATE_SET "clicked" 0.0;
+           target: "button_image";
+           target: "over3";
+           after: "button_unpressed_anim";
+        }
+        program {
+           name:   "button_unpressed_anim";
+           action: STATE_SET "default" 0.0;
+           transition: DECELERATE 0.5;
+           target: "button_image";
+           target: "over3";
+        }
+        program {
            name:   "button_unclick_anim";
            action: STATE_SET "default" 0.0;
            target: "button_image";
index 25ff405..5424a42 100644 (file)
@@ -52,11 +52,14 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
 {
    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 (strcmp(ev->keyname, "Return") && strcmp(ev->keyname, "space"))
      return EINA_FALSE;
    _activate(obj);
    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+   edje_object_signal_emit(wd->btn, "elm,anim,activate", "elm");
    return EINA_TRUE;
 }