elementary new widget: notify. See elementary_test

SVN revision: 42643
This commit is contained in:
Jonathan Atton 2009-09-23 11:15:55 +00:00
parent 08dffc73e4
commit 07967b25e2
7 changed files with 1358 additions and 11 deletions

View File

@ -5183,7 +5183,7 @@ collections {
rel1.offset: 4 4;
rel2.offset: -5 -5;
}
}
}
part { name: "over";
mouse_events: 0;
description { state: "default" 0.0;
@ -5617,6 +5617,767 @@ collections {
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/notify/base/default";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 -1.0;
rel2.relative: 1.0 0.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/bottom";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 2.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/left";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: -1.0 0.0;
rel2.relative: 0.0 1.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/right";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 1.0 0.0;
rel2.relative: 2.0 1.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/top_left";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 -1.0;
rel2.relative: 1.0 0.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/top_right";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 -1.0;
rel2.relative: 1.0 0.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/bottom_left";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 2.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
group { name: "elm/notify/base/bottom_right";
//this group is a design similar to the inwin group
images {
image: "shad_circ.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "base";
type: RECT;
mouse_events: 0;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
description { state: "visible" 0.0;
inherit: "default" 1.0;
color: 0 0 0 64;
}
}
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "shad_circ.png";
rel1.to: "elm.swallow.content";
rel1.offset: -64 -64;
rel2.to: "elm.swallow.content";
rel2.offset: 63 63;
fill.smooth: 0;
}
}
part { name: "pop";
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "elm.swallow.content";
rel1.offset: -5 -5;
rel2.to: "elm.swallow.content";
rel2.offset: 4 4;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
image.middle: SOLID;
}
}
part { name: "popover";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "pop";
rel2.to: "pop";
rel2.relative: 1.0 0.5;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
description { state: "hide" 0.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 2.0;}
}
}
programs {
program { name: "show";
signal: "elm,action,show";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "base";
}
program { name: "show_2";
signal: "show";
action: STATE_SET "hide" 0.0;
target: "elm.swallow.content";
after: "show_3";
}
program { name: "show_3";
signal: "show";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
transition: LINEAR 0.5;
}
program { name: "hide";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
}
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/win/inwin/default";
images {
@ -11482,7 +12243,6 @@ collections {
}
}
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/radio/base/default";
images {

View File

@ -60,7 +60,8 @@ test_spinner.c \
test_index.c \
test_photocam.c \
test_photo.c \
test_icon_desktops.c
test_icon_desktops.c \
test_notify.c
elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la
elementary_test_LDFLAGS =
@ -68,11 +69,11 @@ elementary_test_LDFLAGS =
if BUILD_QUICKLAUNCH
elementary_quicklaunch_SOURCES = quicklaunch.c
elementary_quicklaunch_LDADD = $(top_builddir)/src/lib/libelementary.la
elementary_quicklaunch_LDFLAGS =
elementary_quicklaunch_LDFLAGS =
if BUILD_RUN
elementary_run_SOURCES = run.c
elementary_run_LDADD =
elementary_run_LDADD =
elementary_run_LDFLAGS =
endif
@ -85,7 +86,7 @@ elementary_testqldir = $(libdir)
elementary_testql_LTLIBRARIES = elementary_testql.la
elementary_testql_la_SOURCES = $(elementary_test_SOURCES)
elementary_testql_la_LIBADD = $(top_builddir)/src/lib/libelementary.la
elementary_testql_la_CFLAGS =
elementary_testql_la_CFLAGS =
elementary_testql_la_LDFLAGS = -module -avoid-version -no-undefined
elementary_testql_SOURCES = $(elementary_test_SOURCES)
elementary_testql_LDADD = $(top_builddir)/src/lib/libelementary.la

View File

@ -49,6 +49,7 @@ void test_index(void *data, Evas_Object *obj, void *event_info);
void test_photocam(void *data, Evas_Object *obj, void *event_info);
void test_photo(void *data, Evas_Object *obj, void *event_info);
void test_icon_desktops(void *data, Evas_Object *obj, void *event_info);
void test_notify(void *data, Evas_Object *obj, void *event_info);
static void
my_win_del(void *data, Evas_Object *obj, void *event_info)
@ -139,7 +140,7 @@ my_win_main(void)
elm_list_item_append(li, "Box Vert", NULL, NULL, test_box_vert, NULL);
elm_list_item_append(li, "Box Horiz", NULL, NULL, test_box_horiz, NULL);
elm_list_item_append(li, "Buttons", NULL, NULL, test_button, NULL);
elm_list_item_append(li, "Toggles", NULL, NULL, test_toggle, NULL);
elm_list_item_append(li, "Toggles", NULL, NULL, test_toggle, NULL);
elm_list_item_append(li, "Table", NULL, NULL, test_table, NULL);
elm_list_item_append(li, "Clock", NULL, NULL, test_clock, NULL);
elm_list_item_append(li, "Layout", NULL, NULL, test_layout, NULL);
@ -180,6 +181,7 @@ my_win_main(void)
elm_list_item_append(li, "Photocam", NULL, NULL, test_photocam, NULL);
elm_list_item_append(li, "Photo", NULL, NULL, test_photo, NULL);
elm_list_item_append(li, "Icon Desktops", NULL, NULL, test_icon_desktops, NULL);
elm_list_item_append(li, "Notify", NULL, NULL, test_notify, NULL);
elm_list_go(li);

View File

@ -0,0 +1,269 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
static void
_bt(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *notify = data;
evas_object_show(notify);
}
static void
_bt_close(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *notify = data;
evas_object_hide(notify);
}
void
test_notify(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *bx, *bx2, *notify, *bt, *lb;
char buf[PATH_MAX];
win = elm_win_add(NULL, "Notify", ELM_WIN_BASIC);
elm_win_title_set(win, "Notify");
elm_win_autodel_set(win, 1);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
evas_object_show(bg);
bx2 = elm_box_add(win);
evas_object_size_hint_weight_set(bx2, 1.0, 1.0);
elm_win_resize_object_add(win, bx2);
evas_object_show(bx2);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "This position is the default.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Top");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
elm_notify_timeout_set(notify, 5);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Bottom position. This notify use a timeout of 5 sec.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Bottom");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT);
elm_notify_timeout_set(notify, 10);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Left position. This notify use a timeout of 10 sec.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_RIGHT);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Right position.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_LEFT);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Top Left position.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Top Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_RIGHT);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Top Right position.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Top Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_LEFT);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Bottom Left position.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Bottom Left");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
notify = elm_notify_add(win);
elm_win_resize_object_add(win, notify);
evas_object_size_hint_weight_set(notify, 1.0, 1.0);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT);
bx = elm_box_add(win);
elm_notify_content_set(notify, bx);
elm_box_horizontal_set(bx, 1);
evas_object_show(bx);
lb = elm_label_add(win);
elm_label_label_set(lb, "Bottom Right position.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);
bt = elm_button_add(win);
elm_button_label_set(bt, "Close");
evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Bottom Right");
evas_object_smart_callback_add(bt, "clicked", _bt, notify);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
evas_object_show(win);
}
#endif

