add visual feedback on accessibility mouseover too
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 23 Aug 2011 07:44:49 +0000 (07:44 +0000)
committerMike McCormack <mj.mccormack@samsung.com>
Mon, 14 Nov 2011 07:51:32 +0000 (16:51 +0900)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@62713 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

data/themes/Makefile.am
data/themes/access_glow.png [new file with mode: 0644]
data/themes/default.edc
src/lib/elm_access.c
src/lib/elm_button.c
src/lib/elm_check.c
src/lib/elm_widget.h

index ba72890..40ebcf2 100644 (file)
@@ -234,7 +234,16 @@ icon_arrow_down_right.png \
 icon_arrow_up_left.png \
 icon_arrow_up_right.png \
 thumb_shadow.png \
-group_index.png
+group_index.png \
+mp_forward.png \
+mp_info.png \
+mp_next.png \
+mp_pause.png \
+mp_play.png \
+mp_prev.png \
+mp_rewind.png \
+mp_stop.png \
+access_glow.png
 
 default.edj: Makefile $(EXTRA_DIST)
        $(EDJE_CC) $(EDJE_FLAGS) \
diff --git a/data/themes/access_glow.png b/data/themes/access_glow.png
new file mode 100644 (file)
index 0000000..9c00ec7
Binary files /dev/null and b/data/themes/access_glow.png differ
index 2357305..abd2c3f 100644 (file)
@@ -243,6 +243,81 @@ collections {
    }
 
 ///////////////////////////////////////////////////////////////////////////////
