[elm] calendar: Making the them with double spinner a

style

The theme with double spinners is now a different style, so the user
can choice wich style he wants to use. It also removes the deprecated
flag from the elm_calendar_format_function_set() function.



SVN revision: 83095
This commit is contained in:
Flavio Vinicius Alvares Ceolin 2013-01-22 16:37:45 +00:00
parent 288aeff59e
commit 3048fa42b8
5 changed files with 200 additions and 127 deletions

View File

@ -1,5 +1,5 @@
#define CAL_SPIN(_sufix, _relative)\
part { name: "left_bt_"#_sufix;\
#define CAL_SPIN(_sufix, _signal_sufix, _text, _relative)\
part { name: "left_bt"#_sufix;\
mouse_events: 1;\
description { state: "default" 0.0;\
rel1 { to: #_relative;\
@ -24,11 +24,11 @@
image.middle: SOLID;\
}\
}\
part { name: "left_bt_"#_sufix"_over1";\
part { name: "left_bt"#_sufix"_over1";\
mouse_events: 0;\
description { state: "default" 0.0;\
rel1.to: "left_bt_"#_sufix;\
rel2 { to: "left_bt_"#_sufix;\
rel1.to: "left_bt"#_sufix;\
rel2 { to: "left_bt"#_sufix;\
relative: 1.0 0.5;\
}\
image {\
@ -37,25 +37,25 @@
}\
}\
}\
part { name: "left_bt_"#_sufix"_over2";\
part { name: "left_bt"#_sufix"_over2";\
mouse_events: 1;\
repeat_events: 1;\
description { state: "default" 0.0;\
rel1.to: "left_bt_"#_sufix;\
rel2.to: "left_bt_"#_sufix;\
rel1.to: "left_bt"#_sufix;\
rel2.to: "left_bt"#_sufix;\
image {\
normal: "bt_shine.png";\
border: 7 7 7 7;\
}\
}\
}\
part { name: "left_bt_"#_sufix"_over3";\
part { name: "left_bt"#_sufix"_over3";\
mouse_events: 1;\
repeat_events: 1;\
description { state: "default" 0.0;\
color: 255 255 255 0;\
rel1.to: "left_bt_"#_sufix;\
rel2.to: "left_bt_"#_sufix;\
rel1.to: "left_bt"#_sufix;\
rel2.to: "left_bt"#_sufix;\
image {\
normal: "bt_glow.png";\
border: 12 12 12 12;\
@ -68,11 +68,11 @@
color: 255 255 255 255;\
}\
} \
part { name: "left_bt_"#_sufix"_icon";\
part { name: "left_bt"#_sufix"_icon";\
repeat_events: 1;\
description { state: "default" 0.0;\
rel1.to: "left_bt_"#_sufix;\
rel2.to: "left_bt_"#_sufix;\
rel1.to: "left_bt"#_sufix;\
rel2.to: "left_bt"#_sufix;\
align: 0.5 0.5;\
min: 16 16;\
max: 16 16;\
@ -83,7 +83,7 @@
image.normal: "sp_bt_r.png";\
}\
}\
part { name: "right_bt_"#_sufix;\
part { name: "right_bt"#_sufix;\
mouse_events: 1;\
description { state: "default" 0.0;\
rel1 { to: #_relative;\
@ -108,11 +108,11 @@
image.middle: SOLID;\
}\
}\
part { name: "right_bt_"#_sufix"_over1";\
part { name: "right_bt"#_sufix"_over1";\
mouse_events: 0;\
description { state: "default" 0.0;\
rel1.to: "right_bt_"#_sufix;\
rel2 { to: "right_bt_"#_sufix;\
rel1.to: "right_bt"#_sufix;\
rel2 { to: "right_bt"#_sufix;\
relative: 1.0 0.5;\
}\
image {\
@ -121,25 +121,25 @@
}\
}\
}\
part { name: "right_bt_"#_sufix"_over2";\
part { name: "right_bt"#_sufix"_over2";\
mouse_events: 1;\
repeat_events: 1;\
description { state: "default" 0.0;\
rel1.to: "right_bt_"#_sufix;\
rel2.to: "right_bt_"#_sufix;\
rel1.to: "right_bt"#_sufix;\
rel2.to: "right_bt"#_sufix;\
image {\
normal: "bt_shine.png";\
border: 7 7 7 7;\
}\
}\
}\
part { name: "right_bt_"#_sufix"_over3";\
part { name: "right_bt"#_sufix"_over3";\
mouse_events: 1;\
repeat_events: 1;\
description { state: "default" 0.0;\
color: 255 255 255 0;\
rel1.to: "right_bt_"#_sufix;\
rel2.to: "right_bt_"#_sufix;\
rel1.to: "right_bt"#_sufix;\
rel2.to: "right_bt"#_sufix;\
image {\
normal: "bt_glow.png";\
border: 12 12 12 12;\
@ -152,11 +152,11 @@
color: 255 255 255 255;\
}\
}\
part { name: "right_bt_"#_sufix"_icon";\
part { name: "right_bt"#_sufix"_icon";\
repeat_events: 1;\
description { state: "default" 0.0;\
rel1.to: "right_bt_"#_sufix;\
rel2.to: "right_bt_"#_sufix;\
rel1.to: "right_bt"#_sufix;\
rel2.to: "right_bt"#_sufix;\
align: 0.5 0.5;\
min: 16 16;\
max: 16 16;\
@ -167,7 +167,7 @@
image.normal: "sp_bt_l.png";\
}\
}\
part { name: "text_"#_sufix;\
part { name: #_text;\
type: TEXT;\
mouse_events: 0;\
scale: 1;\
@ -176,12 +176,12 @@
fixed: 1 1;\
rel1 { relative: 1.0 0.0;\
offset: 3 2;\
to: "left_bt_"#_sufix;\
to: "left_bt"#_sufix;\
to_y: #_relative;\
}\
rel2 { relative: 0.0 1.0;\
offset: -3 -2;\
to_x: "right_bt_"#_sufix;\
to_x: "right_bt"#_sufix;\
to_y: #_relative;\
}\
color: 0 0 0 255;\
@ -196,95 +196,95 @@
programs {\
program { name: "dec_"#_sufix"_start";\
signal: "mouse,down,1";\
source: "left_bt_"#_sufix;\
action: SIGNAL_EMIT "elm,action,decrement,"#_sufix",start" "";\
source: "left_bt"#_sufix;\
action: SIGNAL_EMIT "elm,action,decrement,start"#_signal_sufix "";\
}\
program { name: "dec_"#_sufix"_stop";\
signal: "mouse,up,1";\
source: "left_bt_"#_sufix;\
action: SIGNAL_EMIT "elm,action,"#_sufix",stop" ""; \
source: "left_bt"#_sufix;\
action: SIGNAL_EMIT "elm,action,stop"#_signal_sufix ""; \
}\
program {\
name: "left_bt_"#_sufix"_click";\
name: "left_bt"#_sufix"_click";\
signal: "mouse,down,1";\
source: "left_bt_"#_sufix"_over2";\
source: "left_bt"#_sufix"_over2";\
action: STATE_SET "clicked" 0.0;\
target: "left_bt_"#_sufix;\
target: "left_bt"#_sufix;\
}\
program {\
name: "left_bt_"#_sufix"_unclick";\
name: "left_bt"#_sufix"_unclick";\
signal: "mouse,up,1";\
source: "left_bt_"#_sufix"over2";\
source: "left_bt"#_sufix"over2";\
action: STATE_SET "default" 0.0;\
target: "left_bt_"#_sufix;\
target: "left_bt"#_sufix;\
}\
program {\
name: "left_bt_"#_sufix"_click2";\
name: "left_bt"#_sufix"_click2";\
signal: "mouse,down,1";\
source: "left_bt_"#_sufix"_over3";\
source: "left_bt"#_sufix"_over3";\
action: STATE_SET "clicked" 0.0;\
target: "left_bt_"#_sufix"_over3";\
target: "left_bt"#_sufix"_over3";\
}\
program {\
name: "left_bt_"#_sufix"_unclick2";\
name: "left_bt"#_sufix"_unclick2";\
signal: "mouse,up,1";\
source: "left_bt_"#_sufix"_over3";\
source: "left_bt"#_sufix"_over3";\
action: STATE_SET "default" 0.0;\
transition: DECELERATE 0.5;\
target: "left_bt_"#_sufix"_over3";\
target: "left_bt"#_sufix"_over3";\
}\
program { name: "inc_"#_sufix"_start";\
signal: "mouse,down,1";\
source: "right_bt_"#_sufix;\
action: SIGNAL_EMIT "elm,action,increment,"#_sufix",start" "";\
source: "right_bt"#_sufix;\
action: SIGNAL_EMIT "elm,action,increment,start"#_signal_sufix "";\
}\
program { name: "inc_"#_sufix"_stop";\
signal: "mouse,up,1";\
source: "right_bt_"#_sufix;\
action: SIGNAL_EMIT "elm,action,"#_sufix",stop" "";\
source: "right_bt"#_sufix;\
action: SIGNAL_EMIT "elm,action,stop"#_signal_sufix ""; \
}\
program {\
name: "right_bt_"#_sufix"_click";\
name: "right_bt"#_sufix"_click";\
signal: "mouse,down,1";\
source: "right_bt_"#_sufix"_over2";\
source: "right_bt"#_sufix"_over2";\
action: STATE_SET "clicked" 0.0;\
target: "right_bt_"#_sufix;\
target: "right_bt"#_sufix;\
}\
program {\
name: "right_bt_"#_sufix"_unclick";\
name: "right_bt"#_sufix"_unclick";\
signal: "mouse,up,1";\
source: "right_bt_"#_sufix"_over2";\
source: "right_bt"#_sufix"_over2";\
action: STATE_SET "default" 0.0;\
target: "right_bt_"#_sufix;\
target: "right_bt"#_sufix;\
}\
program {\
name: "right_bt_"#_sufix"_click2";\
name: "right_bt"#_sufix"_click2";\
signal: "mouse,down,1";\
source: "right_bt_"#_sufix"_over3";\
source: "right_bt"#_sufix"_over3";\
action: STATE_SET "clicked" 0.0;\
target: "right_bt_"#_sufix"_over3";\
target: "right_bt"#_sufix"_over3";\
}\
program {\
name: "right_bt_"#_sufix"_unclick2";\
name: "right_bt"#_sufix"_unclick2";\
signal: "mouse,up,1";\
source: "right_bt_"#_sufix"_over3";\
source: "right_bt"#_sufix"_over3";\
action: STATE_SET "default" 0.0;\
transition: DECELERATE 0.5;\
target: "right_bt_"#_sufix"_over3";\
target: "right_bt"#_sufix"_over3";\
}\
program { name: "to_rtl_"#_sufix;\
signal: "edje,state,rtl";\
source: "edje";\
action: STATE_SET "rtl" 0.0;\
target: "left_bt_"#_sufix"_icon";\
target: "right_bt_"#_sufix"_icon";\
target: "left_bt"#_sufix"_icon";\
target: "right_bt"#_sufix"_icon";\
}\
program { name: "to_ltr_"#_sufix;\
signal: "edje,state,ltr";\
source: "edje";\
action: STATE_SET "default" 0.0;\
target: "left_bt_"#_sufix"_icon";\
target: "right_bt_"#_sufix"_icon";\
target: "left_bt"#_sufix"_icon";\
target: "right_bt"#_sufix"_icon";\
}\
}
@ -662,7 +662,7 @@ group { name: "elm/calendar/base/default";
rel1.to: "bg";
rel1.offset: 6 6;
rel2.to: "bg";
rel2.relative: 0.5 1.0;
rel2.relative: 1.0 1.0;
rel2.offset: -7 -7;
color: 255 255 255 0;
align: 0.0 0.0;
@ -683,37 +683,6 @@ group { name: "elm/calendar/base/default";
fill.smooth : 0;
}
}
part { name: "spinner-base2";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
min: 24 24;
max: 999999 24;
rel1.to_x: "spinner-base1";
rel1.to_y: "bg";
rel1.relative: 1.0 0;
rel1.offset: 6 6;
rel2.to: "bg";
rel2.offset: -7 -7;
color: 255 255 255 0;
align: 0.0 0.0;
}
}
part { name: "conf_over_spinner2";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "spinner-base2";
rel1.offset: -2 -2;
rel2.to: "spinner-base2";
rel2.offset: 2 2;
image {
normal: "shelf_inset.png";
border: 7 7 7 7;
middle: 0;
}
fill.smooth : 0;
}
}
part { name: "table-base";
type: RECT;
mouse_events: 0;
@ -768,8 +737,7 @@ group { name: "elm/calendar/base/default";
}
}
CAL_SPIN(month, spinner-base1)
CAL_SPIN(year, spinner-base2)
CAL_SPIN(,,month_text, spinner-base1)
CH(0) CH(1) CH(2) CH(3) CH(4) CH(5) CH(6)
CIT(0) CIT(1) CIT(2) CIT(3) CIT(4) CIT(5) CIT(6)
@ -781,6 +749,79 @@ group { name: "elm/calendar/base/default";
}
}
group { name: "elm/calendar/base/double_spinners";
inherit: "elm/calendar/base/default";
parts {
part { name: "spinner-base1";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
min: 24 24;
max: 999999 24;
rel1.to: "bg";
rel1.offset: 6 6;
rel2.to: "bg";
rel2.relative: 0.5 1.0;
rel2.offset: -7 -7;
color: 255 255 255 0;
align: 0.0 0.0;
}
}
part { name: "conf_over_spinner1";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "spinner-base1";
rel1.offset: -3 -3;
rel2.to: "spinner-base1";
rel2.offset: 2 2;
image {
normal: "shelf_inset.png";
border: 7 7 7 7;
middle: 0;
}
fill.smooth : 0;
}
}
part { name: "spinner-base2";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
min: 24 24;
max: 999999 24;
rel1.to_x: "spinner-base1";
rel1.to_y: "bg";
rel1.relative: 1.0 0;
rel1.offset: 6 6;
rel2.to: "bg";
rel2.offset: -7 -7;
color: 255 255 255 0;
align: 0.0 0.0;
}
}
part { name: "conf_over_spinner2";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "spinner-base2";
rel1.offset: -2 -2;
rel2.to: "spinner-base2";
rel2.offset: 2 2;
image {
normal: "shelf_inset.png";
border: 7 7 7 7;
middle: 0;
}
fill.smooth : 0;
}
}
CAL_SPIN(,,month_text, spinner-base1)
CAL_SPIN(_year, year, year_text, spinner-base2)
}
}
#undef CAL_SPIN
#undef CIT
#undef CH

View File

@ -351,6 +351,7 @@ test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
elm_entry_editable_set(en, EINA_FALSE);
cal = elm_calendar_add(win);
elm_object_style_set(cal, "double_spinners");
elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND);
elm_calendar_selectable_set(cal,

View File

@ -205,21 +205,28 @@ _set_month_year(Elm_Calendar_Smart_Data *sd)
{
char *buf;
buf = _format_month(&sd->shown_time);
if (buf)
{
elm_layout_text_set(sd->obj, "text_month", buf);
free(buf);
}
else elm_layout_text_set(sd->obj, "text_month", "");
if (sd->double_spinners) /* theme has spinner for year */
{
buf = _format_year(&sd->shown_time);
if (buf)
{
elm_layout_text_set(sd->obj, "year_text", buf);
free(buf);
}
else elm_layout_text_set(sd->obj, "year_text", "");
buf = _format_month(&sd->shown_time);
}
else
buf = sd->format_func(&sd->shown_time);
buf = _format_year(&sd->shown_time);
if (buf)
{
elm_layout_text_set(sd->obj, "text_year", buf);
elm_layout_text_set(sd->obj, "month_text", buf);
free(buf);
}
else elm_layout_text_set(sd->obj, "text_year", "");
else elm_layout_text_set(sd->obj, "month_text", "");
}
static char *
@ -281,7 +288,7 @@ _access_calendar_spinner_register(Evas_Object *obj)
ELM_CALENDAR_DATA_GET(obj, sd);
sd->dec_btn_month_access = _elm_access_edje_object_part_object_register
(obj, elm_layout_edje_get(obj), "left_bt_month");
(obj, elm_layout_edje_get(obj), "left_bt");
ai = _elm_access_object_get(sd->dec_btn_month_access);
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar decrement month button"));
@ -291,7 +298,7 @@ _access_calendar_spinner_register(Evas_Object *obj)
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar decrement year button"));
sd->inc_btn_month_access = _elm_access_edje_object_part_object_register
(obj, elm_layout_edje_get(obj), "right_bt_month");
(obj, elm_layout_edje_get(obj), "right_bt");
ai = _elm_access_object_get(sd->inc_btn_month_access);
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar increment month button"));
@ -306,16 +313,16 @@ _access_calendar_spinner_register(Evas_Object *obj)
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar month"));
sd->year_access = _elm_access_edje_object_part_object_register
(obj, elm_layout_edje_get(obj), "text_year");
(obj, elm_layout_edje_get(obj), "year_text");
ai = _elm_access_object_get(sd->year_access);
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar year"));
po = (Evas_Object *)edje_object_part_object_get
(elm_layout_edje_get(obj), "text_month");
(elm_layout_edje_get(obj), "month_text");
evas_object_pass_events_set(po, EINA_FALSE);
po = (Evas_Object *)edje_object_part_object_get
(elm_layout_edje_get(obj), "text_year");
(elm_layout_edje_get(obj), "year_text");
evas_object_pass_events_set(po, EINA_FALSE);
}
@ -910,6 +917,23 @@ _elm_calendar_smart_calculate(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA
elm_layout_thaw(obj);
}
static void
_style_changed(void *data,
Evas_Object *obj,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
ELM_CALENDAR_DATA_GET(data, sd);
Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
if (!strcmp("double_spinners", elm_object_style_get(sd->obj)))
sd->double_spinners = EINA_TRUE;
else
sd->double_spinners = EINA_FALSE;
_set_month_year(sd);
}
static void
_elm_calendar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
{
@ -932,26 +956,29 @@ _elm_calendar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
priv->selectable = (~(ELM_CALENDAR_SELECTABLE_NONE));
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,increment,month,start", "*",
(wd->resize_obj, "elm,action,increment,start", "*",
_button_month_inc_start, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,decrement,month,start", "*",
(wd->resize_obj, "elm,action,decrement,start", "*",
_button_month_dec_start, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,increment,year,start", "*",
(wd->resize_obj, "elm,action,increment,startyear", "*",
_button_year_inc_start, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,decrement,year,start", "*",
(wd->resize_obj, "elm,action,decrement,startyear", "*",
_button_year_dec_start, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,month,stop", "*",
(wd->resize_obj, "elm,action,stop", "*",
_button_month_stop, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,year,stop", "*",
(wd->resize_obj, "elm,action,stopyear", "*",
_button_year_stop, obj);
edje_object_signal_callback_add
(wd->resize_obj, "elm,action,selected", "*",
_day_selected, obj);
edje_object_signal_callback_add
(wd->resize_obj, "load", "*",
_style_changed, obj);
for (i = 0; i < ELM_DAY_LAST; i++)
{
@ -983,6 +1010,7 @@ _elm_calendar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_layout_theme_set(obj, "calendar", "base", elm_object_style_get(obj));
evas_object_smart_changed(obj);
// ACCESS
@ -1105,13 +1133,13 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access)
if (sd->dec_btn_month_access)
_elm_access_edje_object_part_object_unregister
(obj, elm_layout_edje_get(obj), "left_bt_month");
(obj, elm_layout_edje_get(obj), "left_bt");
if (sd->inc_btn_month_access)
_elm_access_edje_object_part_object_unregister
(obj, elm_layout_edje_get(obj), "right_bt_month");
(obj, elm_layout_edje_get(obj), "right_bt");
if (sd->month_access)
_elm_access_edje_object_part_object_unregister
(obj, elm_layout_edje_get(obj), "text_month");
(obj, elm_layout_edje_get(obj), "month_text");
if (sd->dec_btn_year_access)
_elm_access_edje_object_part_object_unregister
@ -1121,7 +1149,7 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access)
(obj, elm_layout_edje_get(obj), "right_bt_year");
if (sd->year_access)
_elm_access_edje_object_part_object_unregister
(obj, elm_layout_edje_get(obj), "text_year");
(obj, elm_layout_edje_get(obj), "year_text");
}
}
@ -1375,7 +1403,7 @@ _selected_time_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
*ret = EINA_TRUE;
}
EINA_DEPRECATED EAPI void
EAPI void
elm_calendar_format_function_set(Evas_Object *obj,
Elm_Calendar_Format_Cb format_function)
{
@ -1390,6 +1418,8 @@ _format_function_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
Elm_Calendar_Smart_Data *sd = _pd;
sd->format_func = format_function;
if (sd->double_spinners) /* theme has spinner for year */
_set_month_year(sd);
}
EAPI Elm_Calendar_Mark *

View File

@ -640,7 +640,7 @@ EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj,
*
* @ingroup Calendar
*/
EINA_DEPRECATED EAPI void elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_func);
EAPI void elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_func);
/**
* Add a new mark to the calendar

View File

@ -48,6 +48,7 @@ struct _Elm_Calendar_Smart_Data
Evas_Object *year_access;
Eina_Bool selected : 1;
Elm_Calendar_Selectable selectable;
Eina_Bool double_spinners : 1;
};
struct _Elm_Calendar_Mark