2011-08-25 04:12:09 -07:00
|
|
|
#include "obj_information.h"
|
|
|
|
|
2011-08-25 04:12:13 -07:00
|
|
|
typedef struct _Inf_Tree_Item Inf_Tree_Item;
|
|
|
|
struct _Inf_Tree_Item
|
|
|
|
{
|
|
|
|
Eina_List *children;
|
|
|
|
Evas_Object *icon;
|
|
|
|
const char *string;
|
|
|
|
};
|
|
|
|
|
2011-08-25 04:12:17 -07:00
|
|
|
static Eina_List *information_tree = NULL;
|
2011-08-25 04:12:09 -07:00
|
|
|
static Evas_Object *prop_list = NULL;
|
2011-08-25 04:12:13 -07:00
|
|
|
static Elm_Genlist_Item_Class itc;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gl_selected(void *data __UNUSED__, Evas_Object *pobj __UNUSED__,
|
2011-08-25 04:12:17 -07:00
|
|
|
void *event_info __UNUSED__)
|
2011-08-25 04:12:13 -07:00
|
|
|
{
|
2011-08-25 04:12:17 -07:00
|
|
|
/* Currently do nothing */
|
|
|
|
return;
|
2011-08-25 04:12:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gl_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Item *it = event_info;
|
2011-08-25 04:12:17 -07:00
|
|
|
Inf_Tree_Item *parent = elm_genlist_item_data_get(it);
|
|
|
|
Inf_Tree_Item *tit;
|
2011-08-25 04:12:13 -07:00
|
|
|
Eina_List *itr;
|
|
|
|
|
2011-08-25 04:12:17 -07:00
|
|
|
EINA_LIST_FOREACH(parent->children, itr, tit)
|
2011-08-25 04:12:13 -07:00
|
|
|
{
|
2011-08-25 04:12:17 -07:00
|
|
|
Elm_Genlist_Item_Flags iflag = (tit->children) ?
|
2011-08-25 04:12:13 -07:00
|
|
|
ELM_GENLIST_ITEM_SUBITEMS : ELM_GENLIST_ITEM_NONE;
|
2011-08-25 04:12:17 -07:00
|
|
|
elm_genlist_item_append(prop_list, &itc, tit, it,
|
|
|
|
iflag, _gl_selected, NULL);
|
2011-08-25 04:12:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gl_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Item *it = event_info;
|
|
|
|
elm_genlist_item_subitems_clear(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gl_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Item *it = event_info;
|
|
|
|
elm_genlist_item_expanded_set(it, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gl_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Item *it = event_info;
|
|
|
|
elm_genlist_item_expanded_set(it, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2011-08-25 04:25:28 -07:00
|
|
|
item_icon_get(void *data __UNUSED__, Evas_Object *parent __UNUSED__,
|
|
|
|
const char *part __UNUSED__)
|
2011-08-25 04:12:13 -07:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
item_label_get(void *data, Evas_Object *obj __UNUSED__,
|
|
|
|
const char *part __UNUSED__)
|
|
|
|
{
|
|
|
|
Inf_Tree_Item *tit = data;
|
|
|
|
return strdup(tit->string);
|
|
|
|
}
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
clouseau_obj_information_list_add(Evas_Object *parent)
|
|
|
|
{
|
2011-08-25 04:12:13 -07:00
|
|
|
prop_list = elm_genlist_add(parent);
|
|
|
|
itc.item_style = "default";
|
|
|
|
itc.func.label_get = item_label_get;
|
|
|
|
itc.func.icon_get = item_icon_get;
|
|
|
|
itc.func.state_get = NULL;
|
|
|
|
itc.func.del = NULL;
|
|
|
|
|
|
|
|
evas_object_smart_callback_add(prop_list, "expand,request", gl_exp_req,
|
|
|
|
prop_list);
|
|
|
|
evas_object_smart_callback_add(prop_list, "contract,request", gl_con_req,
|
|
|
|
prop_list);
|
|
|
|
evas_object_smart_callback_add(prop_list, "expanded", gl_exp, prop_list);
|
|
|
|
evas_object_smart_callback_add(prop_list, "contracted", gl_con, prop_list);
|
|
|
|
evas_object_smart_callback_add(prop_list, "selected", _gl_selected, NULL);
|
|
|
|
|
|
|
|
return prop_list;
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|
|
|
|
|
2011-08-25 04:12:17 -07:00
|
|
|
static void
|
|
|
|
_item_tree_item_free(Inf_Tree_Item *parent)
|
|
|
|
{
|
|
|
|
Inf_Tree_Item *treeit;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(parent->children, treeit)
|
|
|
|
{
|
|
|
|
_item_tree_item_free(treeit);
|
|
|
|
}
|
|
|
|
|
2011-08-25 04:25:28 -07:00
|
|
|
eina_stringshare_del(parent->string);
|
2011-08-25 04:12:17 -07:00
|
|
|
free(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_tree_free(void)
|
|
|
|
{
|
|
|
|
Inf_Tree_Item *treeit;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(information_tree, treeit)
|
|
|
|
{
|
|
|
|
_item_tree_item_free(treeit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-25 04:12:09 -07:00
|
|
|
void
|
|
|
|
clouseau_obj_information_list_populate(Tree_Item *treeit)
|
|
|
|
{
|
2011-08-25 04:12:17 -07:00
|
|
|
clouseau_obj_information_list_clear();
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
if (!treeit->parent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Evas_Object *obj = treeit->data.obj;
|
2011-08-25 04:12:17 -07:00
|
|
|
Inf_Tree_Item *main_tit;
|
2011-08-25 04:12:09 -07:00
|
|
|
|
2011-08-25 04:25:28 -07:00
|
|
|
/* Populate evas properties list */
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit = calloc(1, sizeof(*main_tit));
|
|
|
|
main_tit->string = eina_stringshare_add("Evas");
|
|
|
|
information_tree = eina_list_append(information_tree, main_tit);
|
|
|
|
|
2011-08-25 04:12:09 -07:00
|
|
|
{
|
2011-08-25 04:12:13 -07:00
|
|
|
Inf_Tree_Item *tit;
|
2011-08-25 04:12:09 -07:00
|
|
|
char buf[1024];
|
|
|
|
Eina_Bool visibility;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
double dx, dy;
|
|
|
|
|
|
|
|
visibility = evas_object_visible_get(obj);
|
|
|
|
snprintf(buf, sizeof(buf), "Visibility: %d", (int) visibility);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
if (evas_object_name_get(obj))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "Name: %s",
|
|
|
|
evas_object_name_get(obj));
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Layer: %hd",
|
|
|
|
evas_object_layer_get(obj));
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
|
|
|
snprintf(buf, sizeof(buf), "Position: %d %d", x, y);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
snprintf(buf, sizeof(buf), "Size: %d %d", w, h);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (evas_object_clip_get(obj))
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(
|
|
|
|
evas_object_clip_get(obj), &x, &y, &w, &h);
|
|
|
|
snprintf(buf, sizeof(buf), "Clipper position: %d %d", x, y);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
snprintf(buf, sizeof(buf), "Clipper size: %d %d", w, h);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
evas_object_size_hint_min_get(obj, &w, &h);
|
|
|
|
snprintf(buf, sizeof(buf), "Min size: %d %d", w, h);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_max_get(obj, &w, &h);
|
|
|
|
snprintf(buf, sizeof(buf), "Max size: %d %d", w, h);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_request_get(obj, &w, &h);
|
|
|
|
snprintf(buf, sizeof(buf), "Request size: %d %d", w, h);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_align_get(obj, &dx, &dy);
|
|
|
|
snprintf(buf, sizeof(buf), "Align: %.6lg %.6lg", dx, dy);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_weight_get(obj, &dx, &dy);
|
|
|
|
snprintf(buf, sizeof(buf), "Weight: %.6lg %.6lg", dx, dy);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
|
|
|
|
/* Handle color */
|
|
|
|
{
|
|
|
|
int r, g, b, a;
|
|
|
|
evas_object_color_get(obj, &r, &g, &b, &a);
|
|
|
|
snprintf(buf, sizeof(buf), "Color: %d %d %d %d", r, g, b, a);
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (evas_object_clipees_get(obj))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "Has clipees");
|
2011-08-25 04:12:13 -07:00
|
|
|
tit = calloc(1, sizeof(*tit));
|
|
|
|
tit->string = eina_stringshare_add(buf);
|
2011-08-25 04:12:17 -07:00
|
|
|
main_tit->children = eina_list_append(main_tit->children, tit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Actually populate the genlist */
|
|
|
|
{
|
|
|
|
Eina_List *itr;
|
|
|
|
Inf_Tree_Item *tit;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(information_tree, itr, tit)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Item *git;
|
|
|
|
git = elm_genlist_item_append(prop_list, &itc, tit, NULL,
|
|
|
|
ELM_GENLIST_ITEM_SUBITEMS, _gl_selected, NULL);
|
|
|
|
/* Start with all the base item expanded */
|
|
|
|
elm_genlist_item_expanded_set(git, EINA_TRUE);
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clouseau_obj_information_list_clear()
|
|
|
|
{
|
2011-08-25 04:12:17 -07:00
|
|
|
_item_tree_free();
|
2011-08-25 04:12:13 -07:00
|
|
|
elm_genlist_clear(prop_list);
|
2011-08-25 04:12:09 -07:00
|
|
|
}
|