+   group { name: "elm/access/base/default";
+      images {
+         image: "access_glow.png" LOSSY 85;
+      }
+      parts {
+         part { name: "block1"; type: RECT;
+            mouse_events:  0;
+            description { state: "default" 0.0;
+               color: 0 0 0 200;
+               rel1 { to: "base";
+                  relative: 0.0 0.0;
+                  offset: -100000 -100000;
+               }
+               rel2 { to: "base";
+                  relative: 1.0 0.0;
+                  offset: 100000 96;
+               }
+            }
+         }
+         part { name: "block2"; type: RECT;
+            mouse_events:  0;
+            description { state: "default" 0.0;
+               color: 0 0 0 200;
+               rel1 { to: "base";
+                  relative: 0.0 1.0;
+                  offset: -100000 -97;
+               }
+               rel2 { to: "base";
+                  relative: 1.0 1.0;
+                  offset: 100000 100000;
+               }
+            }
+         }
+         part { name: "block3"; type: RECT;
+            mouse_events:  0;
+            description { state: "default" 0.0;
+               color: 0 0 0 200;
+               rel1 { to: "block1";
+                  relative: 0.0 1.0;
+                  offset: 0 0;
+               }
+               rel2 { to_x: "base"; to_y: "block2";
+                  relative: 0.0 0.0;
+                  offset: 96 -1;
+               }
+            }
+         }
+         part { name: "block4"; type: RECT;
+            mouse_events:  0;
+            description { state: "default" 0.0;
+               color: 0 0 0 200;
+               rel1 { to_x: "base"; to_y: "block1";
+                  relative: 1.0 1.0;
+                  offset: -97 0;
+               }
+               rel2 { to: "block2";
+                  relative: 1.0 0.0;
+                  offset: -1 -1;
+               }
+            }
+         }
+         part { name: "base";
+            mouse_events:  0;
+            description { state: "default" 0.0;
+               image.normal: "access_glow.png";
+               image.border: 112 112 112 112;
+               rel1.offset: -102 -102;
+               rel2.offset:  101  101;
+               fill.smooth: 0;
+            }
+         }
+      }
+   }
+
+///////////////////////////////////////////////////////////////////////////////
    group { name: "elm/bg/base/default";
       images {
          image: "dia_grad.png" COMP;
index a4e4b7b..7875086 100644 (file)
@@ -70,6 +70,7 @@ _access_obj_over_timeout_cb(void *data)
    if (!ac) return EINA_FALSE;
    if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
      {
+        _elm_access_object_hilight(data);
         _elm_access_read(ac, ELM_ACCESS_CANCEL, data, NULL);
         _elm_access_read(ac, ELM_ACCESS_TYPE,   data, NULL);
         _elm_access_read(ac, ELM_ACCESS_INFO,   data, NULL);
@@ -100,6 +101,7 @@ _access_obj_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
 {
    Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access");
    if (!ac) return;
+   _elm_access_object_unhilight(data);
    if (ac->delay_timer)
      {
         ecore_timer_del(ac->delay_timer);
@@ -184,7 +186,7 @@ _elm_access_text_get(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget
      {
         if (ai->type == type)
           {
-             if (ai->func) return ai->func(ai->data, obj, item);
+             if (ai->func) return ai->func((void *)(ai->data), obj, item);
              else if (ai->data) return strdup(ai->data);
              return NULL;
           }
@@ -247,9 +249,40 @@ _elm_access_object_get(Evas_Object *obj)
 }
 
 EAPI void
-_elm_access_object_hilight(Evas_Object *win, Evas_Object *obj)
+_elm_access_object_hilight(Evas_Object *obj)
 {
-   // if hilight obj doens exist - create and attach to window
+   Evas_Object *o;
+   
+   o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
+   if (!o)
+     {
+        o = edje_object_add(evas_object_evas_get(obj));
+        evas_object_name_set(o, "_elm_access_disp");
+        evas_object_layer_set(o, ELM_OBJECT_LAYER_TOOLTIP);
+     }
+   else
+     {
+        Evas_Object *ptarget = evas_object_data_get(o, "_elm_access_target");
+        if (ptarget)
+          {
+             evas_object_data_del(o, "_elm_access_target");
+             // FIXME: delete move/resize/del callbacks from ptarget
+          }
+     }
+   evas_object_data_set(o, "_elm_access_target", obj);
+   // FIXME: track obj pos/size until hilight removed
+   _elm_theme_object_set(obj, o, "access", "base", "default");
+   evas_object_raise(o);
+
+     {
+        Evas_Coord x, y, w, h;
+        evas_object_geometry_get(obj, &x, &y, &w, &h);
+        evas_object_move(o, x, y);
+        evas_object_resize(o, w, h);
+     }
+   
+   evas_object_show(o);
+   // if hilight obj doesnt exist - create and attach to window
    // make sure its on a high layer
    // show it and emit signal
    // if exists, move and resize to obj object location
@@ -257,9 +290,14 @@ _elm_access_object_hilight(Evas_Object *win, Evas_Object *obj)
 }
 
 EAPI void
-_elm_access_object_unhilight(Evas_Object *win)
+_elm_access_object_unhilight(Evas_Object *obj)
 {
-   // hide highlight obj is there, emit hide and then del when done
+   Evas_Object *o, *ptarget;
+   
+   o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
+   if (!o) return;
+   ptarget = evas_object_data_get(o, "_elm_access_target");
+   if (ptarget == obj) evas_object_del(o);
 }
 
 EAPI void
index 9b58112..99dd2c3 100644 (file)
@@ -432,7 +432,7 @@ _elm_button_label_get(const Evas_Object *obj, const char *item)
 }
 
 static char *
-_access_info_cb(const void *data, Evas_Object *obj, Elm_Widget_Item *item)
+_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
 {
    char *txt = (char *)elm_widget_access_info_get(obj);
    if (!txt) txt = (char *)_elm_button_label_get(obj, NULL);
@@ -440,6 +440,14 @@ _access_info_cb(const void *data, Evas_Object *obj, Elm_Widget_Item *item)
    return txt;
 }
 
+static char *
+_access_state_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
+{
+   if (elm_widget_disabled_get(obj))
+      return strdup(E_("State: Disabled"));
+   return NULL;
+}
+
 EAPI Evas_Object *
 elm_button_add(Evas_Object *parent)
 {
index cfc4049..d25e5b3 100644 (file)
@@ -282,13 +282,24 @@ _activate(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
-   wd->state = !wd->state;
-   if (wd->statep) *wd->statep = wd->state;
-   if (wd->state)
-     edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
-   else
-     edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
-   evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
+   if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) ||
+       (_elm_access_2nd_click_timeout(obj)))
+     {
+        if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
+           wd->state = !wd->state;
+        if (wd->statep) *wd->statep = wd->state;
+        if (wd->state)
+          {
+             edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
+             _elm_access_say(E_("State: On"));
+          }
+        else
+          {
+             edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
+             _elm_access_say(E_("State: Off"));
+          }
+        evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
+     }
 }
 
 static void
@@ -318,6 +329,28 @@ _elm_check_label_get(const Evas_Object *obj, const char *item)
    return wd->label;
 }
 
+static char *
+_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
+{
+   char *txt = (char *)elm_widget_access_info_get(obj);
+   if (!txt) txt = (char *)_elm_check_label_get(obj, NULL);
+   if (txt) return strdup(txt);
+   return txt;
+}
+
+static char *
+_access_state_cb(void *data, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
+{
+   Evas_Object *o = data;
+   Widget_Data *wd = elm_widget_data_get(o);
+   if (!wd) return NULL;
+   if (elm_widget_disabled_get(obj))
+      return strdup(E_("State: Disabled"));
+   if (wd->state)
+      return strdup(E_("State: On"));
+   return strdup(E_("State: Off"));
+}
+
 EAPI Evas_Object *
 elm_check_add(Evas_Object *parent)
 {
@@ -362,6 +395,14 @@ elm_check_add(Evas_Object *parent)
    // TODO: convert Elementary to subclassing of Evas_Smart_Class
    // TODO: and save some bytes, making descriptions per-class and not instance!
    evas_object_smart_callbacks_descriptions_set(obj, _signals);
+   
+   _elm_access_object_register(obj, wd->chk);
+   _elm_access_text_set(_elm_access_object_get(obj),
+                        ELM_ACCESS_TYPE, E_("Check"));
+   _elm_access_callback_set(_elm_access_object_get(obj),
+                            ELM_ACCESS_INFO, _access_info_cb, obj);
+   _elm_access_callback_set(_elm_access_object_get(obj),
+                            ELM_ACCESS_STATE, _access_state_cb, obj);
    return obj;
 }
 
index eb5c395..423c88f 100644 (file)
@@ -210,7 +210,7 @@ typedef void (*Elm_Widget_On_Signal_Emit_Cb)(void *data, const char *emission, c
 #define ELM_ACCESS_DONE    -1 // sentence done - send done event here
 #define ELM_ACCESS_CANCEL  -2 // stop reading immediately
 
-typedef char *(*Elm_Access_Content_Cb)(const void *data, Evas_Object *obj, Elm_Widget_Item *item);
+typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj, Elm_Widget_Item *item);
 
 struct _Elm_Access_Item
 {
@@ -232,6 +232,8 @@ EAPI char            *_elm_access_text_get(Elm_Access_Info *ac, int type,  Evas_
 EAPI void             _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
 EAPI void             _elm_access_say(const char *txt);
 EAPI Elm_Access_Info *_elm_access_object_get(Evas_Object *obj);
+EAPI void             _elm_access_object_hilight(Evas_Object *obj);
+EAPI void             _elm_access_object_unhilight(Evas_Object *obj);
 EAPI void             _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
 EAPI Eina_Bool        _elm_access_2nd_click_timeout(Evas_Object *obj);