forked from enlightenment/enlightenment
parent
1f7ec2c6af
commit
b5be31c1c5
|
@ -122,12 +122,12 @@ BORDER_BUTTON_ADV(NAME,TYPE,REL1X,REL1Y,OFF1X,OFF1Y,TO1,TO1,REL2X,REL2Y,OFF2X,OF
|
||||||
state: "active" 0.0; \
|
state: "active" 0.0; \
|
||||||
rel1 { \
|
rel1 { \
|
||||||
relative: 0.0 0.0; \
|
relative: 0.0 0.0; \
|
||||||
offset: 1 1; \
|
offset: 0 0; \
|
||||||
to: NAME; \
|
to: NAME; \
|
||||||
} \
|
} \
|
||||||
rel2 { \
|
rel2 { \
|
||||||
relative: 1.0 1.0; \
|
relative: 1.0 1.0; \
|
||||||
offset: 0 0; \
|
offset: -1 -1; \
|
||||||
to: NAME; \
|
to: NAME; \
|
||||||
} \
|
} \
|
||||||
image { \
|
image { \
|
||||||
|
|
|
@ -4808,6 +4808,9 @@ _e_border_eval(E_Border *bd)
|
||||||
snprintf(buf, sizeof(buf), "widgets/border/%s/border",
|
snprintf(buf, sizeof(buf), "widgets/border/%s/border",
|
||||||
bd->client.border.name);
|
bd->client.border.name);
|
||||||
ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
|
ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
|
||||||
|
if ((!ok) && (strcmp(bd->client.border.name, "borderless")))
|
||||||
|
ok = e_theme_edje_object_set(o, "base/theme/borders",
|
||||||
|
"widgets/border/default/border");
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
const char *shape_option;
|
const char *shape_option;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
/* PROTOTYPES - same all the time */
|
/* PROTOTYPES - same all the time */
|
||||||
typedef struct _CFData CFData;
|
typedef struct _CFData CFData;
|
||||||
|
typedef struct _CFBorder CFBorder;
|
||||||
|
|
||||||
static void *_create_data(E_Config_Dialog *cfd);
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
|
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
@ -15,7 +16,15 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFDa
|
||||||
struct _CFData
|
struct _CFData
|
||||||
{
|
{
|
||||||
E_Border *border;
|
E_Border *border;
|
||||||
|
char *bordername;
|
||||||
int remember_border;
|
int remember_border;
|
||||||
|
Evas_List *cfblist;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _CFBorder
|
||||||
|
{
|
||||||
|
CFData *cfdata;
|
||||||
|
const char *bordername;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* a nice easy setup function that does the dirty work */
|
/* a nice easy setup function that does the dirty work */
|
||||||
|
@ -45,6 +54,7 @@ _fill_data(CFData *cfdata)
|
||||||
if ((cfdata->border->remember) &&
|
if ((cfdata->border->remember) &&
|
||||||
(cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER))
|
(cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER))
|
||||||
cfdata->remember_border = 1;
|
cfdata->remember_border = 1;
|
||||||
|
cfdata->bordername = strdup(cfdata->border->client.border.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -67,6 +77,12 @@ _free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
{
|
{
|
||||||
/* Free the cfdata */
|
/* Free the cfdata */
|
||||||
cfdata->border->border_border_dialog = NULL;
|
cfdata->border->border_border_dialog = NULL;
|
||||||
|
E_FREE(cfdata->bordername);
|
||||||
|
while (cfdata->cfblist)
|
||||||
|
{
|
||||||
|
E_FREE(cfdata->cfblist->data);
|
||||||
|
cfdata->cfblist = evas_list_remove_list(cfdata->cfblist, cfdata->cfblist);
|
||||||
|
}
|
||||||
free(cfdata);
|
free(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +123,13 @@ _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((!cfdata->border->lock_border) && (!cfdata->border->shaded))
|
||||||
|
{
|
||||||
|
if (cfdata->border->client.border.name) free(cfdata->border->client.border.name);
|
||||||
|
cfdata->border->client.border.name = strdup(cfdata->bordername);
|
||||||
|
cfdata->border->client.border.changed = 1;
|
||||||
|
cfdata->border->changed = 1;
|
||||||
|
}
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
return 1; /* Apply was OK */
|
return 1; /* Apply was OK */
|
||||||
}
|
}
|
||||||
|
@ -118,53 +141,58 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
/* generate the core widget layout for a basic dialog */
|
/* generate the core widget layout for a basic dialog */
|
||||||
Evas_Object *o, *ob, *oi, *oj, *orect;
|
Evas_Object *o, *ob, *oi, *oj, *orect;
|
||||||
Evas_Coord wmw, wmh;
|
Evas_Coord wmw, wmh;
|
||||||
|
Evas_List *borders, *l;
|
||||||
|
int sel, n;
|
||||||
|
CFBorder *cfb;
|
||||||
|
|
||||||
_fill_data(cfdata);
|
_fill_data(cfdata);
|
||||||
o = e_widget_list_add(evas, 0, 0);
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
oi = e_widget_ilist_add(evas, 80, 48);
|
oi = e_widget_ilist_add(evas, 80, 48, &(cfdata->bordername));
|
||||||
|
|
||||||
ob = e_livethumb_add(evas);
|
sel = 0;
|
||||||
e_livethumb_vsize_set(ob, 160, 96);
|
borders = e_theme_border_list();
|
||||||
oj = edje_object_add(e_livethumb_evas_get(ob));
|
|
||||||
e_theme_edje_object_set(oj, "base/theme/borders", "widgets/border/default/border");
|
|
||||||
e_livethumb_thumb_set(ob, oj);
|
|
||||||
orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
|
|
||||||
evas_object_color_set(orect, 255, 255, 255, 128);
|
|
||||||
evas_object_show(orect);
|
|
||||||
edje_object_part_swallow(oj, "client", orect);
|
|
||||||
e_widget_ilist_append(oi, ob, "default", NULL, NULL);
|
|
||||||
|
|
||||||
orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
|
cfb = E_NEW(CFBorder, 1);
|
||||||
evas_object_color_set(orect, 255, 255, 255, 128);
|
cfb->cfdata = cfdata;
|
||||||
e_widget_ilist_append(oi, orect, "borderless", NULL, NULL);
|
cfb->bordername = "borderless";
|
||||||
|
cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb);
|
||||||
|
orect = evas_object_rectangle_add(evas);
|
||||||
|
evas_object_color_set(orect, 0, 0, 0, 128);
|
||||||
|
e_widget_ilist_append(oi, orect, "borderless", NULL, NULL, "borderless");
|
||||||
|
|
||||||
|
for (n = 1, l = borders; l; l = l->next, n++)
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
cfb = E_NEW(CFBorder, 1);
|
||||||
|
cfb->cfdata = cfdata;
|
||||||
|
cfb->bordername = l->data;
|
||||||
|
cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb);
|
||||||
|
ob = e_livethumb_add(evas);
|
||||||
|
e_livethumb_vsize_set(ob, 160, 96);
|
||||||
|
oj = edje_object_add(e_livethumb_evas_get(ob));
|
||||||
|
snprintf(buf, sizeof(buf), "widgets/border/%s/border",
|
||||||
|
(char *)l->data);
|
||||||
|
e_theme_edje_object_set(oj, "base/theme/borders", buf);
|
||||||
|
e_livethumb_thumb_set(ob, oj);
|
||||||
|
orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
|
||||||
|
evas_object_color_set(orect, 0, 0, 0, 128);
|
||||||
|
evas_object_show(orect);
|
||||||
|
edje_object_part_swallow(oj, "client", orect);
|
||||||
|
e_widget_ilist_append(oi, ob, (char *)l->data, NULL, NULL, l->data);
|
||||||
|
if (!strcmp(cfdata->border->client.border.name, (char *)l->data))
|
||||||
|
sel = n;
|
||||||
|
}
|
||||||
|
e_widget_ilist_select_set(oi, sel);
|
||||||
|
|
||||||
ob = e_icon_add(evas);
|
|
||||||
e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
|
|
||||||
e_widget_ilist_append(oi, ob, "Item 2", NULL, NULL);
|
|
||||||
ob = e_icon_add(evas);
|
|
||||||
e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
|
|
||||||
e_widget_ilist_append(oi, ob, "Item 3", NULL, NULL);
|
|
||||||
ob = e_icon_add(evas);
|
|
||||||
e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
|
|
||||||
e_widget_ilist_append(oi, ob, "Item 4", NULL, NULL);
|
|
||||||
e_widget_min_size_get(oi, &wmw, &wmh);
|
e_widget_min_size_get(oi, &wmw, &wmh);
|
||||||
e_widget_min_size_set(oi, wmw, 150);
|
e_widget_min_size_set(oi, wmw, 250);
|
||||||
|
|
||||||
e_widget_ilist_go(oi);
|
e_widget_ilist_go(oi);
|
||||||
|
|
||||||
e_widget_list_object_append(o, oi, 1, 1, 0.5);
|
e_widget_list_object_append(o, oi, 1, 1, 0.5);
|
||||||
/*
|
|
||||||
of = e_widget_framelist_add(evas, _("Generic Locks"), 0);
|
|
||||||
ob = e_widget_check_add(evas, _("Lock the Window so it does only what I tell it to"), &(cfdata->do_what_i_say));
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_check_add(evas, _("Protect this window from me accidentally changing it"), &(cfdata->protect_from_me));
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_check_add(evas, _("Protect this window from being accidentally closed because it is important"), &(cfdata->important_window));
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_check_add(evas, _("Do not allow the border to change on this window"), &(cfdata->keep_my_border));
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
|
||||||
*/
|
|
||||||
ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border));
|
ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border));
|
||||||
e_widget_list_object_append(o, ob, 0, 0, 1.0);
|
e_widget_list_object_append(o, ob, 0, 0, 1.0);
|
||||||
return o;
|
return o;
|
||||||
|
|
|
@ -14,7 +14,9 @@ struct _E_Theme_Result
|
||||||
|
|
||||||
static Evas_Bool _e_theme_mappings_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata);
|
static Evas_Bool _e_theme_mappings_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata);
|
||||||
static void _e_theme_category_register(const char *category);
|
static void _e_theme_category_register(const char *category);
|
||||||
static void _e_theme_transition_register(const char *transition);
|
static Evas_List *_e_theme_collection_item_register(Evas_List *list, const char *name);
|
||||||
|
static Evas_List *_e_theme_collection_items_find(const char *base, const char *collname);
|
||||||
|
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Evas_Hash *mappings = NULL;
|
static Evas_Hash *mappings = NULL;
|
||||||
|
@ -22,6 +24,7 @@ static Evas_Hash *group_cache = NULL;
|
||||||
|
|
||||||
static Evas_List *categories = NULL;
|
static Evas_List *categories = NULL;
|
||||||
static Evas_List *transitions = NULL;
|
static Evas_List *transitions = NULL;
|
||||||
|
static Evas_List *borders = NULL;
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
|
|
||||||
|
@ -48,60 +51,8 @@ e_theme_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find transitions */
|
/* Find transitions */
|
||||||
category = strdup("base/theme/transitions");
|
transitions = _e_theme_collection_items_find("base/theme/transitions", "transitions");
|
||||||
if (category)
|
borders = _e_theme_collection_items_find("base/theme/borders", "widgets/border");
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
res = evas_hash_find(mappings, category);
|
|
||||||
if (res)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
/* if found check cached path */
|
|
||||||
str = res->cache;
|
|
||||||
if (!str)
|
|
||||||
{
|
|
||||||
/* no cached path */
|
|
||||||
str = res->file;
|
|
||||||
/* if its not an absolute path find it */
|
|
||||||
if (str[0] != '/')
|
|
||||||
str = e_path_find(path_themes, str);
|
|
||||||
/* save cached value */
|
|
||||||
if (str) res->cache = str;
|
|
||||||
}
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
Evas_List *coll, *l;
|
|
||||||
coll = edje_file_collection_list(str);
|
|
||||||
if (coll)
|
|
||||||
{
|
|
||||||
for (l = coll; l; l = l->next)
|
|
||||||
{
|
|
||||||
if (!strncmp(l->data, "transitions", 11))
|
|
||||||
{
|
|
||||||
char *trans;
|
|
||||||
|
|
||||||
trans = strdup(l->data);
|
|
||||||
p = strchr(trans, '/');
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
p++;
|
|
||||||
_e_theme_transition_register(p);
|
|
||||||
}
|
|
||||||
free(trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
edje_file_collection_list_free(coll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = strrchr(category, '/');
|
|
||||||
if (p) *p = 0;
|
|
||||||
}
|
|
||||||
while (p);
|
|
||||||
free(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -164,6 +115,11 @@ e_theme_shutdown(void)
|
||||||
free(transitions->data);
|
free(transitions->data);
|
||||||
transitions = evas_list_remove_list(transitions, transitions);
|
transitions = evas_list_remove_list(transitions, transitions);
|
||||||
}
|
}
|
||||||
|
while (borders)
|
||||||
|
{
|
||||||
|
free(borders->data);
|
||||||
|
borders = evas_list_remove_list(borders, borders);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,6 +406,25 @@ e_theme_transition_list(void)
|
||||||
return transitions;
|
return transitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_theme_border_find(const char *border)
|
||||||
|
{
|
||||||
|
Evas_List *l;
|
||||||
|
|
||||||
|
for (l = borders; l; l = l->next)
|
||||||
|
{
|
||||||
|
if (!strcmp(border, l->data))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_List *
|
||||||
|
e_theme_border_list(void)
|
||||||
|
{
|
||||||
|
return borders;
|
||||||
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
|
||||||
static Evas_Bool
|
static Evas_Bool
|
||||||
|
@ -478,16 +453,82 @@ _e_theme_category_register(const char *category)
|
||||||
categories = evas_list_append(categories, strdup(category));
|
categories = evas_list_append(categories, strdup(category));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Evas_List *
|
||||||
_e_theme_transition_register(const char *transition)
|
_e_theme_collection_item_register(Evas_List *list, const char *name)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
for (l = transitions; l; l = l->next)
|
for (l = list; l; l = l->next)
|
||||||
{
|
{
|
||||||
if (!strcmp(transition, l->data))
|
if (!strcmp(name, l->data)) return list;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
list = evas_list_append(list, strdup(name));
|
||||||
transitions = evas_list_append(transitions, strdup(transition));
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_List *
|
||||||
|
_e_theme_collection_items_find(const char *base, const char *collname)
|
||||||
|
{
|
||||||
|
Evas_List *list = NULL;
|
||||||
|
E_Theme_Result *res;
|
||||||
|
char *category, *p, *p2;
|
||||||
|
int collname_len;
|
||||||
|
|
||||||
|
collname_len = strlen(collname);
|
||||||
|
category = strdup(base);
|
||||||
|
if (category)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
res = evas_hash_find(mappings, category);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
/* if found check cached path */
|
||||||
|
str = res->cache;
|
||||||
|
if (!str)
|
||||||
|
{
|
||||||
|
/* no cached path */
|
||||||
|
str = res->file;
|
||||||
|
/* if its not an absolute path find it */
|
||||||
|
if (str[0] != '/') str = e_path_find(path_themes, str);
|
||||||
|
/* save cached value */
|
||||||
|
if (str) res->cache = str;
|
||||||
|
}
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
Evas_List *coll, *l;
|
||||||
|
|
||||||
|
coll = edje_file_collection_list(str);
|
||||||
|
if (coll)
|
||||||
|
{
|
||||||
|
for (l = coll; l; l = l->next)
|
||||||
|
{
|
||||||
|
if (!strncmp(l->data, collname, collname_len))
|
||||||
|
{
|
||||||
|
char *trans;
|
||||||
|
|
||||||
|
trans = strdup(l->data);
|
||||||
|
p = trans + collname_len + 1;
|
||||||
|
if (*p)
|
||||||
|
{
|
||||||
|
p2 = strchr(p, '/');
|
||||||
|
if (p2) *p2 = 0;
|
||||||
|
list = _e_theme_collection_item_register(list, p);
|
||||||
|
}
|
||||||
|
free(trans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
edje_file_collection_list_free(coll);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = strrchr(category, '/');
|
||||||
|
if (p) *p = 0;
|
||||||
|
}
|
||||||
|
while (p);
|
||||||
|
free(category);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ EAPI int e_theme_category_find(const char *category);
|
||||||
EAPI Evas_List *e_theme_category_list(void);
|
EAPI Evas_List *e_theme_category_list(void);
|
||||||
EAPI int e_theme_transition_find(const char *transition);
|
EAPI int e_theme_transition_find(const char *transition);
|
||||||
EAPI Evas_List *e_theme_transition_list(void);
|
EAPI Evas_List *e_theme_transition_list(void);
|
||||||
|
EAPI int e_theme_border_find(const char *border);
|
||||||
|
EAPI Evas_List *e_theme_border_list(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,9 +4,18 @@
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
typedef struct _E_Widget_Data E_Widget_Data;
|
typedef struct _E_Widget_Data E_Widget_Data;
|
||||||
|
typedef struct _E_Widget_Callback E_Widget_Callback;
|
||||||
struct _E_Widget_Data
|
struct _E_Widget_Data
|
||||||
{
|
{
|
||||||
Evas_Object *o_widget, *o_scrollframe, *o_ilist;
|
Evas_Object *o_widget, *o_scrollframe, *o_ilist;
|
||||||
|
Evas_List *callbacks;
|
||||||
|
char **value;
|
||||||
|
};
|
||||||
|
struct _E_Widget_Callback
|
||||||
|
{
|
||||||
|
void (*func) (void *data);
|
||||||
|
void *data;
|
||||||
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _e_wid_del_hook(Evas_Object *obj);
|
static void _e_wid_del_hook(Evas_Object *obj);
|
||||||
|
@ -17,7 +26,7 @@ static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *even
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
|
e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value)
|
||||||
{
|
{
|
||||||
Evas_Object *obj, *o;
|
Evas_Object *obj, *o;
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
|
@ -30,6 +39,8 @@ e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
|
||||||
wd = calloc(1, sizeof(E_Widget_Data));
|
wd = calloc(1, sizeof(E_Widget_Data));
|
||||||
e_widget_data_set(obj, wd);
|
e_widget_data_set(obj, wd);
|
||||||
|
|
||||||
|
wd->value = value;
|
||||||
|
|
||||||
o = e_scrollframe_add(evas);
|
o = e_scrollframe_add(evas);
|
||||||
wd->o_scrollframe = o;
|
wd->o_scrollframe = o;
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
@ -51,14 +62,19 @@ e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data)
|
e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val)
|
||||||
{
|
{
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
Evas_Coord mw, mh, vw, vh, w, h;
|
Evas_Coord mw, mh, vw, vh, w, h;
|
||||||
|
E_Widget_Callback *wcb;
|
||||||
|
|
||||||
wd = e_widget_data_get(obj);
|
wd = e_widget_data_get(obj);
|
||||||
/* FIXME: need to actually store the callback and call it */
|
wcb = E_NEW(E_Widget_Callback, 1);
|
||||||
e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, data);
|
wcb->func = func;
|
||||||
|
wcb->data = data;
|
||||||
|
if (val) wcb->value = strdup(val);
|
||||||
|
wd->callbacks = evas_list_append(wd->callbacks, wcb);
|
||||||
|
e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, wcb);
|
||||||
if (icon) evas_object_show(icon);
|
if (icon) evas_object_show(icon);
|
||||||
e_ilist_min_size_get(wd->o_ilist, &mw, &mh);
|
e_ilist_min_size_get(wd->o_ilist, &mw, &mh);
|
||||||
evas_object_resize(wd->o_ilist, mw, mh);
|
evas_object_resize(wd->o_ilist, mw, mh);
|
||||||
|
@ -73,6 +89,15 @@ e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_ilist_select_set(Evas_Object *obj, int n)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_ilist_select_set(wd->o_ilist, n);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_widget_ilist_go(Evas_Object *obj)
|
e_widget_ilist_go(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +113,15 @@ _e_wid_del_hook(Evas_Object *obj)
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
wd = e_widget_data_get(obj);
|
wd = e_widget_data_get(obj);
|
||||||
|
while (wd->callbacks)
|
||||||
|
{
|
||||||
|
E_Widget_Callback *wcb;
|
||||||
|
|
||||||
|
wcb = wd->callbacks->data;
|
||||||
|
if (wcb->value) free(wcb->value);
|
||||||
|
free(wcb);
|
||||||
|
wd->callbacks = evas_list_remove_list(wd->callbacks, wd->callbacks);
|
||||||
|
}
|
||||||
free(wd);
|
free(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,11 +162,25 @@ _e_wid_cb_item_sel(void *data, void *data2)
|
||||||
{
|
{
|
||||||
E_Widget_Data *wd;
|
E_Widget_Data *wd;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
E_Widget_Callback *wcb;
|
||||||
|
|
||||||
wd = data;
|
wd = data;
|
||||||
|
wcb = data2;
|
||||||
e_ilist_selected_geometry_get(wd->o_ilist, &x, &y, &w, &h);
|
e_ilist_selected_geometry_get(wd->o_ilist, &x, &y, &w, &h);
|
||||||
e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
|
e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
|
||||||
if (wd->o_widget) e_widget_change(wd->o_widget);
|
if (wd->o_widget)
|
||||||
|
{
|
||||||
|
e_widget_change(wd->o_widget);
|
||||||
|
if (wd->value)
|
||||||
|
{
|
||||||
|
if (*(wd->value)) free(*(wd->value));
|
||||||
|
if (wcb->value)
|
||||||
|
*(wd->value) = strdup(wcb->value);
|
||||||
|
else
|
||||||
|
*(wd->value) = NULL;
|
||||||
|
}
|
||||||
|
if (wcb->func) wcb->func(wcb->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
#ifndef E_WIDGET_ILIST_H
|
#ifndef E_WIDGET_ILIST_H
|
||||||
#define E_WIDGET_ILIST_H
|
#define E_WIDGET_ILIST_H
|
||||||
|
|
||||||
EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h);
|
EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value);
|
||||||
EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data);
|
EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val);
|
||||||
|
EAPI void e_widget_ilist_select_set(Evas_Object *obj, int n);
|
||||||
EAPI void e_widget_ilist_go(Evas_Object *obj);
|
EAPI void e_widget_ilist_go(Evas_Object *obj);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue