E-MODULES-EXTRA/elfe: Add scroll to background when scrolling desktop and small changes to default theme
SVN revision: 63451
This commit is contained in:
parent
8020dd62f4
commit
791c8cb3de
|
@ -105,14 +105,11 @@ collections
|
|||
parts {
|
||||
/* background */
|
||||
part {
|
||||
type: IMAGE;
|
||||
name: "elfe.swallow.background";
|
||||
type: SWALLOW;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
image {
|
||||
normal: "bg.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
|
@ -827,8 +824,10 @@ collections
|
|||
|
||||
group {
|
||||
name: "elfe/dock/layout";
|
||||
images {
|
||||
image: "engage_im0.png" COMP;
|
||||
}
|
||||
parts {
|
||||
|
||||
part {
|
||||
name: "menu.background.bottom";
|
||||
mouse_events: 1;
|
||||
|
@ -837,6 +836,7 @@ collections
|
|||
state: "default" 0.0;
|
||||
image.normal: "mainmenu_bg_bottom.png";
|
||||
image.border: 0 0 2 0;
|
||||
color: 255 255 255 200;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 711 B |
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
x-ui.sh --profile=illume-home --screen=320x480
|
||||
x-ui.sh --profile=illume --screen=480x800
|
|
@ -62,6 +62,17 @@ _scroller_scroll_anim_stop_cb(void *data , Evas_Object *obj __UNUSED__, void *ev
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_scroller_scroll_cb(void *data , Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Elfe_Desktop *desk = data;
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
|
||||
elm_scroller_region_get(desk->sc, &x, &y, &w, &h);
|
||||
evas_object_smart_callback_call(desk->layout, "scroll", &x);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_longpress_timer_cb(void *data)
|
||||
{
|
||||
|
@ -470,6 +481,7 @@ elfe_desktop_add(Evas_Object *parent, E_Zone *zone)
|
|||
/* evas_object_size_hint_max_set(desk->dock, 9999, 80); */
|
||||
|
||||
evas_object_smart_callback_add(desk->sc, "scroll,anim,stop", _scroller_scroll_anim_stop_cb, desk);
|
||||
evas_object_smart_callback_add(desk->sc, "scroll", _scroller_scroll_cb, desk);
|
||||
|
||||
evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_MOVE, _scroller_mouse_move_cb, desk);
|
||||
evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_UP, _scroller_mouse_up_cb, desk);
|
||||
|
|
110
src/main.c
110
src/main.c
|
@ -104,6 +104,31 @@ elfe_home_win_cfg_update(void)
|
|||
|
||||
}
|
||||
|
||||
static void
|
||||
_scroll_anim_cb(void *data , Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Elfe_Home_Win *hwin = data;
|
||||
|
||||
int *x = (int*)event_info;
|
||||
Evas_Coord w;
|
||||
double pos;
|
||||
|
||||
evas_object_geometry_get(hwin->o_bg, NULL, NULL, &w, NULL);
|
||||
pos = (double)((double)(*x) * (double)((double)(w - hwin->zone->w) /
|
||||
(double)(hwin->zone->w * 4)));
|
||||
elm_scroller_region_show(hwin->bg_scroller, pos, 0, hwin->zone->w, hwin->zone->h);
|
||||
}
|
||||
static void
|
||||
_cb_bg_resize(void *data , Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
{
|
||||
/* Elfe_Home_Win *hwin = data; */
|
||||
/* Evas_Coord x, y, w, h; */
|
||||
|
||||
/* edje_object_parts_extends_calc(hwin->o_bg, &x, &y, &w, &h); */
|
||||
/* evas_object_size_hint_min_set(hwin->o_bg, w, h); */
|
||||
/* evas_object_size_hint_min_set(obj, w, h); */
|
||||
}
|
||||
|
||||
static void
|
||||
_elfe_home_win_new(E_Zone *zone)
|
||||
{
|
||||
|
@ -112,9 +137,9 @@ _elfe_home_win_new(E_Zone *zone)
|
|||
E_Desk *desk;
|
||||
char buf[PATH_MAX];
|
||||
const char *bgfile;
|
||||
|
||||
Evas_Object *o_edje;
|
||||
const char *file;
|
||||
Evas_Object *rect;
|
||||
Evas_Coord w, h;
|
||||
|
||||
hwin = E_OBJECT_ALLOC(Elfe_Home_Win, ELFE_HOME_WIN_TYPE, _elfe_home_win_cb_free);
|
||||
if (!hwin) return;
|
||||
|
@ -137,6 +162,36 @@ _elfe_home_win_new(E_Zone *zone)
|
|||
elfe_home_cfg->mod_dir);
|
||||
|
||||
evas = e_win_evas_get(hwin->win);
|
||||
rect = evas_object_rectangle_add(evas);
|
||||
evas_object_color_set(rect, 0, 0, 0, 255);
|
||||
evas_object_move(rect, 0, 0);
|
||||
evas_object_resize(rect, zone->w, zone->h);
|
||||
evas_object_show(rect);
|
||||
|
||||
|
||||
/* Specific ELM initialisation */
|
||||
elm_init(0, NULL);
|
||||
elm_need_efreet();
|
||||
|
||||
hwin->layout = elm_layout_add(rect);
|
||||
/* Try default theme first */
|
||||
file = e_theme_edje_file_get("base/theme/modules/elfe", "module/elfe/main");
|
||||
if (file && file[0])
|
||||
elm_layout_file_set(hwin->layout, file, "module/elfe/main");
|
||||
else /* specific module theme otherwise */
|
||||
{
|
||||
if (!elm_layout_file_set(hwin->layout, buf, "module/elfe/main"))
|
||||
{
|
||||
printf("Error loading group %s in %s theme file\n", "module/elfe/main", buf);
|
||||
}
|
||||
}
|
||||
|
||||
elfe_theme = elm_theme_new();
|
||||
/* Use specific module theme as elm theme overlay */
|
||||
elm_theme_overlay_add(elfe_theme, buf);
|
||||
elm_object_theme_set(hwin->layout, elfe_theme);
|
||||
|
||||
hwin->bg_scroller = elm_scroller_add(hwin->layout);
|
||||
|
||||
desk = e_desk_current_get(zone);
|
||||
if (desk)
|
||||
|
@ -146,40 +201,18 @@ _elfe_home_win_new(E_Zone *zone)
|
|||
|
||||
hwin->o_bg = edje_object_add(evas);
|
||||
edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
|
||||
evas_object_move(hwin->o_bg, 0, 0);
|
||||
evas_object_show(hwin->o_bg);
|
||||
evas_object_event_callback_add(hwin->o_bg, EVAS_CALLBACK_RESIZE,
|
||||
_cb_bg_resize, hwin);
|
||||
|
||||
printf("Create layout\n");
|
||||
|
||||
|
||||
/* Specific ELM initialisation */
|
||||
elm_init(0, NULL);
|
||||
elm_need_efreet();
|
||||
|
||||
|
||||
hwin->layout = elm_layout_add(hwin->o_bg);
|
||||
/* Try default theme first */
|
||||
file = e_theme_edje_file_get("base/theme/modules/elfe", "module/elfe/main");
|
||||
printf("file : %s\n", file);
|
||||
if (file && file[0])
|
||||
elm_layout_file_set(hwin->layout, file, "module/elfe/main");
|
||||
else /* specific module theme otherwise */
|
||||
{
|
||||
printf("specific file : %s\n", buf);
|
||||
if (!elm_layout_file_set(hwin->layout, buf, "module/elfe/main"))
|
||||
{
|
||||
printf("Error loading group %s in %s theme file\n", "module/elfe/main", buf);
|
||||
}
|
||||
}
|
||||
o_edje = elm_layout_edje_get(hwin->layout);
|
||||
|
||||
elfe_theme = elm_theme_new();
|
||||
/* Use specific module theme as elm theme overlay */
|
||||
elm_theme_overlay_add(elfe_theme, buf);
|
||||
elm_object_theme_set(hwin->layout, elfe_theme);
|
||||
elm_scroller_content_set(hwin->bg_scroller, hwin->o_bg);
|
||||
evas_object_show(hwin->bg_scroller);
|
||||
elm_layout_content_set(hwin->layout, "elfe.swallow.background", hwin->bg_scroller);
|
||||
|
||||
hwin->desktop = elfe_desktop_add(hwin->layout, hwin->zone);
|
||||
elm_layout_content_set(hwin->layout, "elfe.swallow.desktop", hwin->desktop);
|
||||
evas_object_smart_callback_add(hwin->desktop, "scroll", _scroll_anim_cb, hwin);
|
||||
|
||||
|
||||
evas_object_move(hwin->layout, 0, 0);
|
||||
evas_object_show(hwin->layout);
|
||||
|
@ -198,6 +231,7 @@ _elfe_home_win_new(E_Zone *zone)
|
|||
static void
|
||||
_elfe_home_win_cb_free(Elfe_Home_Win *hwin)
|
||||
{
|
||||
printf("CB FREE\n");
|
||||
if (hwin->win->evas_win) e_drop_xdnd_register_set(hwin->win->evas_win, 0);
|
||||
if (hwin->o_bg) evas_object_del(hwin->o_bg);
|
||||
if (hwin->layout) evas_object_del(hwin->layout);
|
||||
|
@ -209,9 +243,14 @@ static void
|
|||
_elfe_home_win_cb_resize(E_Win *win)
|
||||
{
|
||||
Elfe_Home_Win *hwin;
|
||||
|
||||
Evas_Coord w, h;
|
||||
if (!(hwin = win->data)) return;
|
||||
if (hwin->o_bg) evas_object_resize(hwin->o_bg, win->w, win->h);
|
||||
if (hwin->o_bg)
|
||||
{
|
||||
evas_object_size_hint_min_set(hwin->o_bg, win->w, win->h);
|
||||
edje_object_parts_extends_calc(hwin->o_bg, NULL, NULL, &w, &h);
|
||||
evas_object_size_hint_min_set(hwin->o_bg, w, h);
|
||||
}
|
||||
if (hwin->layout) evas_object_resize(hwin->layout, win->w, win->h);
|
||||
}
|
||||
|
||||
|
@ -228,6 +267,7 @@ _elfe_home_cb_bg_change(void *data __UNUSED__, int type, void *event __UNUSED__)
|
|||
E_Zone *zone;
|
||||
E_Desk *desk;
|
||||
const char *bgfile;
|
||||
Evas_Coord w, h;
|
||||
|
||||
zone = hwin->zone;
|
||||
desk = e_desk_current_get(zone);
|
||||
|
@ -235,7 +275,9 @@ _elfe_home_cb_bg_change(void *data __UNUSED__, int type, void *event __UNUSED__)
|
|||
bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
|
||||
else
|
||||
bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
|
||||
edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
|
||||
edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
|
||||
edje_object_parts_extends_calc(hwin->o_bg, NULL, NULL, &w, &h);
|
||||
evas_object_size_hint_min_set(hwin->o_bg, w, h);
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
|
|
@ -13,6 +13,7 @@ struct _Elfe_Home_Win
|
|||
|
||||
E_Win *win;
|
||||
Evas_Object *o_bg;
|
||||
Evas_Object *bg_scroller;
|
||||
Evas_Object *layout;
|
||||
Evas_Object *desktop;
|
||||
|
||||
|
|
Loading…
Reference in New Issue