elm_config gains a new feature: multitheme selection! themes are added in the order of selection, so to use an overlay for a theme you would select the "base" theme first, then the "overlay" part. then just click use theme and zooooooooooooooooooon

SVN revision: 61426
This commit is contained in:
Mike Blumenkrantz 2011-07-16 14:45:41 +00:00
parent 0cdc520e33
commit f63260d300
1 changed files with 28 additions and 39 deletions

View File

@ -17,7 +17,7 @@ struct _Theme
Eina_Bool in_search_path; Eina_Bool in_search_path;
}; };
static Theme *tsel = NULL; static const Eina_List *tsel = NULL;
static Eina_List *themes = NULL; static Eina_List *themes = NULL;
struct _Elm_Text_Class_Data struct _Elm_Text_Class_Data
@ -1063,28 +1063,13 @@ _theme_use(void *data __UNUSED__,
void *event_info __UNUSED__) void *event_info __UNUSED__)
{ {
const char *defth; const char *defth;
char *newth; Elm_Theme *th;
Theme *t = tsel; Evas_Object *win = elm_object_top_widget_get(obj);
Evas_Object *sample = evas_object_data_get(win, "theme_preview");
if (!t) return; th = elm_object_theme_get(sample);
defth = elm_theme_get(NULL); defth = elm_theme_get(th);
newth = malloc(strlen(defth) + 1 + strlen(t->name) + 1); elm_theme_all_set(defth);
if (newth)
{
char *rest;
newth[0] = 0;
rest = strchr(defth, ':');
if (!rest)
strcpy(newth, t->name);
else
{
strcpy(newth, t->name);
strcat(newth, rest);
}
elm_theme_all_set(newth);
free(newth);
}
} }
static void static void
@ -1095,30 +1080,33 @@ _theme_sel(void *data,
Theme *t = data; Theme *t = data;
Evas_Object *win = elm_object_top_widget_get(obj); Evas_Object *win = elm_object_top_widget_get(obj);
Evas_Object *sample = evas_object_data_get(win, "theme_preview"); Evas_Object *sample = evas_object_data_get(win, "theme_preview");
Elm_Theme *th; Elm_Theme *th, *sth;
const char *defth; const char *defth, *rest;
char *newth; Eina_Strbuf *newth;
tsel = t; tsel = elm_list_selected_items_get(obj);
defth = elm_theme_get(NULL); sth = elm_object_theme_get(sample);
newth = malloc(strlen(defth) + 1 + strlen(t->name) + 1); defth = elm_theme_get(sth);
newth = eina_strbuf_new();
EINA_SAFETY_ON_NULL_RETURN(newth);
th = elm_theme_new(); th = elm_theme_new();
if (newth) if (!th)
{ {
char *rest; eina_strbuf_free(newth);
return;
newth[0] = 0; }
rest = strchr(defth, ':'); if (eina_list_count(tsel) > 1)
if (!rest) eina_strbuf_append_printf(newth, "%s:%s", t->name, defth);
strcpy(newth, t->name);
else else
{ {
strcpy(newth, t->name); rest = strchr(defth, ':');
strcat(newth, rest); if (!rest)
} eina_strbuf_append(newth, t->name);
elm_theme_set(th, newth); else
free(newth); eina_strbuf_append_printf(newth, "%s%s", t->name, rest);
} }
elm_theme_set(th, eina_strbuf_string_get(newth));
eina_strbuf_free(newth);
elm_object_theme_set(sample, th); elm_object_theme_set(sample, th);
elm_theme_free(th); elm_theme_free(th);
} }
@ -1303,6 +1291,7 @@ _status_config_themes(Evas_Object *win,
evas_object_show(pd); evas_object_show(pd);
li = elm_list_add(win); li = elm_list_add(win);
elm_list_multi_select_set(li, EINA_TRUE);
evas_object_size_hint_weight_set(li, 1.0, 1.0); evas_object_size_hint_weight_set(li, 1.0, 1.0);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_frame_content_set(pd, li); elm_frame_content_set(pd, li);