Hi,

I am trying to get widget tree from elm_win object. I was using
evas_objects_in_rectangle_get to do this. On evas, elementary == 1.7.1 I
was able to get evas objects and filter out non elementary widgets from
list. On upstream version of libraries I get only one edje object on the
list. I am not sure if this is intentional. Below is my example code
(basically it is one of examples).
Since elm_win does not inherit container behavior is it a better way to get
widgets from win ?
Am I missing something important here ? I did not expect so different
behavior on upstream code.

#include <Elementary.h>
#include <stdio.h>
static void
on_done(void *data, Evas_Object *obj, void *event_info)
{
elm_exit();
}

EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *lab, *btn;
win = elm_win_util_standard_add("hello", "Hello");
evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
box = elm_box_add(win);
elm_box_horizontal_set(box, EINA_TRUE);
elm_win_resize_object_add(win, box);
evas_object_show(box);

lab = elm_label_add(win);
elm_object_text_set(lab, "Hello out there world!");
elm_box_pack_end(box, lab);
evas_object_show(lab);

btn = elm_button_add(win);
elm_object_text_set(btn, "OK");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", on_done, NULL);

evas_object_show(win);

// dump widget tree
elm_widget_tree_dump(win);

int x, y, w, h;

Evas *evas = evas_object_evas_get(win);
evas_object_geometry_get(win, &x, &y, &w, &h);

Evas_Object *o;
Eina_List *l, *olist;
olist = evas_objects_in_rectangle_get(evas, x, y, w, h,
EINA_FALSE, EINA_TRUE);

EINA_LIST_FOREACH(olist, l, o) {
fprintf(stdout,"Item type %s %p\n", evas_object_type_get(o), o);
if (eo_isa(o, EDJE_OBJ_CLASS)) {
const char *file;
const char *group;
edje_object_file_get (o, &file, &group);
fprintf(stdout,"edje file: %s group: %s\n", file, group);
}
}
eina_list_free(olist); olist=NULL;

elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()

Thanks in advance,
Lukasz Pawlik
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to