Update accessibility operation
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 10 Oct 2013 09:02:53 +0000 (18:02 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 10 Oct 2013 09:02:53 +0000 (18:02 +0900)
Change-Id: I1bc27662e5190d877237cc1643b494725a4089e1

include/script_port.h
packaging/liblivebox-edje.spec
src/script_port.c

index 25a7a5a..b5e821a 100644 (file)
@@ -29,6 +29,7 @@ extern int script_update_color(void *h, Evas *e, const char *id, const char *par
 extern int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text);
 extern int script_update_image(void *h, Evas *e, const char *id, const char *part, const char *path, const char *option);
 extern int script_update_access(void *h, Evas *e, const char *id, const char *part, const char *text, const char *option);
+extern int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option);
 extern int script_update_script(void *h, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *group);
 extern int script_update_signal(void *h, Evas *e, const char *id, const char *part, const char *signal);
 extern int script_update_drag(void *h, Evas *e, const char *id, const char *part, double x, double y);
index 37c1d1a..335292e 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-edje
 Summary: EDJE Script loader for the data provider master
-Version: 0.5.18
+Version: 0.5.19
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index db2211c..386c310 100644 (file)
@@ -558,6 +558,86 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
        return LB_STATUS_SUCCESS;
 }
 
+PUBLIC int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option)
+{
+       struct info *handle = _h;
+       Evas_Object *edje;
+       struct obj_info *obj_info;
+       Elm_Access_Action_Info action_info;
+       int ret;
+
+       if (!operation || !strlen(operation)) {
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       edje = find_edje(handle, id);
+       if (!edje) {
+               ErrPrint("No such object: %s\n", id);
+               return LB_STATUS_ERROR_NOT_EXIST;
+       }
+
+       obj_info = evas_object_data_get(edje, "obj_info");
+       if (!obj_info) {
+               ErrPrint("Object info is not available\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       memset(&action_info, 0, sizeof(action_info));
+
+       /* OPERATION is defined in liblivebox package */
+       if (!strcasecmp(operation, "set,hl")) {
+               if (part) {
+                       Evas_Object *to;
+                       Evas_Coord x;
+                       Evas_Coord y;
+                       Evas_Coord w;
+                       Evas_Coord h;
+
+                       to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
+                       if (!to) {
+                               ErrPrint("Invalid part: %s\n", part);
+                               goto out;
+                       }
+
+                       evas_object_geometry_get(to, &x, &y, &w, &h);
+
+                       action_info.x = x + w / 2;
+                       action_info.y = x + h / 2;
+               } else if (option && sscanf(option, "%dx%d", &action_info.x, &action_info.y) == 2) {
+               } else {
+                       ErrPrint("Insufficient info for HL\n");
+                       goto out;
+               }
+
+               DbgPrint("TXxTY: %dx%d\n", action_info.x, action_info.y);
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "unset,hl")) {
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_UNHIGHLIGHT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "next,hl")) {
+               action_info.highlight_cycle = (!!option) && (!!strcasecmp(option, "no,cycle"));
+
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "prev,hl")) {
+               action_info.highlight_cycle = EINA_TRUE;
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       }
+
+out:
+       return LB_STATUS_SUCCESS;
+}
+
 PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *part, const char *path, const char *option)
 {
        struct info *handle = _h;