From: Rajeev Ranjan <rajeev.r@samsung.com>

Subject: [E-devel]  [Patch]  Elementary: New custom widget Popup

Hi All,
   Attached to the mail is the patch for a new custom elementary
widget  elm_popup for your review.

Change description:
New custom widget Popup added.

elm_popup is an enhancement over elm_notify widget with widely used
parts such as Title, Content and Action Buttons.
Items are supported as well and they are put inside the content area
which can have either an Evas Object/Set of items/Description text.



SVN revision: 68747
This commit is contained in:
Rajeev Ranjan 2012-03-05 23:51:56 +00:00 committed by Carsten Haitzler
parent 4373acedcc
commit 9711e4c796
19 changed files with 3178 additions and 0 deletions

View File

@ -366,6 +366,7 @@ collections {
#include "widgets/video.edc"
#include "widgets/naviframe.edc"
#include "widgets/multibuttonentry.edc"
#include "widgets/popup.edc"
#include "ews.edc"
#include "widgets/pointer.edc"
}

View File

@ -1,4 +1,5 @@
group { name: "elm/button/base/default";
alias: "elm/button/base/popup_button/default";
images {
image: "bt_base1.png" COMP;
image: "bt_base2.png" COMP;

View File

@ -0,0 +1,899 @@
#define POPUP_ITEM_STATE_ENABLED 0
#define POPUP_ITEM_STATE_DISABLED 1
/*popup widget specific notify style style*/
group { name: "elm/notify/block_events/popup";
parts {
part { name: "block_events";
type: RECT;
description { state: "default" 0.0;
color: 61 59 56 180;
}
}
}
programs {
program { name: "block_clicked";
signal: "mouse,clicked,1";
source: "block_events";
action: SIGNAL_EMIT "elm,action,click" "elm";
}
}
}
group { name: "elm/label/base/popup/default";
styles
{
style { name: "popup_desc_style";
base: "font=Sans font_size=10 align=center color=#000000 text_class=label";
tag: "br" "\n";
tag: "ps" "ps";
tag: "whitecolor" "+ color=#ffffff";
tag: "tab" "\t";
}
}
parts {
part { name: "left_top_padding";
type: RECT;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
visible: 0;
align: 0.0 0.0;
min: 10 0;
rel2.relative: 0 0;
}
}
part { name: "right_bottom_padding";
type: RECT;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
visible: 0;
align: 1.0 1.0;
min: 10 0;
rel1.relative: 1 1;
}
}
part { name: "elm.text";
type: TEXTBLOCK;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
min: 380 0;
text {
style: "popup_desc_style";
min: 0 1;
max: 0 1;
}
rel1 {
relative: 1.0 1.0;
to: left_top_padding;
}
rel2 {
relative: 0.0 0.0;
to: right_bottom_padding;
}
}
}
}
}
group { name: "elm/popup/base/default";
styles {
style { name: "popup_title_style";
base: "font=Sans font_size=15 align=center color=#ffffff wrap=mixed ellipsis=1.0";
tag: "br" "\n";
tag: "tab" "\t";
}
}
parts {
part { name: "base";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 400 0;
color: 237 237 237 255;
align: 0.0 0.0;
}
}
part { name: "elm.bg.title";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 400 50;
fixed : 1 1;
align: 0.5 0.0;
visible: 0;
color: 172 172 172 255;
rel1 {
relative: 0.5 0.0;
to: "base";
}
rel2 {
relative: 0.5 0.0;
to: "base";
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "left_pad";
type: RECT;
scale: 1;
description { state: "default" 0.0;
min: 10 0;
max: 10 0;
fixed: 1 1;
align: 0.0 0.0;
visible: 0;
rel1.to: "elm.bg.title";
}
}
part { name: "right_pad";
type: RECT;
scale: 1;
description { state: "default" 0.0;
min: 10 0;
max: 10 0;
fixed: 1 1;
align: 1.0 1.0;
visible: 0;
rel2.to: "elm.bg.title";
}
}
part { name: "elm.swallow.title.icon";
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
min: 48 48;
max: 48 48;
fixed: 1 1;
align: 0.0 0.5;
rel1 {
to: "left_pad";
relative: 1.0 0.0;
}
rel2 {
to: "right_pad";
relative: 0.0 1.0;
}
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "elm.text.title";
type: TEXTBLOCK;
scale:1;
description { state: "default" 0.0;
text {
style: "popup_title_style";
min: 0 0;
max: 0 1;
}
color: 255 255 255 255;
visible:0;
rel1 {
relative: 1.0 0.0;
to: "left_pad";
}
rel2 {
relative: 0.0 1.0;
to: "right_pad";
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 400 0;
fixed: 1 0;
rel1 {
relative: 0.5 0.0;
to: "base";
}
rel2 {
relative: 0.5 1.0;
to: "base";
}
}
description { state: "show_title_area" 0.0;
inherit: "default" 0.0;
rel1 {
relative: 0.5 1.0;
to: "elm.bg.title";
}
}
description { state: "show_action_area" 0.0;
inherit: "default" 0.0;
rel2 {
relative: 0.5 0.0;
to: "elm.bg.action_area";
}
}
description { state: "show_action_title_area" 0.0;
inherit: "default" 0.0;
rel1 {
relative: 0.5 1.0;
to: "elm.bg.title";
}
rel2 {
relative: 0.5 0.0;
to: "elm.bg.action_area";
}
}
}
part { name: "elm.bg.action_area";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 400 60;
fixed : 1 1;
align: 0.5 1.0;
visible: 0;
color: 183 183 183 255;
rel1 {
relative: 0.0 1.0;
to: "base";
}
rel2.to: "base";
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "elm.swallow.action_area";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
align: 0.0 0.0;
visible: 0;
rel1.to: "elm.bg.action_area";
rel2.to: "elm.bg.action_area";
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
}
programs {
program { name: show_title_icon;
signal: "elm,state,title,icon,visible";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "elm.swallow.title.icon";
}
program { name: hide_title_icon;
signal: "elm,state,title,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.title.icon";
}
program { name: show_title_text;
signal: "elm,state,title,text,visible";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "elm.text.title";
}
program { name: hide_title_text;
signal: "elm,state,title,text,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.text.title";
}
program { name: show_title_area;
signal: "elm,state,title_area,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.action_area", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "show_action_title_area", 0.0);
else
set_state(PART:"elm.swallow.content", "show_title_area", 0.0);
set_state(PART:"elm.bg.title", "visible", 0.0);
}
}
program { name: hide_title_area;
signal: "elm,state,title_area,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.action_area", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "show_action_area", 0.0);
else
set_state(PART:"elm.swallow.content", "default", 0.0);
set_state(PART:"elm.bg.title", "default", 0.0);
}
}
program { name: show_action_area;
signal: "elm,state,action_area,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.bg.title", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "show_action_title_area", 0.0);
else
set_state(PART:"elm.swallow.content", "show_action_area", 0.0);
set_state(PART:"elm.bg.action_area", "visible", 0.0);
set_state(PART:"elm.swallow.action_area", "visible", 0.0);
}
}
program { name: hide_action_area;
signal: "elm,state,action_area,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
script {
new st[31];
new Float:vl;
get_state(PART:"elm.bg.title", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "show_title_area", 0.0);
else
set_state(PART:"elm.swallow.content", "default", 0.0);
set_state(PART:"elm.bg.action_area", "default", 0.0);
set_state(PART:"elm.swallow.action_area", "default", 0.0);
}
}
} /* end of programs */
}
group { name: "elm/popup/content/default";
parts{
part { name: "pad_t";
type: RECT;
scale : 1;
mouse_events: 0;
description { state: "default" 0.0;
align: 0.5 0.0;
min: 0 14;
fixed: 0 1;
visible: 0;
rel1 {
relative: 1.0 0.0;
to_x: "pad_l";
}
rel2 {
relative: 0.0 0.0;
to_x: "pad_r";
}
}
}
part { name: "pad_l";
type: RECT;
scale: 1;
description { state: "default" 0.0;
min : 10 0;
fixed: 1 0;
rel2.relative: 0.0 1.0;
visible: 0;
align: 0.0 0.0;
}
}
part { name: "pad_r";
type: RECT;
scale: 1;
description { state: "default" 0.0;
min : 10 0;
fixed: 1 0;
rel1.relative: 1.0 0.0;
visible: 0;
align: 1.0 0.0;
}
}
part{ name:"elm.swallow.content";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 380 0;
fixed: 1 0;
rel1 {
relative: 0.5 1.0;
to: "pad_t";
}
rel2 {
relative: 0.5 0.0;
to: "pad_b";
}
}
}
part { name: "pad_b";
type: RECT;
scale : 1;
mouse_events: 0;
description { state: "default" 0.0;
align: 0.5 1.0;
min: 0 14;
fixed: 0 1;
visible: 0;
rel1 {
relative: 0.0 1.0;
to_x: "pad_l";
}
rel2.to_x: "pad_r";
}
}
}
}
group { name: "elm/popup/item/default";
script {
public item_state = POPUP_ITEM_STATE_ENABLED;
}
parts {
part { name: "event_blocker";
description { state: "default" 0.0;
}
}
part { name: "bg";
mouse_events: 0;
type: RECT;
description { state: "default" 0.0;
color: 240 240 240 255;
min: 0 71;
align: 0.5 0.0;
}
description { state: "clicked" 0.0;
color: 190 170 150 255;
}
}
part { name: "padding_left_top";
type: RECT;
scale: 1;
mouse_events: 0;
description { state: "default" 0.0;
align: 0.0 0.0;
rel2.relative: 0.0 0.0;
min: 10 10;
fixed: 1 1;
visible: 0;
}
}
part { name: "padding_right_bottom";
type: RECT;
scale: 1;
mouse_events: 0;
description { state: "default" 0.0;
align: 1.0 1.0;
rel1.relative: 1.0 1.0;
min: 10 10;
fixed: 1 1;
visible: 0;
}
}
part { name: "separator";
mouse_events: 0;
type: RECT;
scale: 1;
description { state: "dafault" 0.0;
color: 180 180 180 255;
align: 0.5 1.0;
min: 0 1;
max: 999999 1;
}
}
part { name: "padding_icon_text";
type: RECT;
scale: 1;
mouse_events: 0;
description { state: "default" 0.0; //when only icon or no icon is there
align: 0.0 0.0;
rel1 {
relative: 1.0 0.0;
to: "elm.swallow.content";
}
rel2.to: "elm.swallow.content";
fixed: 1 0;
min: 0 0;
visible: 0;
}
description { state: "visible" 0.0; //when icon is visible
inherit: "default" 0.0;
min: 10 0;
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
visible: 0;
align: 0.0 0.5;
rel1 {
relative: 1.0 1.0;
to: "padding_left_top";
}
rel2 {
relative: 1.0 0.0;
to_x: "padding_left_top";
to_y: "padding_right_bottom";
}
fixed: 1 0;
}
description { state: "visible" 0.0;
fixed: 1 0;
min: 40 40;
max: 40 40;
align: 0.0 0.5;
rel1 {
relative: 1.0 1.0;
to: "padding_left_top";
}
rel2 {
relative: 1.0 0.0;
to_x: "padding_left_top";
to_y: "padding_right_bottom";
}
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
}
description { state: "icononly" 0.0;
min: 40 40;
max: 40 40;
rel1 {
relative: 1.0 1.0;
to: "padding_left_top";
}
rel2 {
relative: 0.0 0.0;
to: "padding_right_bottom";
}
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
}
}
part { name: "elm.text";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
rel1 {
relative: 1.0 1.0;
to_x: "padding_icon_text";
to_y: "padding_left_top";
}
rel2 {
relative: 0.0 0.0;
to:"padding_right_bottom";
}
align: 0.0 0.5;
color: 0 0 0 255;
text {
font: "Sans:style=Bold";
size: 20;
min: 0 0;
align: 0.0 0.5;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
min: 90 40;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
min: 0 0;
color: 255 255 255 255;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 128 128 128 255;
}
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
color: 128 128 128 255;
visible: 1;
min: 90 40;
}
}
part { name: "over1";
repeat_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
}
}
part { name: "over2";
repeat_events: 1;
description { state: "default" 0.0;
}
}
part { name: "disclip";
type: RECT;
description { state: "default" 0.0;
visible: 0;
}
description { state: "disabled" 0.0;
color: 87 87 87 128;
}
}
}
programs {
program { name: "item_unclick";
signal: "mouse,up,1";
source: "over1";
action: SIGNAL_EMIT "elm,action,click" "";
}
program { name: "disable";
signal: "elm,state,item,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "disclip";
after: "disable_text";
}
program { name: "enable";
signal: "elm,state,item,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "disclip";
after: "enable_text";
}
program { name: "item_click2";
signal: "mouse,down,1";
source: "over2";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.text", "clicked", 0.0);
set_state(PART:"bg", "clicked", 0.0);
}
}
program { name: "item_unclick2";
signal: "mouse,up,1";
source: "over2";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "clicked"))
set_state(PART:"elm.text", "visible", 0.0);
set_state(PART:"bg", "default", 0.0);
}
}
program { name: "disable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.text", "disabled_visible", 0.0);
else
set_state(PART:"elm.text", "disabled", 0.0);
set_int(item_state, POPUP_ITEM_STATE_DISABLED);
}
}
program { name: "enable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "disabled_visible"))
set_state(PART:"elm.text", "visible", 0.0);
else
set_state(PART:"elm.text", "default", 0.0);
set_int(item_state, POPUP_ITEM_STATE_ENABLED);
}
}
program { name: "text_show";
signal: "elm,state,item,text,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "icononly")) {
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"padding_icon_text", "visible", 0.0);
}
if(get_int(item_state) != POPUP_ITEM_STATE_DISABLED)
set_state(PART:"elm.text", "visible", 0.0);
else
set_state(PART:"elm.text", "disabled_visible", 0.0);
}
}
program { name: "text_hide";
signal: "elm,state,item,text,hidden";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "visible")) {
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"padding_icon_text", "icononly", 0.0);
}
set_state(PART:"elm.text", "default", 0.0);
}
}
program { name: "icon_show";
signal: "elm,state,item,icon,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible")) {
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"padding_icon_text", "visible", 0.0);
}
else {
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"padding_icon_text", "icononly", 0.0);
}
}
}
program { name: "icon_hide";
signal: "elm,state,item,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
}
}
}
group { name: "elm/popup/buttons1/default";
data.item: "action_area_height" "140";
parts{
part{ name:"actionbtn1";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 252 46;
max: 252 46;
fixed : 1 1;
rel1.relative: 0.5 0.0;
rel2.relative: 0.5 1.0;
}
}
}
}
group { name: "elm/popup/buttons2/default";
data.item: "action_area_height" "140";
parts{
part{ name:"actionbtn1";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 172 46;
max: 172 46;
fixed : 1 1;
align: 1.0 0.5;
rel1.to: "elm.rect.pad_btn";
rel2 {
relative: 0.0 1.0;
to: "elm.rect.pad_btn";
}
}
}
part { name: "elm.rect.pad_btn";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 6 46;
max: 6 46;
fixed : 1 1;
visible: 0;
rel1.relative: 0.5 0.0;
rel2.relative: 0.5 1.0;
}
}
part{ name:"actionbtn2";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 172 46;
max: 172 46;
fixed : 1 1;
align: 0.0 0.5;
rel1 {
relative: 1.0 0.0;
to: "elm.rect.pad_btn";
}
rel2.to: "elm.rect.pad_btn";
}
}
}
}
group { name: "elm/popup/buttons3/default";
data.item: "action_area_height" "140";
parts{
part{ name:"actionbtn1";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 120 46;
max: 120 46;
fixed : 1 1;
align: 1.0 0.5;
rel1.to: "elm.rect.pad_btn";
rel2 {
relative: 0.0 1.0;
to: "elm.rect.pad_btn";
}
}
}
part { name: "elm.rect.pad_btn";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 6 46;
max: 6 46;
fixed : 1 1;
visible: 0;
rel1.to: "actionbtn2";
rel2 {
relative: 0.0 1.0;
to: "actionbtn2";
}
}
}
part{ name:"actionbtn2";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 120 46;
max: 120 46;
fixed : 1 1;
rel1.relative: 0.5 0.0;
rel2.relative: 0.5 1.0;
}
}
part { name: "elm.rect.pad_btn2";
type: RECT;
scale : 1;
description { state: "default" 0.0;
min: 6 46;
max: 6 46;
fixed : 1 1;
visible: 0;
rel1 {
relative: 1.0 0.0;
to: "actionbtn2";
}
rel2.to: "actionbtn2";
}
}
part{ name:"actionbtn3";
type: SWALLOW;
scale : 1;
description { state: "default" 0.0;
min: 120 46;
max: 120 46;
fixed : 1 1;
align: 0.0 0.5;
rel1 {
relative: 1.0 0.0;
to: "elm.rect.pad_btn2";
}
rel2.to: "elm.rect.pad_btn2";
}
}
}
}
#undef POPUP_ITEM_STATE_ENABLED
#undef POPUP_ITEM_STATE_DISABLED

