summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2007-01-08 19:23:21 +0000
committerChristopher Michael <cpmichael1@comcast.net>2007-01-08 19:23:21 +0000
commit332f1bc2ce26a393ddc80a917379e43920c8b589 (patch)
tree4d5a173cd60e7faa4f1a40d33815e8c8a3ff43b2
parented8c48f4aeaed9415b2679f38f2d725a77c752e0 (diff)
downloadenlightenment-332f1bc2ce26a393ddc80a917379e43920c8b589.tar.gz
Rework of the ilist widget.
- Added ability to optionally do multi-select and range-select. - Update Font Config Dialog to allow multi-select & setting of fonts in batch. No changes should be necessary for existing apps/dialogs that use ilist. If you would like to implement multi-select in something, have a look at the font config dialog for usage. SVN revision: 27875
-rw-r--r--src/bin/e_ilist.c1004
-rw-r--r--src/bin/e_ilist.h52
-rw-r--r--src/bin/e_int_config_fonts.c114
-rw-r--r--src/bin/e_widget_ilist.c50
-rw-r--r--src/bin/e_widget_ilist.h7
5 files changed, 717 insertions, 510 deletions
diff --git a/src/bin/e_ilist.c b/src/bin/e_ilist.c
index a5b7f7be71..ee99971223 100644
--- a/src/bin/e_ilist.c
+++ b/src/bin/e_ilist.c
@@ -1,501 +1,692 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#include "e.h"
#define SMART_NAME "e_ilist"
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
+
typedef struct _E_Smart_Data E_Smart_Data;
-typedef struct _E_Smart_Item E_Smart_Item;
-
-struct _E_Smart_Data
-{
- Evas_Coord x, y, w, h;
-
- Evas_Object *smart_obj;
- Evas_Object *box_obj;
- Evas_List *items;
- int selected;
- Evas_Coord icon_w, icon_h;
- unsigned char selector : 1;
+struct _E_Smart_Data
+{
+ Evas_Coord x, y, w, h, iw, ih;
+ Evas_Object *o_smart;
+ Evas_Object *o_box;
+ Evas_List *items;
+ int selected;
+ unsigned char selector : 1;
+ unsigned char multi_select : 1;
};
-struct _E_Smart_Item
-{
- E_Smart_Data *sd;
- Evas_Object *base_obj;
- Evas_Object *icon_obj;
- void (*func) (void *data, void *data2);
- void (*func_hilight) (void *data, void *data2);
- void *data;
- void *data2;
- unsigned char header : 1;
-};
+static void _e_smart_init (void);
+static void _e_smart_add (Evas_Object *obj);
+static void _e_smart_del (Evas_Object *obj);
+static void _e_smart_show (Evas_Object *obj);
+static void _e_smart_hide (Evas_Object *obj);
+static void _e_smart_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
+static void _e_smart_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+static void _e_smart_color_set (Evas_Object *obj, int r, int g, int b, int a);
+static void _e_smart_clip_set (Evas_Object *obj, Evas_Object *clip);
+static void _e_smart_clip_unset (Evas_Object *obj);
+static void _e_smart_reconfigure (E_Smart_Data *sd);
+static void _e_smart_event_mouse_down (void *data, Evas *evas, Evas_Object *obj, void *event_info);
+static void _e_smart_event_mouse_up (void *data, Evas *evas, Evas_Object *obj, void *event_info);
+static void _e_smart_event_key_down (void *data, Evas *evas, Evas_Object *obj, void *event_info);
-/* local subsystem functions */
-static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _e_smart_reconfigure(E_Smart_Data *sd);
-static void _e_smart_add(Evas_Object *obj);
-static void _e_smart_del(Evas_Object *obj);
-static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
-static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
-static void _e_smart_show(Evas_Object *obj);
-static void _e_smart_hide(Evas_Object *obj);
-static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
-static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
-static void _e_smart_clip_unset(Evas_Object *obj);
-static void _e_smart_init(void);
-
-/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
-/* externally accessible functions */
EAPI Evas_Object *
-e_ilist_add(Evas *evas)
+e_ilist_add(Evas *evas)
{
_e_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
-EAPI void
-e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+EAPI void
+e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
{
- Evas_List *l;
-
- API_ENTRY return;
- if ((sd->icon_w == w) && (sd->icon_h == h)) return;
- sd->icon_w = w;
- sd->icon_h = h;
- for (l = sd->items; l; l = l->next)
- {
- E_Smart_Item *si;
-
- si = l->data;
- if (si->icon_obj)
- {
- Evas_Coord mw = 0, mh = 0;
-
- edje_extern_object_min_size_set(si->icon_obj, sd->icon_w, sd->icon_h);
- edje_object_part_swallow(si->base_obj, "e.swallow.icon", si->icon_obj);
- edje_object_size_min_calc(si->base_obj, &mw, &mh);
- e_box_pack_options_set(si->icon_obj,
- 1, 1, /* fill */
- 1, 0, /* expand */
- 0.5, 0.5, /* align */
- mw, mh, /* min */
- 99999, 99999 /* max */
- );
- }
- }
-}
-
-EAPI void
-e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
-{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
Evas_Coord mw = 0, mh = 0;
API_ENTRY return;
- si = E_NEW(E_Smart_Item, 1);
+ si = E_NEW(E_Ilist_Item, 1);
si->sd = sd;
- si->base_obj = edje_object_add(evas_object_evas_get(sd->smart_obj));
+ si->o_base = edje_object_add(evas_object_evas_get(sd->o_smart));
- if (header)
- e_theme_edje_object_set(si->base_obj, "base/theme/widgets",
+ if (header)
+ e_theme_edje_object_set(si->o_base, "base/theme/widgets",
"e/widgets/ilist_header");
else if (evas_list_count(sd->items) & 0x1)
- e_theme_edje_object_set(si->base_obj, "base/theme/widgets",
+ e_theme_edje_object_set(si->o_base, "base/theme/widgets",
"e/widgets/ilist_odd");
else
- e_theme_edje_object_set(si->base_obj, "base/theme/widgets",
+ e_theme_edje_object_set(si->o_base, "base/theme/widgets",
"e/widgets/ilist");
- edje_object_part_text_set(si->base_obj, "e.text.label", label);
- si->icon_obj = icon;
- if (si->icon_obj)
+ if (label)
+ edje_object_part_text_set(si->o_base, "e.text.label", label);
+ si->o_icon = icon;
+ if (si->o_icon)
{
- edje_extern_object_min_size_set(si->icon_obj, sd->icon_w, sd->icon_h);
- edje_object_part_swallow(si->base_obj, "e.swallow.icon", si->icon_obj);
- evas_object_show(si->icon_obj);
+ edje_extern_object_min_size_set(si->o_icon, sd->iw, sd->ih);
+ edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
+ evas_object_show(si->o_icon);
}
- si->func = func;
+ si->func = func;
si->func_hilight = func_hilight;
si->data = data;
si->data2 = data2;
si->header = header;
sd->items = evas_list_append(sd->items, si);
- edje_object_size_min_calc(si->base_obj, &mw, &mh);
- e_box_freeze(sd->box_obj);
- e_box_pack_end(sd->box_obj, si->base_obj);
- e_box_pack_options_set(si->base_obj,
- 1, 1, /* fill */
- 1, 1, /* expand */
- 0.5, 0.5, /* align */
- mw, mh, /* min */
- 99999, 99999 /* max */
- );
- e_box_thaw(sd->box_obj);
- evas_object_lower(si->base_obj);
- evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, si);
- evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, si);
- evas_object_show(si->base_obj);
-}
-
-EAPI void
-e_ilist_selected_set(Evas_Object *obj, int n)
-{
- E_Smart_Item *si;
+ edje_object_size_min_calc(si->o_base, &mw, &mh);
+ e_box_freeze(sd->o_box);
+ e_box_pack_end(sd->o_box, si->o_base);
+ e_box_pack_options_set(si->o_base, 1, 1, 1, 1, 0.5, 0.5,
+ mw, mh, 99999, 99999);
+ e_box_thaw(sd->o_box);
+
+ evas_object_lower(sd->o_box);
+ evas_object_event_callback_add(si->o_base, EVAS_CALLBACK_MOUSE_DOWN,
+ _e_smart_event_mouse_down, si);
+ evas_object_event_callback_add(si->o_base, EVAS_CALLBACK_MOUSE_UP,
+ _e_smart_event_mouse_up, si);
+ evas_object_show(si->o_base);
+}
+
+EAPI void
+e_ilist_clear(Evas_Object *obj)
+{
API_ENTRY return;
- if (!sd->items) return;
- if (n >= evas_list_count(sd->items)) n = evas_list_count(sd->items) - 1;
- else if (n < 0) n = 0;
- if (sd->selected == n) return;
- si = evas_list_nth(sd->items, sd->selected);
- if (si) edje_object_signal_emit(si->base_obj, "e,state,unselected", "e");
- sd->selected = n;
- si = evas_list_nth(sd->items, sd->selected);
- if (si)
+ while (sd->items)
{
- evas_object_raise(si->base_obj);
- edje_object_signal_emit(si->base_obj, "e,state,selected", "e");
- if (si->func_hilight) si->func_hilight(si->data, si->data2);
- if (!sd->selector)
- {
- if (si->func) si->func(si->data, si->data2);
- }
+ E_Ilist_Item *si;
+
+ si = sd->items->data;
+ sd->items = evas_list_remove_list(sd->items, sd->items);
+ if (si->o_icon) evas_object_del(si->o_icon);
+ evas_object_del(si->o_base);
+ E_FREE(si);
}
+ sd->selected = -1;
}
-EAPI int
-e_ilist_selected_get(Evas_Object *obj)
+EAPI void
+e_ilist_freeze(Evas_Object *obj)
{
- API_ENTRY return -1;
- if (!sd->items) return -1;
- return sd->selected;
+ API_ENTRY return;
+ e_box_freeze(sd->o_box);
+}
+
+EAPI void
+e_ilist_thaw(Evas_Object *obj)
+{
+ API_ENTRY return;
+ e_box_thaw(sd->o_box);
+}
+
+EAPI int
+e_ilist_count(Evas_Object *obj)
+{
+ API_ENTRY return 0;
+ return evas_list_count(sd->items);
+}
+
+EAPI int
+e_ilist_selector_get(Evas_Object *obj)
+{
+ API_ENTRY return 0;
+ return sd->selector;
+}
+
+EAPI void
+e_ilist_selector_set(Evas_Object *obj, int selector)
+{
+ API_ENTRY return;
+ sd->selector = selector;
}
-EAPI void
-e_ilist_unselect(Evas_Object *obj)
+EAPI int
+e_ilist_multi_select_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ API_ENTRY return 0;
+ return sd->multi_select;
+}
+
+EAPI void
+e_ilist_multi_select_set(Evas_Object *obj, int multi)
+{
+ API_ENTRY return;
+ sd->multi_select = multi;
+}
+
+EAPI void
+e_ilist_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
+{
+ API_ENTRY return;
+ e_box_min_size_get(sd->o_box, w, h);
+}
+
+EAPI void
+e_ilist_unselect(Evas_Object *obj)
+{
+ Evas_List *l;
API_ENTRY return;
if (!sd->items) return;
- si = evas_list_nth(sd->items, sd->selected);
- if (si) edje_object_signal_emit(si->base_obj, "e,state,unselected", "e");
+ if (sd->selected < 0) return;
+ for (l = sd->items; l; l = l->next)
+ {
+ E_Ilist_Item *si;
+
+ si = l->data;
+ if (!si) continue;
+ if (!si->selected) continue;
+ edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
+ }
sd->selected = -1;
}
-EAPI const char *
-e_ilist_selected_label_get(Evas_Object *obj)
+EAPI void
+e_ilist_selected_set(Evas_Object *obj, int n)
{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
+ Evas_List *l;
+ int i;
- API_ENTRY return NULL;
- if (!sd->items) return NULL;
- si = evas_list_nth(sd->items, sd->selected);
- if (si) return edje_object_part_text_get(si->base_obj, "e.text.label");
- return NULL;
+ API_ENTRY return;
+ if (!sd->items) return;
+
+ i = evas_list_count(sd->items);
+ if (n >= i) n = i - 1;
+ else if (n < 0) n = 0;
+// if (sd->selected == n) return;
+
+ for (l = sd->items; l; l = l->next)
+ {
+ si = l->data;
+ if (!si) continue;
+ if (!si->selected) continue;
+ edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
+ si->selected = 0;
+ }
+ sd->selected = -1;
+ si = evas_list_nth(sd->items, n);
+ if (!si) return;
+ si->selected = 1;
+ sd->selected = n;
+ evas_object_raise(si->o_base);
+ edje_object_signal_emit(si->o_base, "e,state,selected", "e");
+ if (si->func_hilight) si->func_hilight(si->data, si->data2);
+ if (sd->selector) return;
+ if (si->func) si->func(si->data, si->data2);
}
-EAPI Evas_Object *
-e_ilist_selected_icon_get(Evas_Object *obj)
+EAPI int
+e_ilist_selected_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ API_ENTRY return -1;
+ if (!sd->items) return -1;
+ return sd->selected;
+}
+
+EAPI const char *
+e_ilist_selected_label_get(Evas_Object *obj)
+{
+ E_Ilist_Item *si;
API_ENTRY return NULL;
if (!sd->items) return NULL;
+ if (sd->multi_select) return NULL;
+ if (sd->selected < 0) return NULL;
si = evas_list_nth(sd->items, sd->selected);
- if (si) return si->icon_obj;
+ if (si) return edje_object_part_text_get(si->o_base, "e.text.label");
return NULL;
}
EAPI void *
-e_ilist_selected_data_get(Evas_Object *obj)
+e_ilist_selected_data_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
API_ENTRY return NULL;
if (!sd->items) return NULL;
+ if (sd->multi_select) return NULL;
+ if (sd->selected < 0) return NULL;
si = evas_list_nth(sd->items, sd->selected);
if (si) return si->data;
return NULL;
}
EAPI void *
-e_ilist_selected_data2_get(Evas_Object *obj)
+e_ilist_selected_data2_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
API_ENTRY return NULL;
if (!sd->items) return NULL;
+ if (sd->multi_select) return NULL;
+ if (sd->selected < 0) return NULL;
si = evas_list_nth(sd->items, sd->selected);
if (si) return si->data2;
return NULL;
}
-EAPI void
-e_ilist_selected_geometry_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
+EAPI Evas_Object *
+e_ilist_selected_icon_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
- API_ENTRY return;
+ API_ENTRY return NULL;
+ if (!sd->items) return NULL;
+ if (sd->multi_select) return NULL;
+ if (sd->selected < 0) return NULL;
si = evas_list_nth(sd->items, sd->selected);
- if (si)
- {
- evas_object_geometry_get(si->base_obj, x, y, w, h);
- *x -= sd->x;
- *y -= sd->y;
- }
-}
-
-EAPI void
-e_ilist_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
-{
- API_ENTRY return;
- e_box_min_size_get(sd->box_obj, w, h);
+ if (si) return si->o_icon;
+ return NULL;
}
-EAPI void
-e_ilist_selector_set(Evas_Object *obj, int selector)
+EAPI void
+e_ilist_selected_geometry_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
+ E_Ilist_Item *si;
+
API_ENTRY return;
- sd->selector = selector;
-}
-
-EAPI int
-e_ilist_selector_get(Evas_Object *obj)
-{
- API_ENTRY return 0;
- return sd->selector;
+ if (!sd->items) return;
+// if (sd->multi_select) return;
+ if (sd->selected < 0) return;
+ si = evas_list_nth(sd->items, sd->selected);
+ if (!si) return;
+ evas_object_geometry_get(si->o_base, x, y, w, h);
+ *x -= sd->x;
+ *y -= sd->y;
}
-EAPI void
-e_ilist_remove_num(Evas_Object *obj, int n)
+EAPI void
+e_ilist_remove_num(Evas_Object *obj, int n)
{
- E_Smart_Item *si;
+ E_Ilist_Item *si;
API_ENTRY return;
if (!sd->items) return;
si = evas_list_nth(sd->items, n);
- if (si)
- {
- sd->items = evas_list_remove(sd->items, si);
- if (e_ilist_selected_get(obj) == n)
- sd->selected = -1;
- if (si->icon_obj) evas_object_del(si->icon_obj);
- evas_object_del(si->base_obj);
- free(si);
- }
+ if (!si) return;
+ sd->items = evas_list_remove(sd->items, si);
+ if (sd->selected == n) sd->selected = -1;
+ if (si->o_icon) evas_object_del(si->o_icon);
+ evas_object_del(si->o_base);
+ E_FREE(si);
}
-EAPI void
-e_ilist_remove_label(Evas_Object *obj, const char *label)
+EAPI void
+e_ilist_remove_label(Evas_Object *obj, const char *label)
{
- E_Smart_Item *si;
Evas_List *l;
- int i;
API_ENTRY return;
if (!sd->items) return;
if (!label) return;
- for (i = 0, l = sd->items; l; l = l->next, i++)
+ for (l = sd->items; l; l = l->next)
{
+ E_Ilist_Item *si;
+ char *t;
+
si = l->data;
- if (si)
+ if (!si) continue;
+ t = strdup(edje_object_part_text_get(si->o_base, "e.text.label"));
+ if (!strcmp(t, label))
{
- char *t;
- t = strdup(edje_object_part_text_get(si->base_obj, "e.text.label"));
- if (!strcmp(t, label))
- {
- if (si->icon_obj) evas_object_del(si->icon_obj);
- evas_object_del(si->base_obj);
- sd->items = evas_list_remove(sd->items, si);
- free(si);
- break;
- }
+ if (si->o_icon) evas_object_del(si->o_icon);
+ evas_object_del(si->o_base);
+ sd->items = evas_list_remove(sd->items, si);
+ E_FREE(si);
free(t);
+ break;
}
+ free(t);
}
}
EAPI const char *
-e_ilist_nth_label_get(Evas_Object *obj, int n)
-{
- E_Smart_Item *si;
+e_ilist_nth_label_get(Evas_Object *obj, int n)
+{
+ E_Ilist_Item *si;
API_ENTRY return NULL;
if (!sd->items) return NULL;
si = evas_list_nth(sd->items, n);
- if (si) return edje_object_part_text_get(si->base_obj, "e.text.label");
+ if (si) return edje_object_part_text_get(si->o_base, "e.text.label");
return NULL;
}
-EAPI void
-e_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
-{
- E_Smart_Item *si;
+EAPI void
+e_ilist_nth_label_set(Evas_Object *obj, int n, const char *label)
+{
+ E_Ilist_Item *si;
API_ENTRY return;
if (!sd->items) return;
+ if (!label) return;
si = evas_list_nth(sd->items, n);
- if (si) edje_object_part_text_set(si->base_obj, "e.text.label", label);
+ if (si) edje_object_part_text_set(si->o_base, "e.text.label", label);
}
EAPI Evas_Object *
-e_ilist_nth_icon_get(Evas_Object *obj, int n)
-{
- E_Smart_Item *si;
+e_ilist_nth_icon_get(Evas_Object *obj, int n)
+{
+ E_Ilist_Item *si;
API_ENTRY return NULL;
if (!sd->items) return NULL;
si = evas_list_nth(sd->items, n);
- if (si) return si->icon_obj;
+ if (si) return si->o_icon;
return NULL;
}
-EAPI void
-e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
-{
- E_Smart_Item *si;
+EAPI void
+e_ilist_nth_icon_set(Evas_Object *obj, int n, Evas_Object *icon)
+{
+ E_Ilist_Item *si;
API_ENTRY return;
if (!sd->items) return;
si = evas_list_nth(sd->items, n);
- if (si)
- {
- if (si->icon_obj)
- {
- edje_object_part_unswallow(si->base_obj, si->icon_obj);
- evas_object_hide(si->icon_obj);
- evas_object_del(si->icon_obj);
- }
-
- si->icon_obj = icon;
- if (si->icon_obj)
- {
- edje_extern_object_min_size_set(si->icon_obj, sd->icon_w, sd->icon_h);
- edje_object_part_swallow(si->base_obj, "e.swallow.icon", si->icon_obj);
- evas_object_show(si->icon_obj);
- }
+ if (!si) return;
+ if (si->o_icon)
+ {
+ edje_object_part_unswallow(si->o_base, si->o_icon);
+ evas_object_del(si->o_icon);
+ }
+ si->o_icon = icon;
+ if (si->o_icon)
+ {
+ edje_extern_object_min_size_set(si->o_icon, sd->iw, sd->ih);
+ edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
+ evas_object_show(si->o_icon);
}
}
-EAPI int
-e_ilist_count(Evas_Object *obj)
+EAPI int
+e_ilist_nth_is_header(Evas_Object *obj, int n)
{
+ E_Ilist_Item *si;
+
API_ENTRY return 0;
- return evas_list_count(sd->items);
+ if (!sd->items) return 0;
+ si = evas_list_nth(sd->items, n);
+ if (si) return si->header;
+ return 0;
}
-EAPI void
-e_ilist_clear(Evas_Object *obj)
+EAPI void
+e_ilist_icon_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
+ Evas_List *l;
+
API_ENTRY return;
- while (sd->items)
+ if ((sd->iw == w) && (sd->ih == h)) return;
+ sd->iw = w;
+ sd->ih = h;
+ for (l = sd->items; l; l = l->next)
{
- E_Smart_Item *si;
-
- si = sd->items->data;
- sd->items = evas_list_remove_list(sd->items, sd->items);
- if (si->icon_obj) evas_object_del(si->icon_obj);
- evas_object_del(si->base_obj);
- free(si);
+ E_Ilist_Item *si;
+ Evas_Coord mw = 0, mh = 0;
+
+ si = l->data;
+ if (!si) continue;
+ if (!si->o_icon) continue;
+ edje_extern_object_min_size_set(si->o_icon, w, h);
+ edje_object_part_swallow(si->o_base, "e.swallow.icon", si->o_icon);
+ edje_object_size_min_calc(si->o_base, &mw, &mh);
+ e_box_pack_options_set(si->o_icon, 1, 1, 1, 0, 0.5, 0.5,
+ mw, mh, 99999, 99999);
}
- sd->selected = -1;
}
-EAPI int
-e_ilist_nth_is_header(Evas_Object *obj, int n)
+EAPI Evas_List *
+e_ilist_items_get(Evas_Object *obj)
{
- E_Smart_Item *si;
+ API_ENTRY return;
+ return sd->items;
+}
- API_ENTRY return 0;
- if (!sd->items) return 0;
+EAPI void
+e_ilist_multi_select(Evas_Object *obj, int n)
+{
+ E_Ilist_Item *si;
+ int i;
+
+ API_ENTRY return;
+ if (!sd->items) return;
+ if (!sd->multi_select) return;
+
+ i = evas_list_count(sd->items);
+ if (n >= i) n = i - 1;
+ else if (n < 0) n = 0;
+
si = evas_list_nth(sd->items, n);
- if (si) return si->header;
- return 0;
+ if (!si) return;
+ sd->selected = n;
+ if (si->selected)
+ {
+ edje_object_signal_emit(si->o_base, "e,state,unselected", "e");
+ si->selected = 0;
+ return;
+ }
+ si->selected = 1;
+ evas_object_raise(si->o_base);
+ edje_object_signal_emit(si->o_base, "e,state,selected", "e");
+ if (si->func_hilight) si->func_hilight(si->data, si->data2);
+ if (sd->selector) return;
+ if (si->func) si->func(si->data, si->data2);
}
-EAPI void
-e_ilist_freeze(Evas_Object *obj)
+EAPI void
+e_ilist_range_select(Evas_Object *obj, int n)
{
+ E_Ilist_Item *si;
+ Evas_List *l;
+ int i, j, dir;
+
API_ENTRY return;
- e_box_freeze(sd->box_obj);
+ if (!sd->items) return;
+ if (!sd->multi_select) return;
+
+ i = evas_list_count(sd->items);
+ if (n >= i) n = i - 1;
+ else if (n < 0) n = 0;
+
+ if (n < sd->selected) dir = 0;
+ else dir = 1;
+
+ si = evas_list_nth(sd->items, n);
+ if (!si) return;
+ if (dir == 1)
+ {
+ for (j = (sd->selected + 1); ((j < i) && (j <= n)); j++)
+ e_ilist_multi_select(sd->o_smart, j);
+ }
+ else
+ {
+ for (j = (sd->selected - 1); ((j >= 0) && (j >= n)); j--)
+ e_ilist_multi_select(sd->o_smart, j);
+ }
}
-EAPI void
-e_ilist_thaw(Evas_Object *obj)
+/* SMART FUNCTIONS */
+static void
+_e_smart_init(void)
{
- API_ENTRY return;
- e_box_thaw(sd->box_obj);
+ if (_e_smart) return;
+ _e_smart = evas_smart_new(SMART_NAME, _e_smart_add, _e_smart_del,
+ NULL, NULL, NULL, NULL, NULL,
+ _e_smart_move, _e_smart_resize, _e_smart_show,
+ _e_smart_hide, _e_smart_color_set,
+ _e_smart_clip_set, _e_smart_clip_unset, NULL);
+}
+
+static void
+_e_smart_add(Evas_Object *obj)
+{
+ E_Smart_Data *sd;
+
+ sd = calloc(1, sizeof(E_Smart_Data));
+ if (!sd) return;
+ evas_object_smart_data_set(obj, sd);
+
+ sd->o_smart = obj;
+ sd->x = sd->y = sd->w = sd->h = 0;
+ sd->iw = sd->ih = 24;
+ sd->selected = -1;
+ sd->multi_select = 0;
+
+ sd->o_box = e_box_add(evas_object_evas_get(obj));
+ e_box_align_set(sd->o_box, 0.0, 0.0);
+ e_box_homogenous_set(sd->o_box, 0);
+ evas_object_smart_member_add(sd->o_box, obj);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
+ _e_smart_event_key_down, sd);
+ evas_object_propagate_events_set(obj, 0);
+}
+
+static void
+_e_smart_del(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ e_ilist_clear(obj);
+ evas_object_del(sd->o_box);
+ free(sd);
+}
+
+static void
+_e_smart_show(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_show(sd->o_box);
+}
+
+static void
+_e_smart_hide(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_hide(sd->o_box);
+}
+
+static void
+_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+ INTERNAL_ENTRY;
+ if ((sd->x == x) && (sd->y == y)) return;
+ sd->x = x;
+ sd->y = y;
+ _e_smart_reconfigure(sd);
+}
+
+static void
+_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ INTERNAL_ENTRY;
+ if ((sd->w == w) && (sd->h == h)) return;
+ sd->w = w;
+ sd->h = h;
+ _e_smart_reconfigure(sd);
+}
+
+static void
+_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
+{
+ INTERNAL_ENTRY;
+ evas_object_color_set(sd->o_box, r, g, b, a);
+}
+
+static void
+_e_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_set(sd->o_box, clip);
+}
+
+static void
+_e_smart_clip_unset(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_unset(sd->o_box);
+}
+
+static void
+_e_smart_reconfigure(E_Smart_Data *sd)
+{
+ evas_object_move(sd->o_box, sd->x, sd->y);
+ evas_object_resize(sd->o_box, sd->w, sd->h);
}
-/* local subsystem functions */
static void
-_e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
+ E_Smart_Data *sd;
Evas_Event_Mouse_Down *ev;
- E_Smart_Item *si;
+ E_Ilist_Item *si;
Evas_List *l;
int i;
-
- si = data;
- ev = event_info;
+ ev = event_info;
+ si = data;
+ sd = si->sd;
+
if (si->header) return;
-
- for (i = 0, l = si->sd->items; l; l = l->next, i++)
+ if (!sd->items) return;
+ for (i = 0, l = sd->items; l; l = l->next, i++)
{
- if (l->data == si)
+ if (l->data == si)
{
- e_ilist_selected_set(si->sd->smart_obj, i);
+ if (!sd->multi_select)
+ e_ilist_selected_set(sd->o_smart, i);
+ else
+ {
+ if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ e_ilist_range_select(sd->o_smart, i);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ e_ilist_multi_select(sd->o_smart, i);
+ else
+ e_ilist_selected_set(sd->o_smart, i);
+ }
break;
}
}
+
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- evas_object_smart_callback_call(si->sd->smart_obj, "selected", NULL);
+ evas_object_smart_callback_call(sd->o_smart, "selected", NULL);
}
static void
-_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
+ E_Smart_Data *sd;
Evas_Event_Mouse_Up *ev;
- E_Smart_Item *si;
-
- si = data;
- ev = event_info;
+ E_Ilist_Item *si;
+ ev = event_info;
+ si = data;
+ sd = si->sd;
+
if (si->header) return;
-
- if (si->sd->selector)
- {
- si = evas_list_nth(si->sd->items, si->sd->selected);
- if (si)
- {
- if (si->func) si->func(si->data, si->data2);
- }
- }
+ if (!sd->items) return;
+ if (!sd->selector) return;
+ si = evas_list_nth(sd->items, sd->selected);
+ if (!si) return;
+ if (si->func) si->func(si->data, si->data2);
}
-static void
-_e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+static void
+_e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
E_Smart_Data *sd;
+ E_Ilist_Item *si;
+ int n, ns;
sd = data;
ev = event_info;
- if ((!strcmp(ev->keyname, "Up")) ||
- (!strcmp(ev->keyname, "KP_Up")))
+ ns = sd->selected;
+ if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
{
- int n, ns;
- E_Smart_Item *si;
-
- ns = e_ilist_selected_get(sd->smart_obj);
n = ns;
do
{
@@ -508,15 +699,20 @@ _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
si = evas_list_nth(sd->items, n);
}
while ((si) && (si->header));
- if (n != ns) e_ilist_selected_set(sd->smart_obj, n);
+ if (n != ns)
+ {
+ if (!sd->multi_select)
+ e_ilist_selected_set(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ e_ilist_multi_select(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ e_ilist_range_select(sd->o_smart, n);
+ else
+ e_ilist_selected_set(sd->o_smart, n);
+ }
}
- else if ((!strcmp(ev->keyname, "Down")) ||
- (!strcmp(ev->keyname, "KP_Down")))
+ else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
{
- int n, ns;
- E_Smart_Item *si;
-
- ns = e_ilist_selected_get(sd->smart_obj);
n = ns;
do
{
@@ -529,15 +725,20 @@ _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
si = evas_list_nth(sd->items, n);
}
while ((si) && (si->header));
- if (n != ns) e_ilist_selected_set(sd->smart_obj, n);
+ if (n != ns)
+ {
+ if (!sd->multi_select)
+ e_ilist_selected_set(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ e_ilist_multi_select(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ e_ilist_range_select(sd->o_smart, n);
+ else
+ e_ilist_selected_set(sd->o_smart, n);
+ }
}
- else if ((!strcmp(ev->keyname, "Home")) ||
- (!strcmp(ev->keyname, "KP_Home")))
+ else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
{
- int n, ns;
- E_Smart_Item *si;
-
- ns = e_ilist_selected_get(sd->smart_obj);
n = -1;
do
{
@@ -550,15 +751,20 @@ _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
si = evas_list_nth(sd->items, n);
}
while ((si) && (si->header));
- if (n != ns) e_ilist_selected_set(sd->smart_obj, n);
+ if (n != ns)
+ {
+ if (!sd->multi_select)
+ e_ilist_selected_set(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ e_ilist_multi_select(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ e_ilist_range_select(sd->o_smart, n);
+ else
+ e_ilist_selected_set(sd->o_smart, n);
+ }
}
- else if ((!strcmp(ev->keyname, "End")) ||
- (!strcmp(ev->keyname, "KP_End")))
+ else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
{
- int n, ns;
- E_Smart_Item *si;
-
- ns = e_ilist_selected_get(sd->smart_obj);
n = evas_list_count(sd->items);
do
{
@@ -571,148 +777,26 @@ _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
si = evas_list_nth(sd->items, n);
}
while ((si) && (si->header));
- if (n != ns) e_ilist_selected_set(sd->smart_obj, n);
+ if (n != ns)
+ {
+ if (!sd->multi_select)
+ e_ilist_selected_set(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Control"))
+ e_ilist_multi_select(sd->o_smart, n);
+ else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+ e_ilist_range_select(sd->o_smart, n);
+ else
+ e_ilist_selected_set(sd->o_smart, n);
+ }
}
else if ((!strcmp(ev->keyname, "Return")) ||
(!strcmp(ev->keyname, "KP_Enter")) ||
(!strcmp(ev->keyname, "space")))
{
- E_Smart_Item *si;
-
si = evas_list_nth(sd->items, sd->selected);
if (si)
{
if (si->func) si->func(si->data, si->data2);
}
- }
-}
-
-static void
-_e_smart_reconfigure(E_Smart_Data *sd)
-{
- evas_object_move(sd->box_obj, sd->x, sd->y);
- evas_object_resize(sd->box_obj, sd->w, sd->h);
-}
-
-static void
-_e_smart_add(Evas_Object *obj)
-{
- E_Smart_Data *sd;
-
- sd = calloc(1, sizeof(E_Smart_Data));
- if (!sd) return;
- evas_object_smart_data_set(obj, sd);
-
- sd->smart_obj = obj;
- sd->x = 0;
- sd->y = 0;
- sd->w = 0;
- sd->h = 0;
-
- sd->icon_w = 24;
- sd->icon_h = 24;
-
- sd->selected = -1;
-
- sd->box_obj = e_box_add(evas_object_evas_get(obj));
- e_box_align_set(sd->box_obj, 0.0, 0.0);
- e_box_homogenous_set(sd->box_obj, 0);
- evas_object_smart_member_add(sd->box_obj, obj);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _e_smart_event_key_down, sd);
- evas_object_propagate_events_set(obj, 0);
-}
-
-static void
-_e_smart_del(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
- while (sd->items)
- {
- E_Smart_Item *si;
-
- si = sd->items->data;
- sd->items = evas_list_remove_list(sd->items, sd->items);
- if (si->icon_obj) evas_object_del(si->icon_obj);
- evas_object_del(si->base_obj);
- free(si);
- }
- evas_object_del(sd->box_obj);
- free(sd);
-}
-
-static void
-_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
-{
- INTERNAL_ENTRY;
- if ((sd->x == x) && (sd->y == y)) return;
- sd->x = x;
- sd->y = y;
- _e_smart_reconfigure(sd);
-}
-
-static void
-_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
-{
- INTERNAL_ENTRY;
- if ((sd->w == w) && (sd->h == h)) return;
- sd->w = w;
- sd->h = h;
- _e_smart_reconfigure(sd);
-}
-
-static void
-_e_smart_show(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
- evas_object_show(sd->box_obj);
-}
-
-static void
-_e_smart_hide(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
- evas_object_hide(sd->box_obj);
-}
-
-static void
-_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
-{
- INTERNAL_ENTRY;
- evas_object_color_set(sd->box_obj, r, g, b, a);
+ }
}
-
-static void
-_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
-{
- INTERNAL_ENTRY;
- evas_object_clip_set(sd->box_obj, clip);
-}
-
-static void
-_e_smart_clip_unset(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
- evas_object_clip_unset(sd->box_obj);
-}
-
-/* never need to touch this */
-
-static void
-_e_smart_init(void)
-{
- if (_e_smart) return;
- _e_smart = evas_smart_new(SMART_NAME,
- _e_smart_add,
- _e_smart_del,
- NULL, NULL, NULL, NULL, NULL,
- _e_smart_move,
- _e_smart_resize,
- _e_smart_show,
- _e_smart_hide,
- _e_smart_color_set,
- _e_smart_clip_set,
- _e_smart_clip_unset,
- NULL);
-}
-
diff --git a/src/bin/e_ilist.h b/src/bin/e_ilist.h
index b964c6250c..8b3fff50f1 100644
--- a/src/bin/e_ilist.h
+++ b/src/bin/e_ilist.h
@@ -1,36 +1,54 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef E_TYPEDEFS
+
+typedef struct _E_Ilist_Item E_Ilist_Item;
+
#else
#ifndef E_ILIST_H
#define E_ILIST_H
+struct _E_Ilist_Item
+{
+ void *sd;
+ Evas_Object *o_base;
+ Evas_Object *o_icon;
+ unsigned char header : 1;
+ unsigned char selected : 1;
+
+ void (*func) (void *data, void *data2);
+ void (*func_hilight) (void *data, void *data2);
+ void *data, *data2;
+};
+
EAPI Evas_Object *e_ilist_add (Evas *evas);
-EAPI void e_ilist_icon_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void e_ilist_append (Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2);
+EAPI void e_ilist_clear (Evas_Object *obj);
+EAPI void e_ilist_freeze (Evas_Object *obj);
+EAPI void e_ilist_thaw (Evas_Object *obj);
+EAPI int e_ilist_count (Evas_Object *obj);
+EAPI int e_ilist_selector_get (Evas_Object *obj);
+EAPI void e_ilist_selector_set (Evas_Object *obj, int selector);
+EAPI int e_ilist_multi_select_get (Evas_Object *obj);
+EAPI void e_ilist_multi_select_set (Evas_Object *obj, int multi);
+EAPI void e_ilist_min_size_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+EAPI void e_ilist_unselect (Evas_Object *obj);
EAPI void e_ilist_selected_set (Evas_Object *obj, int n);
EAPI int e_ilist_selected_get (Evas_Object *obj);
EAPI const char *e_ilist_selected_label_get (Evas_Object *obj);
EAPI void *e_ilist_selected_data_get (Evas_Object *obj);
EAPI void *e_ilist_selected_data2_get (Evas_Object *obj);
+EAPI Evas_Object *e_ilist_selected_icon_get (Evas_Object *obj);
EAPI void e_ilist_selected_geometry_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
-EAPI void e_ilist_min_size_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
-EAPI void e_ilist_selector_set (Evas_Object *obj, int selector);
-EAPI int e_ilist_selector_get (Evas_Object *obj);
-EAPI void e_ilist_unselect (Evas_Object *obj);
EAPI void e_ilist_remove_num (Evas_Object *obj, int n);
EAPI void e_ilist_remove_label (Evas_Object *obj, const char *label);
-EAPI const char *e_ilist_nth_label_get (Evas_Object *obj, int n);
-EAPI void e_ilist_nth_label_set (Evas_Object *obj, int n, const char *label);
-EAPI void e_ilist_nth_icon_set (Evas_Object *obj, int n, Evas_Object *icon);
-EAPI Evas_Object *e_ilist_nth_icon_get (Evas_Object *obj, int n);
-EAPI Evas_Object *e_ilist_selected_icon_get (Evas_Object *obj);
-EAPI int e_ilist_count (Evas_Object *obj);
-EAPI void e_ilist_clear (Evas_Object *obj);
+EAPI const char *e_ilist_nth_label_get (Evas_Object *obj, int n);
+EAPI void e_ilist_nth_label_set (Evas_Object *obj, int n, const char *label);
+EAPI Evas_Object *e_ilist_nth_icon_get (Evas_Object *obj, int n);
+EAPI void e_ilist_nth_icon_set (Evas_Object *obj, int n, Evas_Object *icon);
EAPI int e_ilist_nth_is_header (Evas_Object *obj, int n);
-EAPI void e_ilist_freeze (Evas_Object *obj);
-EAPI void e_ilist_thaw (Evas_Object *obj);
+EAPI void e_ilist_icon_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+EAPI Evas_List *e_ilist_items_get (Evas_Object *obj);
+EAPI void e_ilist_multi_select (Evas_Object *obj, int n);
+EAPI void e_ilist_range_select (Evas_Object *obj, int n);
#endif
#endif
diff --git a/src/bin/e_int_config_fonts.c b/src/bin/e_int_config_fonts.c
index 0f28900b35..c445e0ab92 100644
--- a/src/bin/e_int_config_fonts.c
+++ b/src/bin/e_int_config_fonts.c
@@ -21,6 +21,8 @@ static void _ilist_font_cb_change(void *data, Evas_Object *obj);
static void _enabled_font_cb_change(void *data, Evas_Object *obj);
static void _enabled_fallback_cb_change(void *data, Evas_Object *obj);
static int _sort_fonts(void *data1, void *data2);
+static void _size_cb_change(void *data, Evas_Object *obj);
+static void _font_cb_change(void *data, Evas_Object *obj);
struct _E_Text_Class_Pair
{
@@ -193,13 +195,10 @@ _fill_data(E_Config_Dialog_Data *cfdata)
tc->font = evas_stringshare_add(efd->font);
else
tc->font = evas_stringshare_add("");
-
tc->size = efd->size;
}
else
- {
- tc->font = evas_stringshare_add("");
- }
+ tc->font = evas_stringshare_add("");
}
}
@@ -209,9 +208,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
/* Fill Hinting */
cfdata->hinting = e_config->font_hinting;
-
- /* Font fallbacks configured in widgets */
-
return;
}
@@ -274,7 +270,6 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
}
e_font_apply();
-
return 1;
}
@@ -294,6 +289,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
/* Create Font Class Widgets */
of = e_widget_framelist_add(evas, _("Font Classes"), 0);
cfdata->gui.class_list = e_widget_ilist_add(evas, 16, 16, NULL);
+ e_widget_ilist_multi_select_set(cfdata->gui.class_list, 1);
e_widget_min_size_set(cfdata->gui.class_list, 100, 250);
e_widget_on_change_hook_set(cfdata->gui.class_list, _ilist_font_cb_change, cfdata);
_fill_ilist(cfdata);
@@ -312,6 +308,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
cfdata->gui.size = e_widget_slider_add(evas, 1, 0, _("%2.1f pixels"), 5.0, 25.0, 0.5, 0, &(cfdata->cur_size), NULL, 25);
e_widget_disabled_set(cfdata->gui.size, 1);
e_widget_min_size_set(cfdata->gui.size, 180, 25);
+ e_widget_on_change_hook_set(cfdata->gui.size, _size_cb_change, cfdata);
e_widget_table_object_append(ott, cfdata->gui.size,
1, 1, 1, 1, 1, 0, 1, 0);
e_widget_table_object_append(ot, ott,
@@ -319,6 +316,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
of = e_widget_framelist_add(evas, _("Fonts"), 0);
cfdata->gui.font_list = e_widget_ilist_add(evas, 16, 16, &(cfdata->cur_font));
+ e_widget_on_change_hook_set(cfdata->gui.font_list, _font_cb_change, cfdata);
evas_event_freeze(evas_object_evas_get(cfdata->gui.font_list));
edje_freeze();
e_widget_ilist_freeze(cfdata->gui.font_list);
@@ -352,7 +350,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
e_widget_table_object_append(ot, of, 1, 1, 2, 4, 1, 1, 1, 1);
e_widget_list_object_append(o, ot, 1, 1, 0.5);
-
return o;
}
@@ -376,9 +373,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
for (next = cfdata->text_classes; next; next = next->next)
{
tc = next->data;
-
if (!tc->class_name) continue;
-
if (tc->enabled && tc->font)
e_font_default_set(tc->class_name, tc->font, tc->size);
else
@@ -404,7 +399,6 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_config->font_hinting = cfdata->hinting;
e_config_save_queue();
e_canvas_rehint();
-
return 1;
}
@@ -425,6 +419,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
/* Create Font Class Widgets */
of = e_widget_frametable_add(evas, _("Font Class Configuration"), 0);
cfdata->gui.class_list = e_widget_ilist_add(evas, 16, 16, NULL);
+ e_widget_ilist_multi_select_set(cfdata->gui.class_list, 1);
e_widget_min_size_set(cfdata->gui.class_list, 100, 100);
e_widget_on_change_hook_set(cfdata->gui.class_list, _ilist_font_cb_change, cfdata);
_fill_ilist(cfdata);
@@ -442,6 +437,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
1, 2, 1, 1, 1, 1, 1, 1);
cfdata->gui.font = e_widget_entry_add(evas, &(cfdata->cur_font));
+ e_widget_on_change_hook_set(cfdata->gui.font, _font_cb_change, cfdata);
e_widget_disabled_set(cfdata->gui.font, 1);
e_widget_min_size_set(cfdata->gui.font, 100, 25);
e_widget_frametable_object_append(of, cfdata->gui.font,
@@ -452,6 +448,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
1, 3, 1, 1, 1, 1, 1, 1);
cfdata->gui.size = e_widget_slider_add(evas, 1, 0, _("%2.1f pixels"), 5.0, 25.0, 0.5, 0, &(cfdata->cur_size), NULL, 25);
+ e_widget_on_change_hook_set(cfdata->gui.size, _size_cb_change, cfdata);
e_widget_disabled_set(cfdata->gui.size, 1);
e_widget_min_size_set(cfdata->gui.size, 180, 25);
e_widget_frametable_object_append(of, cfdata->gui.size,
@@ -508,7 +505,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_change(ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
-
return o;
}
@@ -566,17 +562,16 @@ _ilist_font_cb_change(void *data, Evas_Object *obj)
cfdata = data;
if (!cfdata) return;
- /* Save old data */
if (cfdata->cur_index >= 0)
{
tc = evas_list_nth(cfdata->text_classes, cfdata->cur_index);
tc->enabled = cfdata->cur_enabled;
tc->size = cfdata->cur_size;
+ if (tc->font) evas_stringshare_del(tc->font);
if (cfdata->cur_font)
tc->font = evas_stringshare_add(cfdata->cur_font);
}
- /* Fillout form with new data */
indx = e_widget_ilist_selected_get(cfdata->gui.class_list);
tc = evas_list_nth(cfdata->text_classes, indx);
cfdata->cur_index = indx;
@@ -610,31 +605,94 @@ static void
_enabled_font_cb_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
- Evas_Object *icon;
+ Evas_List *l;
int n;
cfdata = data;
if (!cfdata) return;
+ e_widget_disabled_set(cfdata->gui.font, !cfdata->cur_enabled);
+ e_widget_disabled_set(cfdata->gui.size, !cfdata->cur_enabled);
- n = e_widget_ilist_selected_get(cfdata->gui.class_list);
- if (cfdata->cur_enabled)
+ for (n = 0, l = e_widget_ilist_items_get(cfdata->gui.class_list); l; l = l->next, n++)
{
- e_widget_disabled_set(cfdata->gui.font, 0);
- e_widget_disabled_set(cfdata->gui.size, 0);
- icon = edje_object_add(cfdata->evas);
- e_util_edje_icon_set(icon, ILIST_ICON_WITH_DEFINED_FONT);
+ E_Ilist_Item *i;
+ Evas_Object *icon = NULL;
+ CFText_Class *tc;
+
+ i = l->data;
+ if (!i) continue;
+ if (!i->selected) continue;
+
+ tc = evas_list_nth(cfdata->text_classes, n);
+ tc->enabled = cfdata->cur_enabled;
+ tc->size = cfdata->cur_size;
+ if (tc->font) evas_stringshare_del(tc->font);
+ if (cfdata->cur_font)
+ tc->font = evas_stringshare_add(cfdata->cur_font);
+ if (cfdata->cur_enabled)
+ {
+ icon = edje_object_add(cfdata->evas);
+ e_util_edje_icon_set(icon, ILIST_ICON_WITH_DEFINED_FONT);
+ }
+ e_widget_ilist_nth_icon_set(cfdata->gui.class_list, n, icon);
}
- else
+}
+
+static void
+_size_cb_change(void *data, Evas_Object *obj)
+{
+ E_Config_Dialog_Data *cfdata;
+ Evas_List *l;
+ int n;
+
+ cfdata = data;
+ if (!cfdata) return;
+
+ for (n = 0, l = e_widget_ilist_items_get(cfdata->gui.class_list); l; l = l->next, n++)
+ {
+ E_Ilist_Item *i;
+ Evas_Object *icon = NULL;
+ CFText_Class *tc;
+
+ i = l->data;
+ if (!i) continue;
+ if (!i->selected) continue;
+
+ tc = evas_list_nth(cfdata->text_classes, n);
+ tc->size = cfdata->cur_size;
+ }
+}
+
+static void
+_font_cb_change(void *data, Evas_Object *obj)
+{
+ E_Config_Dialog_Data *cfdata;
+ Evas_List *l;
+ int n;
+
+ cfdata = data;
+ if (!cfdata) return;
+
+ for (n = 0, l = e_widget_ilist_items_get(cfdata->gui.class_list); l; l = l->next, n++)
{
- e_widget_disabled_set(cfdata->gui.font, 1);
- e_widget_disabled_set(cfdata->gui.size, 1);
- icon = NULL;
+ E_Ilist_Item *i;
+ Evas_Object *icon = NULL;
+ CFText_Class *tc;
+
+ i = l->data;
+ if (!i) continue;
+ if (!i->selected) continue;
+
+ tc = evas_list_nth(cfdata->text_classes, n);
+ if (tc->font) evas_stringshare_del(tc->font);
+ if (cfdata->cur_font)
+ tc->font = evas_stringshare_add(cfdata->cur_font);
}
- e_widget_ilist_nth_icon_set(cfdata->gui.class_list, n, icon);
}
/* Private Font Fallback Functions */
-static void _enabled_fallback_cb_change(void *data, Evas_Object *obj)
+static void
+_enabled_fallback_cb_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
diff --git a/src/bin/e_widget_ilist.c b/src/bin/e_widget_ilist.c
index 4821b998e6..75e136b502 100644
--- a/src/bin/e_widget_ilist.c
+++ b/src/bin/e_widget_ilist.c
@@ -59,7 +59,6 @@ e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value)
evas_object_show(o);
evas_object_smart_callback_add(o, "selected", _e_wid_cb_selected, obj);
-
evas_object_resize(obj, 32, 32);
e_widget_min_size_set(obj, 32, 32);
return obj;
@@ -157,9 +156,7 @@ e_widget_ilist_go(Evas_Object *obj)
e_widget_min_size_set(obj, mw + (w - vw), wmh);
}
else if (mw < vw)
- {
- evas_object_resize(wd->o_ilist, vw,mh);
- }
+ evas_object_resize(wd->o_ilist, vw,mh);
}
EAPI void
@@ -286,6 +283,51 @@ e_widget_ilist_thaw(Evas_Object *obj)
e_ilist_thaw(wd->o_ilist);
}
+EAPI void
+e_widget_ilist_multi_select_set(Evas_Object *obj, int multi)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ e_ilist_multi_select_set(wd->o_ilist, multi);
+}
+
+EAPI int
+e_widget_ilist_multi_select_get(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ return e_ilist_multi_select_get(wd->o_ilist);
+}
+
+EAPI Evas_List *
+e_widget_ilist_items_get(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ return e_ilist_items_get(wd->o_ilist);
+}
+
+EAPI void
+e_widget_ilist_multi_select(Evas_Object *obj, int n)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ e_ilist_multi_select(wd->o_ilist, n);
+}
+
+EAPI void
+e_widget_ilist_range_select(Evas_Object *obj, int n)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ e_ilist_range_select(wd->o_ilist, n);
+}
+
static void
_e_wid_del_hook(Evas_Object *obj)
{
diff --git a/src/bin/e_widget_ilist.h b/src/bin/e_widget_ilist.h
index d68efef36e..bc6d1964c8 100644
--- a/src/bin/e_widget_ilist.h
+++ b/src/bin/e_widget_ilist.h
@@ -27,6 +27,11 @@ EAPI void e_widget_ilist_clear(Evas_Object *obj);
EAPI int e_widget_ilist_nth_is_header(Evas_Object *obj, int n);
EAPI void e_widget_ilist_freeze(Evas_Object *obj);
EAPI void e_widget_ilist_thaw(Evas_Object *obj);
-
+EAPI void e_widget_ilist_multi_select_set(Evas_Object *obj, int multi);
+EAPI int e_widget_ilist_multi_select_get(Evas_Object *obj);
+EAPI Evas_List *e_widget_ilist_items_get(Evas_Object *obj);
+EAPI void e_widget_ilist_multi_select(Evas_Object *obj, int n);
+EAPI void e_widget_ilist_range_select(Evas_Object *obj, int n);
+
#endif
#endif