Add a list of "layout" to elm_slideshow. A layout is like a "sub-style". For example the content can take all the slideshow widget (~fullscreen) or not. I do not have finish to work on it.

SVN revision: 50247
This commit is contained in:
Jonathan Atton 2010-07-14 09:07:43 +00:00
parent e87ed1007b
commit b8e248f29c
6 changed files with 129 additions and 6 deletions

View File

@ -8428,6 +8428,7 @@ collections {
group { name: "elm/slideshow/base/default";
data {
item: transitions "fade black_fade horizontal vertical square";
item: layouts "fullscreen not_fullscreen";
}
parts {
part { name: "whole";
@ -8591,6 +8592,14 @@ collections {
rel2.to: "image_1_whole";
color: 255 255 255 255;
}
description {
state: "not_fullscreen" 0.0;
rel1.relative: 0.1 0.1;
rel1.to: "image_1_whole";
rel2.relative: 0.9 0.9;
rel2.to: "image_1_whole";
color: 255 255 255 255;
}
}
part { name: "elm.swallow.2";
type: SWALLOW;
@ -8601,6 +8610,14 @@ collections {
rel1.to: "image_2_whole";
rel2.to: "image_2_whole";
}
description {
state: "not_fullscreen" 0.0;
color: 255 255 255 255;
rel1.relative: 0.1 0.1;
rel1.to: "image_2_whole";
rel2.relative: 0.9 0.9;
rel2.to: "image_2_whole";
}
}
part { name: "events_catcher";
type: RECT;
@ -8613,6 +8630,24 @@ collections {
}
}
programs {
//Substyle
program { name: "layout_fullscreen";
signal: "layout,fullscreen";
source: "slideshow";
action: STATE_SET "default" 0.0;
target: "elm.swallow.1";
target: "elm.swallow.2";
transition: SINUSOIDAL 1.0;
}
program { name: "layout_not_fullscreen";
signal: "layout,not_fullscreen";
source: "slideshow";
action: STATE_SET "not_fullscreen" 0.0;
target: "elm.swallow.1";
target: "elm.swallow.2";
transition: SINUSOIDAL 1.0;
}
//
program { name: "fade_next";
signal: "fade,next";
source: "slideshow";

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -53,6 +53,13 @@ _hv_select(void *data, Evas_Object *obj, void *event_info)
elm_hoversel_label_set(obj, data);
}
static void
_layout_select(void *data, Evas_Object *obj, void *event_info)
{
elm_slideshow_layout_set(slideshow, data);
elm_hoversel_label_set(obj, data);
}
static void
_start(void *data, Evas_Object *obj, void *event_info)
{
@ -80,9 +87,13 @@ _spin(void *data, Evas_Object *obj, void *event_info)
static Evas_Object *
_get(void *data, Evas_Object *obj)
{
Evas_Object *photo = elm_photocam_add(obj);
elm_photocam_file_set(photo, data);
elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
//Evas_Object *photo = elm_photocam_add(obj);
//elm_photocam_file_set(photo, data);
//elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
Evas_Object *photo = elm_photo_add(obj);
elm_photo_file_set(photo, data);
return photo;
}
@ -93,7 +104,7 @@ test_slideshow(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *notify, *bx, *bt, *hv, *spin;
const Eina_List *l;
const char *transition;
const char *transition, *layout;
win = elm_win_add(NULL, "Slideshow", ELM_WIN_BASIC);
elm_win_title_set(win, "Slideshow");
@ -154,6 +165,14 @@ test_slideshow(void *data, Evas_Object *obj, void *event_info)
elm_hoversel_label_set(hv, eina_list_data_get(elm_slideshow_transitions_get(slideshow)));
evas_object_show(hv);
hv = elm_hoversel_add(win);
elm_box_pack_end(bx, hv);
elm_hoversel_hover_parent_set(hv, win);
EINA_LIST_FOREACH(elm_slideshow_layouts_get(slideshow), l, layout)
elm_hoversel_item_add(hv, layout, NULL, 0, _layout_select, layout);
elm_hoversel_label_set(hv, elm_slideshow_layout_get(slideshow));
evas_object_show(hv);
spin = elm_spinner_add(win);
elm_spinner_label_format_set(spin, "%2.0f secs.");
evas_object_smart_callback_add(spin, "changed", _spin, spin);
@ -182,7 +201,7 @@ test_slideshow(void *data, Evas_Object *obj, void *event_info)
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_UP, _notify_show, notify);
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_MOVE, _notify_show, notify);
evas_object_resize(win, 350, 200);
evas_object_resize(win, 500, 400);
evas_object_show(win);
}

View File

@ -1232,6 +1232,9 @@ extern "C" {
EAPI void * elm_slideshow_item_data_get(Elm_Slideshow_Item *item);
EAPI Elm_Slideshow_Item* elm_slideshow_item_current_get(const Evas_Object *obj);
EAPI Evas_Object* elm_slideshow_item_object_get(Elm_Slideshow_Item* item);
EAPI const char * elm_slideshow_layout_get(const Evas_Object *obj);
EAPI void elm_slideshow_layout_set(Evas_Object *obj, const char *layout);
EAPI const Eina_List *elm_slideshow_layouts_get(const Evas_Object *obj);
EAPI Evas_Object *elm_fileselector_add(Evas_Object *parent);

View File

@ -49,6 +49,11 @@ struct _Widget_Data
Ecore_Timer *timer;
int timeout;
Eina_Bool loop:1;
struct {
const char *current;
Eina_List *list; //list of const char *
} layout;
};
static const char *widtype = NULL;
@ -66,6 +71,7 @@ _del_hook(Evas_Object *obj)
elm_slideshow_clear(obj);
_elm_stringlist_free(wd->transitions);
if (wd->timer) ecore_timer_del(wd->timer);
_elm_stringlist_free(wd->layout.list);
free(wd);
}
@ -241,6 +247,10 @@ elm_slideshow_add(Evas_Object *parent)
if (eina_list_count(wd->transitions) > 0)
wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions));
wd->layout.list = _elm_stringlist_get(edje_object_data_get(wd->slideshow, "layouts"));
if (eina_list_count(wd->layout.list) > 0)
wd->layout.current = eina_stringshare_add(eina_list_data_get(wd->layout.list));
edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
@ -399,7 +409,7 @@ elm_slideshow_previous(Evas_Object *obj)
* Returns the list of transitions available.
*
* @param obj The slideshow object
* @return Returns the list of transitions (list of char*)
* @return Returns the list of transitions (list of const char*)
*
* @ingroup Slideshow
*/
@ -412,6 +422,23 @@ elm_slideshow_transitions_get(const Evas_Object *obj)
return wd->transitions;
}
/**
* Returns the list of layouts available.
*
* @param obj The slideshow object
* @return Returns the list of layout (list of const char*)
*
* @ingroup Slideshow
*/
const Eina_List *
elm_slideshow_layouts_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return wd->layout.list;
}
/**
* Set the transition to use
*
@ -502,6 +529,44 @@ elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop)
wd->loop = loop;
}
/**
* Returns the current layout name
*
* @param obj The slideshow object
* @returns Returns the layout name
*
* @ingroup Slideshow
*/
EAPI const char *
elm_slideshow_layout_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
return wd->layout.current;
}
/**
* Set the layout
*
* @param obj The slideshow object
* @param layout the new layout
*
* @ingroup Slideshow
*/
EAPI void
elm_slideshow_layout_set(Evas_Object *obj, const char *layout)
{
char buf[PATH_MAX];
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->layout.current = eina_stringshare_add(layout);
snprintf(buf, sizeof(buf), "layout,%s", wd->layout.current);
edje_object_signal_emit(wd->slideshow, buf, "slideshow");
}
/**
* Return if the first item should follow the last and vice versa
*
@ -649,3 +714,4 @@ elm_slideshow_item_data_get(Elm_Slideshow_Item * item)
return (void *)item->data;
}