layout/gui: dark theme support.

if the theme name starts with "dark", elm-theme-viewer will load dark colored layout.
This commit is contained in:
Daniel Juyung Seo 2013-08-11 14:55:52 +09:00
parent f79daf091d
commit 183f9668ff
2 changed files with 104 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#define POPUP_HEIGHT 100
collections {
// layout for default theme
group { name: "etv/main/layout";
parts {
part { name: "base";
@ -93,6 +94,100 @@ collections {
}
}
}
// layout for dark theme
group { name: "etv/main/layout_dark";
parts {
part { name: "base";
type: RECT;
description { state: "default" 0.0;
color: 64 64 64 255;
}
}
part { name: "preview";
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
min: PREVIEW_WIDTH 0;
rel1.to: "base";
rel2 {
to_x: "base";
to_y: "menu_bottom_line";
relative: 1.0 0.0;
}
align: 0.0 0.5;
}
}
part { name: "menu_bottom_line";
type: RECT;
scale: 1;
description { state: "default" 0.0;
min: 0 1;
fixed: 0 1;
color: 73 73 73 255;
rel1.to: "edje_name_txt";
rel2 {
to: "edje_name_txt";
relative: 1.0 0.0;
}
align: 0.5 1.0;
}
}
part { name: "edje_name_txt";
type: TEXT;
scale: 1;
description { state: "default" 0.0;
fixed: 0 1;
rel1 {
to: "base";
relative: 0.0 1.0;
}
rel2.to: "base";
rel2.offset: -10 -1;
align: 0.0 1.0;
color: 255 255 255 255;
text {
size: EDJE_NAME_TXT_SIZE;
min: 0 1;
align: 1.0 0.5;
}
}
}
part { name: "popup";
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
min: POPUP_WIDTH POPUP_HEIGHT;
max: POPUP_WIDTH POPUP_HEIGHT;
align: 0.5 0.0;
visible: 0;
rel1.relative: 0.0 1.0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
align: 0.5 0.5;
rel1.relative: 0.0 0.0;
}
}
program { name: "popup,show";
signal: "popup,show";
source: "elm";
action: STATE_SET "visible" 0.0;
transition: SPRING 1.2 2.0 6;
target: "popup";
}
program { name: "popup,hide";
signal: "popup,hide";
source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "popup";
}
}
}
group { name: "etv/preview/layout";
parts {
part { name: "elm.swallow.icon";

View File

@ -591,6 +591,7 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
Evas_Object *panes = NULL, *widget_box = NULL;
Evas_Object *desc_fr = NULL;
char path[PATH_MAX];
const char *theme = NULL;
if (!edje_file) return;
@ -627,7 +628,14 @@ gui_create(const char *edje_file, Evas_Coord width, Evas_Coord height,
gui_layout = o = elm_layout_add(win);
snprintf(path, sizeof(path), "%s/themes/layout.edj", elm_app_data_dir_get());
elm_layout_file_set(o, path, "etv/main/layout");
// dark theme support
theme = elm_theme_get(NULL);
if (theme && !strncmp(theme, "dark", 4))
elm_layout_file_set(o, path, "etv/main/layout_dark");
else
elm_layout_file_set(o, path, "etv/main/layout");
EXPAND(o); FILL(o);
elm_box_pack_end(box, o);
evas_object_show(o);