-#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;\
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 {\
}\
}\
}\
- 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;\
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;\
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;\
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 {\
}\
}\
}\
- 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;\
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;\
image.normal: "sp_bt_l.png";\
}\
}\
- part { name: "text_"#_sufix;\
+ part { name: #_text;\
type: TEXT;\
mouse_events: 0;\
scale: 1;\
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;\
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";\
}\
}
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;
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;
}
}
- 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)
}
}
+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
{
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 *
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"));
_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"));
_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);
}
}
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)
{
time_t weekday = 259200; /* Just the first sunday since epoch */
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++)
{
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
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
(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");
}
}
*ret = EINA_TRUE;
}
-EINA_DEPRECATED EAPI void
+EAPI void
elm_calendar_format_function_set(Evas_Object *obj,
Elm_Calendar_Format_Cb format_function)
{
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 *