View File

@ -73,6 +73,7 @@ WGT_PREVIEW = \
progressbar:preview-00.png:widget_preview_progressbar:150:50 \
box:preview-00.png:widget_preview_box:200:160 \
notify:preview-00.png:widget_preview_notify:60:30 \
popup:preview-00.png:widget_preview_popup:480:400 \
slideshow:preview-00.png:widget_preview_slideshow:50:50 \
photocam:preview-00.png:widget_preview_photocam:243:162 \
inwin:preview-00.png:widget_preview_inwin1:200:160 \

View File

@ -5186,6 +5186,46 @@
* @example notify_example_01.c
*/
/**
* @page popup_example_01_c popup_example_01.c
* @include popup_example_01.c
*
* This example will initially look like this:
*
* @image html screenshots/popup_example_01.png
* @image latex screenshots/popup_example_01.eps width=\textwidth
*
* Once the popup is hidden after timeout:
*
* @image html screenshots/popup_example_01_a.png
* @image latex screenshots/popup_example_01_a.eps width=\textwidth
*
* @example popup_example_01.c
*/
/** @page popup_example_02_c popup_example_02.c
* @include popup_example_02.c
*
* This example will look like this:
*
* @image html screenshots/popup_example_02.png
* @image latex screenshots/popup_example_02.eps width=\textwidth
*
* @example popup_example_02.c
*/
/**
* @page popup_example_03_c popup_example_03.c
* @include popup_example_03.c
*
* This example will look like this:
*
* @image html screenshots/popup_example_03.png
* @image latex screenshots/popup_example_03.eps width=\textwidth
*
* @example popup_example_03.c
*/
/**
* @page tutorial_frame Frame example
* @dontinclude frame_example_01.c

View File

@ -180,6 +180,10 @@
*
* @image html img/widget/photocam/preview-00.png
* @image latex img/widget/photocam/preview-00.eps
* @li @ref Popup
*
* @image html img/widget/popup/preview-00.png
* @image latex img/widget/popup/preview-00.eps
* @li @ref Progressbar
*
* @image html img/widget/progressbar/preview-00.png

View File

@ -84,6 +84,7 @@ widget_preview_genlist5 \
widget_preview_progressbar \
widget_preview_box \
widget_preview_notify \
widget_preview_popup \
widget_preview_slideshow \
widget_preview_photocam \
widget_preview_inwin1 \
@ -150,6 +151,7 @@ EXTRA_DIST = \
widget_preview_layout.c \
widget_preview_list.c \
widget_preview_segment_control.c \
widget_preview_popup.c \
widget_preview_separator.c \
widget_preview_radio.c \
widget_preview_toggle.c \

View File

@ -0,0 +1,15 @@
#include "widget_preview_tmpl_head.c"
Evas_Object *o = elm_popup_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, o);
elm_object_part_text_set(o, "title,text", "Title");
elm_object_text_set(o, "Content");
Evas_Object *o2 = elm_button_add(win);
elm_object_text_set(o2, "Close");
elm_object_part_content_set(o, "button1", o2);
evas_object_show(o);
#include "widget_preview_tmpl_foot.c"

View File

@ -90,6 +90,7 @@ test_panel.c \
test_panes.c \
test_photo.c \
test_photocam.c \
test_popup.c \
test_progressbar.c \
test_radio.c \
test_scaling.c \

View File

@ -165,6 +165,7 @@ void test_3d(void *data, Evas_Object *obj, void *event_info);
void test_naviframe(void *data, Evas_Object *obj, void *event_info);
//void test_factory(void *data, Evas_Object *obj, void *event_info);
void test_datetime(void *data, Evas_Object *obj, void *event_info);
void test_popup(void *data, Evas_Object *obj, void *event_info);
#ifdef HAVE_EMOTION
void test_video(void *data, Evas_Object *obj, void *event_info);
#endif
@ -504,6 +505,7 @@ add_tests:
ADD_TEST(NULL, "Popups", "Notify", test_notify);
ADD_TEST(NULL, "Popups", "Tooltip", test_tooltip);
ADD_TEST(NULL, "Popups", "Tooltip 2", test_tooltip2);
ADD_TEST(NULL, "Popups", "Popup", test_popup);
//------------------------------//
ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);

View File

@ -0,0 +1,262 @@
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH
static void
_response_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
evas_object_hide(data);
evas_object_del(data);
}
static void
_block_clicked_cb(void *data __UNUSED__, Evas_Object *obj,
void *event_info __UNUSED__)
{
printf("\nblock,clicked callback\n");
evas_object_del(obj);
}
static void
_item_selected_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info)
{
printf("popup item selected: %s\n", elm_object_item_text_get(event_info));
}
static void
_list_click(void *data __UNUSED__, Evas_Object *obj,
void *event_info __UNUSED__)
{
Elm_Object_Item *it = elm_list_selected_item_get(obj);
if (!it) return;
elm_list_item_selected_set(it, EINA_FALSE);
}
static void
_popup_center_text_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, "This Popup has content area and "
"timeout value is 3 seconds");
elm_popup_timeout_set(popup, 3.0);
evas_object_smart_callback_add(popup, "timeout", _response_cb, popup);
evas_object_show(popup);
}
static void
_popup_center_text_1button_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
Evas_Object *btn;
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, "This Popup has content area and "
"action area set, action area has one button Close");
btn = elm_button_add(popup);
elm_object_text_set(btn, "Close");
elm_object_part_content_set(popup, "button1", btn);
evas_object_smart_callback_add(btn, "clicked", _response_cb, popup);
evas_object_show(popup);
}
static void
_popup_center_title_text_1button_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
Evas_Object *btn;
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, "This Popup has title area, content area and "
"action area set, action area has one button Close");
elm_object_part_text_set(popup, "title,text", "Title");
btn = elm_button_add(popup);
elm_object_text_set(btn, "Close");
elm_object_part_content_set(popup, "button1", btn);
evas_object_smart_callback_add(btn, "clicked", _response_cb, popup);
evas_object_show(popup);
}
static void
_popup_center_title_text_block_clicked_event_cb(void *data,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, "This Popup has title area and content area. "
"When clicked on blocked event region, popup gets "
"deleted");
elm_object_part_text_set(popup, "title,text", "Title");
evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb,
NULL);
evas_object_show(popup);
}
static void
_popup_bottom_title_text_3button_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
Evas_Object *icon, *btn1, *btn2, *btn3;
char buf[256];
popup = elm_popup_add(data);
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, "This Popup has title area, content area and "
"action area set with content being character wrapped. "
"action area has three buttons OK, Cancel and Close");
elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
elm_object_part_text_set(popup, "title,text", "Title");
icon = elm_icon_add(popup);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
elm_app_data_dir_get());
elm_icon_file_set(icon, buf, NULL);
elm_object_part_content_set(popup, "title,icon", icon);
btn1 = elm_button_add(popup);
elm_object_text_set(btn1, "OK");
elm_object_part_content_set(popup, "button1", btn1);
btn2 = elm_button_add(popup);
elm_object_text_set(btn2, "Cancel");
elm_object_part_content_set(popup, "button2", btn2);
btn3 = elm_button_add(popup);
elm_object_text_set(btn3, "Close");
elm_object_part_content_set(popup, "button3", btn3);
evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup);
evas_object_show(popup);
}
static void
_popup_center_title_content_3button_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *popup;
Evas_Object *icon, *btn, *btn1, *btn2, *btn3;
char buf[256];
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
btn = elm_button_add(popup);
elm_object_text_set(btn, "Content");
icon = elm_icon_add(btn);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
elm_app_data_dir_get());
elm_icon_file_set(icon, buf, NULL);
elm_object_content_set(btn, icon);
elm_object_content_set(popup, btn);
elm_object_part_text_set(popup, "title,text", "Title");
btn1 = elm_button_add(popup);
elm_object_text_set(btn1, "OK");
elm_object_part_content_set(popup, "button1", btn1);
btn2 = elm_button_add(popup);
elm_object_text_set(btn2, "Cancel");
elm_object_part_content_set(popup, "button2", btn2);
btn3 = elm_button_add(popup);
elm_object_text_set(btn3, "Close");
elm_object_part_content_set(popup, "button3", btn3);
evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup);
evas_object_show(popup);
}
static void
_popup_center_title_item_3button_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
char buf[256];
unsigned int i;
Evas_Object *popup, *icon1, *btn1, *btn2, *btn3;
popup = elm_popup_add(data);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
icon1 = elm_icon_add(popup);
elm_object_part_text_set(popup, "title,text", "Title");
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
elm_app_data_dir_get());
elm_icon_file_set(icon1, buf, NULL);
for (i = 0; i < 10; i++)
{
snprintf(buf, sizeof(buf), "Item%u", i+1);
if (i == 3)
elm_popup_item_append(popup, buf, icon1, _item_selected_cb, NULL);
else
elm_popup_item_append(popup, buf, NULL, _item_selected_cb, NULL);
}
btn1 = elm_button_add(popup);
elm_object_text_set(btn1, "OK");
elm_object_part_content_set(popup, "button1", btn1);
btn2 = elm_button_add(popup);
elm_object_text_set(btn2, "Cancel");
elm_object_part_content_set(popup, "button2", btn2);
btn3 = elm_button_add(popup);
elm_object_text_set(btn3, "Close");
elm_object_part_content_set(popup, "button3", btn3);
evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup);
evas_object_show(popup);
}
void
test_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *list;
win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
elm_win_title_set(win, "popup");
elm_win_autodel_set(win, EINA_TRUE);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
list = elm_list_add(win);
elm_win_resize_object_add(win, list);
elm_list_mode_set(list, ELM_LIST_LIMIT);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_smart_callback_add(list, "selected", _list_click, NULL);
elm_list_item_append(list, "popup-center-text", NULL, NULL,
_popup_center_text_cb, win);
elm_list_item_append(list, "popup-center-text + 1 button", NULL, NULL,
_popup_center_text_1button_cb, win);
elm_list_item_append(list, "popup-center-title + text + 1 button", NULL,
NULL, _popup_center_title_text_1button_cb, win);
elm_list_item_append(list,
"popup-center-title + text (block,clicked handling)",
NULL, NULL,
_popup_center_title_text_block_clicked_event_cb, win);
elm_list_item_append(list, "popup-bottom-title + text + 3 buttons", NULL,
NULL, _popup_bottom_title_text_3button_cb, win);
elm_list_item_append(list, "popup-center-title + content + 3 buttons", NULL,
NULL, _popup_center_title_content_3button_cb, win);
elm_list_item_append(list, "popup-center-title + items + 3 buttons", NULL,
NULL, _popup_center_title_item_3button_cb, win);
elm_list_go(list);
evas_object_show(list);
evas_object_show(win);
evas_object_resize(win, 480, 800);
}
#endif

View File

@ -109,6 +109,9 @@ SRCS = \
progressbar_example.c \
notify_example_01.c \
photocam_example_01.c \
popup_example_01.c \
popup_example_02.c \
popup_example_03.c \
inwin_example.c \
scroller_example_01.c \
table_example_01.c \
@ -218,6 +221,9 @@ examples_PROGRAMS += \
progressbar_example \
notify_example_01 \
photocam_example_01 \
popup_example_01 \
popup_example_02 \
popup_example_03 \
inwin_example \
scroller_example_01 \
table_example_01 \
@ -303,6 +309,10 @@ SCREENSHOTS = \
progressbar_example:progressbar_example.png:0.0 \
notify_example_01:notify_example_01.png:0.0 \
notify_example_01:notify_example_01_a.png:6.0 \
popup_example_01:popup_example_01.png:1.0 \
popup_example_01:popup_example_01_a.png:6.0 \
popup_example_02:popup_example_02.png:0.2 \
popup_example_03:popup_example_03.png:0.2 \
slideshow_example:slideshow_example.png:1.0 \
photocam_example_01:photocam_example_01.png:3 \
scroller_example_01:scroller_example_01.png:0.0 \

View File

@ -0,0 +1,64 @@
//Compile with:
//gcc -g `pkg-config --cflags --libs elementary` popup_example_01.c -o popup_example_01
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__ __attribute__((unused))
# define PACKAGE_DATA_DIR "../../data"
#endif
static void _block_clicked(void *data, Evas_Object *obj, void *event_info);
static void _timeout(void *data, Evas_Object *obj, void *event_info);
EAPI_MAIN int
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
{
Evas_Object *win, *bg, *popup, *content;
win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
elm_win_title_set(win, "Popup");
elm_win_autodel_set(win, EINA_TRUE);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
bg = elm_bg_add(win);
elm_bg_color_set(bg, 128, 128, 128);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
content = elm_label_add(win);
elm_object_text_set(content, "<align=center>Content</align>");
popup = elm_popup_add(win);
elm_popup_timeout_set(popup, 3.0);
evas_object_smart_callback_add(popup, "timeout", _timeout, NULL);
//Setting popup content
elm_object_content_set(popup, content);
//Seting popup title-text
elm_object_part_text_set(popup, "title,text", "Title");
evas_object_show(popup);
evas_object_smart_callback_add(popup, "block,clicked", _block_clicked, NULL);
evas_object_show(win);
evas_object_resize(win, 480, 800);
elm_run();
return 0;
}
ELM_MAIN()
static void
_block_clicked(void *data __UNUSED__, Evas_Object *obj,
void *event_info __UNUSED__)
{
evas_object_hide(obj);
}
static void
_timeout(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
evas_object_hide(obj);
}

View File

@ -0,0 +1,85 @@
//Compile with:
//gcc -g `pkg-config --cflags --libs elementary` popup_example_02.c -o popup_example_02
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__ __attribute__((unused))
# define PACKAGE_DATA_DIR "../../data"
#endif
static void _response_cb(void *data, Evas_Object *obj, void *event_info);
EAPI_MAIN int
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
{
Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1;
char buf[256];
win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
elm_win_title_set(win, "Popup");
elm_win_autodel_set(win, EINA_TRUE);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
popup = elm_popup_add(win);
// Setting popup content-text
elm_object_text_set(popup, "This is the Content-Text for popup. The wrap"
"for the content-text is character wrapping");
// Setting the wrapping type to character wrapping
elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
// Seting popup title-text
elm_object_part_text_set(popup, "title,text", "Title");
icon1 = elm_icon_add(popup);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(icon1, buf, NULL);
//Setting popup title-icon
elm_object_part_content_set(popup, "title,icon", icon1);
// Creating the first action button
btn1 = elm_button_add(popup);
elm_object_text_set(btn1, "OK");
// Setting the fist action button
elm_object_part_content_set(popup, "button1", btn1);
evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
// Creating the second action button
btn2 = elm_button_add(popup);
elm_object_text_set(btn2, "Cancel");
// Setting the second action button
elm_object_part_content_set(popup, "button2", btn2);
evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
btn3 = elm_button_add(popup);
elm_object_text_set(btn3, "Close");
// Setting this action button
elm_object_part_content_set(popup, "button3", btn3);
// Setting the orientation of popup to Top
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
// Display the popup object
evas_object_show(popup);
evas_object_resize(win, 480, 800);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
static void
_response_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
evas_object_del(data);
}

View File

@ -0,0 +1,102 @@
//Compile with:
//gcc -g `pkg-config --cflags --libs elementary` popup_example_03.c -o popup_example_03
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__ __attribute__((unused))
# define PACKAGE_DATA_DIR "../../data"
#endif
static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info);
static void _response_cb(void *data, Evas_Object *obj, void *event_info);
EAPI_MAIN int
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
{
Evas_Object *win, *bg, *popup, *btn1, *btn2, *icon1;
Elm_Object_Item *popup_it1;
char buf[256];
win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
elm_win_title_set(win, "Popup");
elm_win_autodel_set(win, EINA_TRUE);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
popup = elm_popup_add(win);
icon1 = elm_icon_add(popup);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(icon1, buf, NULL);
//Seting popup title-text
elm_object_part_text_set(popup, "title,text", "Title");
//Appending popup content-items
elm_popup_item_append(popup, "Message", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Email", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Contacts", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Video", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Music", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Memo", NULL, _item_selected_cb, NULL);
popup_it1 = elm_popup_item_append(popup, "Radio", NULL, _item_selected_cb,
NULL);
//Changing the label of the item
elm_object_item_text_set(popup_it1, "FM");
elm_popup_item_append(popup, "Messenger", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Settings", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "App Installer", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Browser", NULL, _item_selected_cb, NULL);
elm_popup_item_append(popup, "Weather", icon1, _item_selected_cb, NULL);
elm_popup_item_append(popup, "News Feeds", NULL, _item_selected_cb, NULL);
//Seting popup title-text
elm_object_part_text_set(popup, "title,text", "Title");
// Creating the first action button
btn1 = elm_button_add(popup);
elm_object_text_set(btn1, "OK");
//Appending the fist action button
elm_object_part_content_set(popup, "button1", btn1);
evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
//Creating the second action button
btn2 = elm_button_add(popup);
elm_object_text_set(btn2, "Cancel");
evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
//Appending the second action button
elm_object_part_content_set(popup, "button1", btn2);
//Display the popup object
evas_object_show(popup);
evas_object_resize(win, 480, 800);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
static void
_item_selected_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info)
{
printf("popup item selected: %s\n", elm_object_item_text_get(event_info));
}
static void
_response_cb(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
evas_object_hide(data);
}

View File

@ -172,6 +172,7 @@ EAPI extern Elm_Version *elm_version;
#include <elc_hoversel.h>
#include <elc_multibuttonentry.h>
#include <elc_naviframe.h>
#include <elc_popup.h>
#include <elm_actionslider.h> //ok
#include <elm_app.h> //ok
#include <elm_bg.h>

View File

@ -54,6 +54,7 @@ elc_fileselector.h \
elc_hoversel.h \
elc_multibuttonentry.h \
elc_naviframe.h \
elc_popup.h \
elm_actionslider.h \
elm_app.h \
elm_authors.h \
@ -141,6 +142,7 @@ elm_priv.h \
elc_anchorblock.c \
elc_anchorview.c \
elc_ctxpopup.c \
elc_popup.c \
elc_fileselector_button.c \
elc_fileselector.c \
elc_fileselector_entry.c \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,269 @@
/**
* @defgroup Popup Popup
* @ingroup Elementary
*
* This widget is an enhancement of @ref Notify.
* In addition to Content area, there are two optional sections namely Title
* area and Action area.
*
* Popup Widget displays its content with a particular orientation in the parent
* area. This orientation can be one among top, center, bottom, left, top-left,
* top-right, bottom-left and bottom-right.
* Content part of Popup can be an Evas Object set by application or it can be
* Text set by application or set of items containing an icon and/or text.
* The content/item-list can be removed using elm_object_content_set with second
* parameter passed as NULL.
*
* Following figures shows the textual layouts of popup in which Title Area and
* Action area area are optional ones.
* Action area can have upto 3 buttons handled using elm_object common APIs
* mentioned below. If user wants to have more than 3 buttons then these buttons
* can be put inside the items of a list as content.
* User needs to handle the clicked signal of these action buttons if required.
* No event is processed by the widget automatically when clicked on these
* action buttons.
*
* <pre>
*
* |-------------------- | |----------------- ---| |----------------- ---|
* | Title Area | | Title Area | | Title Area |
* |Icon| Text | |Icon| Text | |Icon| Text |
* |------------------- -| |---------------- ----| |------------------ --|
* | Item 1 | | | | |
* |------------------- -| | | | |
* | Item 2 | | | | Description |
* |------------------ --| | Content | | |
* | Item 3 | | | | |
* |------------------ --| | | | |
* | . | |------------------ --| |------------------- -|
* | . | | Action Area | | Action Area |
* | . | | Btn1 |Btn2|. |Btn3 | | Btn1 |Btn2| |Btn3 |
* |------------------ --| |------------------- -| |------------------- -|
* | Item N | Content Based Layout Description based Layout
* |------------------ --|
* | Action Area |
* | Btn1 |Btn2|. |Btn3 |
* |------------------- -|
* Item Based Layout
*
* </pre>
*
* Timeout can be set on expiry of which popup instance hides and sends a smart
* signal "timeout" to the user.
* The visible region of popup is surrounded by a translucent region called
* Blocked Event area.
* By clicking on Blocked Event area, the signal "block,clicked" is sent to
* the application. This block event area can be avoided by using
* API elm_popup_allow_events_set.
* When gets hidden, popup does not get destroyed automatically, application
* should destroy the popup instance after use.
* To control the maximum height of the internal scroller for item, we use the
* height of the action area which is passed by theme based on the number of
* buttons currently set to popup.
*
* Signals that you can add callbacks for are:
* @li "timeout" - when ever popup is closed as a result of timeout.
* @li "block,clicked" - when ever user taps on Blocked Event area.
*
* Styles available for Popup
* @li "default"
*
* Default contents parts of the popup widget that you can use for are:
* @li "default" - The content of the popup
* @li "title,icon" - Title area's icon
* @li "button1" - 1st button of the action area
* @li "button2" - 2nd button of the action area
* @li "button3" - 3rd button of the action area
*
* Default text parts of the popup widget that you can use for are:
* @li "title,text" - This operates on Title area's label
* @li "default" - content-text set in the content area of the widget
*
* Default contents parts of the popup items that you can use for are:
* @li "default" -Item's icon
*
* Default text parts of the popup items that you can use for are:
* @li "default" - Item's label
*
* Supported elm_object common APIs.
* @li elm_object_part_content_set
* @li elm_object_part_content_get
* @li elm_object_part_content_unset
*
* Supported elm_object_item common APIs.
* @li elm_object_item_disabled_set
* @li elm_object_item_disabled_get
* @li elm_object_item_part_text_set
* @li elm_object_item_part_text_get
* @li elm_object_item_part_content_set
* @li elm_object_item_part_content_get
* @li elm_object_item_signal_emit
* @li elm_object_item_del
*
* Here are some sample code to illustrate Popup usage:
* @li @ref popup_example_01_c
* @li @ref popup_example_02_c
* @li @ref popup_example_03_c
*/
/**
* @brief Possible orient values for popup.
*
* These values should be used in conjunction to elm_popup_orient_set() to
* set the position in which the popup should appear(relative to its parent)
* and in conjunction with elm_popup_orient_get() to know where the popup
* is appearing.
*
* @ingroup Popup
*/
typedef enum
{
ELM_POPUP_ORIENT_TOP = 0, /**< Popup should appear in the top of parent, default */
ELM_POPUP_ORIENT_CENTER, /**< Popup should appear in the center of parent */
ELM_POPUP_ORIENT_BOTTOM, /**< Popup should appear in the bottom of parent */
ELM_POPUP_ORIENT_LEFT, /**< Popup should appear in the left of parent */
ELM_POPUP_ORIENT_RIGHT, /**< Popup should appear in the right of parent */
ELM_POPUP_ORIENT_TOP_LEFT, /**< Popup should appear in the top left of parent */
ELM_POPUP_ORIENT_TOP_RIGHT, /**< Popup should appear in the top right of parent */
ELM_POPUP_ORIENT_BOTTOM_LEFT, /**< Popup should appear in the bottom left of parent */
ELM_POPUP_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */
ELM_POPUP_ORIENT_LAST /**< Sentinel value, @b don't use */
} Elm_Popup_Orient;
/**
* @brief Adds a new Popup to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Popup
*/
EAPI Evas_Object *elm_popup_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
/**
* @brief Add a new item to a Popup object
*
* Both an item list and a content could not be set at the same time!
* once you add an item, the previous content will be removed.
*
* @param obj popup object
* @param icon Icon to be set on new item
* @param label The Label of the new item
* @param func Convenience function called when item selected
* @param data Data passed to @p func above
* @return A handle to the item added or @c NULL, on errors
*
* @ingroup Popup
* @warning When the first item is appended to popup object, any previous content
* of the content area is deleted. At a time, only one of content, content-text
* and item(s) can be there in a popup content area.
*/
EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
/**
* @brief Sets the wrapping type of content text packed in content
* area of popup object.
*
* @param obj The Popup object
* @param wrap wrapping type of type Elm_Wrap_Type
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_get()
*/
EAPI void elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap) EINA_ARG_NONNULL(1);
/**
* @brief Returns the wrapping type of content text packed in content area of
* popup object.
*
* @param obj The Popup object
* @return wrap type of the content text
*
* @ingroup Popup
* @see elm_popup_content_text_wrap_type_set
*/
EAPI Elm_Wrap_Type elm_popup_content_text_wrap_type_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets the orientation of the popup in the parent region
*
* @param obj The popup object
* @param orient the orientation of the popup
*
* Sets the position in which popup will appear in its parent
*
* @ingroup Popup
* @see @ref Elm_Popup_Orient for possible values.
*/
EAPI void elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient) EINA_ARG_NONNULL(1);
/**
* @brief Returns the orientation of Popup
*
* @param obj The popup object
* @return the orientation of the popup
*
* @ingroup Popup
* @see elm_popup_orient_set()
* @see Elm_Popup_Orient
*/
EAPI Elm_Popup_Orient elm_popup_orient_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets a timeout to hide popup automatically
*
* @param obj The popup object
* @param timeout The timeout in seconds
*
* This function sets a timeout and starts the timer controlling when the
* popup is hidden. Since calling evas_object_show() on a popup restarts
* the timer controlling when it is hidden, setting this before the
* popup is shown will in effect mean starting the timer when the popup is
* shown. Smart signal "timeout" is called afterwards which can be handled
* if needed.
*
* @note Set a value <= 0.0 to disable a running timer.
*
* @note If the value > 0.0 and the popup is previously visible, the
* timer will be started with this value, canceling any running timer.
* @ingroup Popup
*/
EAPI void elm_popup_timeout_set(Evas_Object *obj, double timeout) EINA_ARG_NONNULL(1);
/**
* @brief Returns the timeout value set to the popup (in seconds)
*
* @param obj The popup object
* @return the timeout value
*
* @ingroup Popup
* @see elm_popup_timeout_set()
*/
EAPI double elm_popup_timeout_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Sets whether events should be passed to by a click outside.
*
* @param obj The popup object
* @param allow EINA_TRUE Events are passed to lower objects, else not
*
* Enabling allow event will remove the Blocked event area and events will
* pass to the lowever layer objects otherwise they are blocked.
*
* @ingroup Popup
* @see elm_popup_allow_events_get()
* @note The default value is EINA_FALSE.
*/
EAPI void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow);
/**
* @brief Returns value indicating whether allow event is enabled or not
*
* @param obj The popup object
* @return EINA_FALSE if Blocked event area is present else EINA_TRUE
*
* @ingroup Popup
* @see elm_popup_allow_events_set()
* @note By default the Blocked event area is present
*/
EAPI Eina_Bool elm_popup_allow_events_get(Evas_Object *obj);