View File

@ -168,7 +168,7 @@ extern "C" {
EAPI void elm_quicklaunch_cleanup(void);
EAPI int elm_quicklaunch_fallback(int argc, char **argv);
EAPI char *elm_quicklaunch_exe_path_get(const char *exe);
EAPI void elm_need_efreet(void);
EAPI void elm_need_e_dbus(void);
@ -185,7 +185,7 @@ extern "C" {
EAPI void elm_finger_size_set(Evas_Coord size);
EAPI void elm_object_focus(Evas_Object *obj);
EAPI void elm_object_scroll_hold_push(Evas_Object *obj);
EAPI void elm_object_scroll_hold_pop(Evas_Object *obj);
EAPI void elm_object_scroll_freeze_push(Evas_Object *obj);
@ -409,6 +409,25 @@ extern "C" {
/* smart callbacks called:
*/
typedef enum _Elm_Notify_Orient
{
ELM_NOTIFY_ORIENT_TOP,
ELM_NOTIFY_ORIENT_BOTTOM,
ELM_NOTIFY_ORIENT_LEFT,
ELM_NOTIFY_ORIENT_RIGHT,
ELM_NOTIFY_ORIENT_TOP_LEFT,
ELM_NOTIFY_ORIENT_TOP_RIGHT,
ELM_NOTIFY_ORIENT_BOTTOM_LEFT,
ELM_NOTIFY_ORIENT_BOTTOM_RIGHT
} Elm_Notify_Orient;
EAPI Evas_Object *elm_notify_add(Evas_Object *parent);
EAPI void elm_notify_content_set(Evas_Object *obj, Evas_Object *content);
EAPI void elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient);
EAPI void elm_notify_timeout_set(Evas_Object *obj, int timeout);
/* smart callbacks called:
*/
typedef enum _Elm_Hover_Axis
{
ELM_HOVER_AXIS_NONE,
@ -815,7 +834,7 @@ extern "C" {
* "changed" - when the spinner value changes
* "delay,changed" - when the spinner value changed, but a small time after a change (use this if you only want to respond to a change once the spinner is held still for a short while).
*/
EAPI Evas_Object *elm_index_add(Evas_Object *parent);
EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active);
EAPI void elm_index_item_level_set(Evas_Object *obj, int level);
@ -846,7 +865,7 @@ extern "C" {
EAPI int elm_photocam_zoom_get(Evas_Object *obj);
EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode);
EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(Evas_Object *obj);
#ifdef __cplusplus
}
#endif

View File

@ -60,6 +60,7 @@ elm_separator.c \
elm_spinner.c \
elm_index.c \
elm_photocam.c \
elm_notify.c \
\
elc_notepad.c \
elc_anchorview.c \

View File

@ -0,0 +1,295 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <Elementary.h>
#include "elm_priv.h"
/**
* @defgroup Notify notify
*
* Display a window in a particular region of the application (top, bottom ...).
* A timeout can be set to automatically close the window.
*
*/
typedef struct _Widget_Data Widget_Data;
typedef struct _Subinfo Subinfo;
struct _Widget_Data
{
Evas_Object *notify;
Evas_Object *content;
Elm_Notify_Orient orient;
int timeout;
Ecore_Timer *timer;
};
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
free(wd);
}
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if(!wd) return;
_elm_theme_set(wd->notify, "notify", "base", "default");
edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
}
static void
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1;
edje_object_size_min_calc(wd->notify, &minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
}
static void
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
edje_object_part_swallow(wd->notify, "elm.swallow.content", obj);
_sizing_eval(data);
}
static void
_sub_del(void *data, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
Eina_List *l;
evas_object_event_callback_del
(wd->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints);
if(wd->timer)
ecore_timer_del(wd->timer);
}
static void
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
Evas_Coord x,y,w,h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
edje_object_size_min_calc(wd->notify, &minw, &minh);
if(wd->content)
{
int offx = (w - minw)/2;
int offy = (h - minh)/2;
switch(wd->orient)
{
case ELM_NOTIFY_ORIENT_TOP:
evas_object_move(wd->notify, x + offx, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM:
evas_object_move(wd->notify, x + offx, h - minh);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_LEFT:
evas_object_move(wd->notify, 0, y+offy);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_RIGHT:
evas_object_move(wd->notify, w - minw, y+offy);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_TOP_LEFT:
evas_object_move(wd->notify, 0, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
evas_object_move(wd->notify, w-minw, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
evas_object_move(wd->notify, 0, h - minh);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
evas_object_move(wd->notify, w-minw, h-minh);
evas_object_resize(wd->notify, minw, minh);
break;
}
}
}
static int
_timer_cb(void *data)
{
Evas_Object *obj = data;
Widget_Data *wd = elm_widget_data_get(obj);
wd->timer = NULL;
evas_object_hide(obj);
return 0;
}
static void
_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
evas_object_show(wd->notify);
if(wd->timer)
{
ecore_timer_del(wd->timer);
wd->timer = NULL;
}
if(wd->timeout>0)
wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
}
static void
_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
evas_object_hide(wd->notify);
if(wd->timer)
{
ecore_timer_del(wd->timer);
wd->timer = NULL;
}
}
/**
* Add a new notify to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Notify
*/
EAPI Evas_Object *
elm_notify_add(Evas_Object *parent)
{
Evas_Object *obj;
Evas *e;
Widget_Data *wd;
wd = ELM_NEW(Widget_Data);
e = evas_object_evas_get(parent);
obj = elm_widget_add(e);
elm_widget_type_set(obj, "notify");
elm_widget_sub_object_add(parent, obj);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
wd->notify = edje_object_add(e);
elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
_sizing_eval(obj);
return obj;
}
/**
* Set the notify content
*
* @param obj The notify object
* @param content The content will be filled in this notify object
*
* @ingroup Notify
*/
EAPI void
elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
{
Widget_Data *wd = elm_widget_data_get(obj);
Subinfo *si;
if(wd->content)
elm_widget_sub_object_del(obj, wd->content);
if (content)
{
elm_widget_sub_object_add(obj, content);
edje_object_part_swallow(wd->notify, "elm.swallow.content", content);
evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
wd->content = content;
_sizing_eval(obj);
}
}
/**
* Set the orientation
*
* @param obj The notify object
* @param orient The new orientation
*/
EAPI void
elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient)
{
Widget_Data *wd = elm_widget_data_get(obj);
wd->orient = orient;
switch(orient)
{
case ELM_NOTIFY_ORIENT_TOP:
_elm_theme_set(wd->notify, "notify", "base", "default");
break;
case ELM_NOTIFY_ORIENT_BOTTOM:
_elm_theme_set(wd->notify, "notify", "base", "bottom");
break;
case ELM_NOTIFY_ORIENT_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "left");
break;
case ELM_NOTIFY_ORIENT_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "right");
break;
case ELM_NOTIFY_ORIENT_TOP_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "top_left");
break;
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "top_right");
break;
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "bottom_left");
break;
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "bottom_right");
break;
}
_resize(obj, NULL, obj, NULL);
}
/**
* Set the time before the notify window is hidden. <br>
* Set a value < 0 to disable the timer
*
* @param obj The notify object
* @param time the new timeout
*/
EAPI void
elm_notify_timeout_set(Evas_Object *obj, int timeout)
{
Widget_Data *wd = elm_widget_data_get(obj);
wd->timeout = timeout;
}