type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
+ visible: 0;
rel1.to: "base";
rel1.relative: 0.0 0.5;
rel2.to: "base";
color: 0 0 0 0;
}
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
}
part { name: "t";
type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
+ visible: 0;
rel1.to: "base";
rel2.to: "base";
rel2.relative: 1.0 0.5;
color: 0 0 0 0;
}
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
}
part { name: "bot0";
mouse_events: 0;
action: STATE_SET "visible" 0.0;
target: "atop";
target: "abot";
+ target: "t";
+ target: "b";
}
program { name: "edit_off";
signal: "elm,state,edit,off";
action: STATE_SET "default" 0.0;
target: "atop";
target: "abot";
+ target: "t";
+ target: "b";
}
program { name: "up";
signal: "mouse,down,1";
test_clock(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *bx, *ck;
+ unsigned int digedit;
win = elm_win_add(NULL, "clock", ELM_WIN_BASIC);
elm_win_title_set(win, "Clock");
elm_box_pack_end(bx, ck);
evas_object_show(ck);
+ ck = elm_clock_add(win);
+ elm_clock_show_seconds_set(ck, 1);
+ elm_clock_edit_set(ck, 1);
+ digedit = ELM_CLOCK_HOUR_UNIT | ELM_CLOCK_MIN_UNIT | ELM_CLOCK_SEC_UNIT;
+ elm_clock_digit_edit_set(ck, digedit);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
evas_object_show(win);
}
#endif
ELM_THUMB_ANIMATION_LAST
} Elm_Thumb_Animation_Setting;
+ typedef enum _Elm_Clock_Digedit
+ {
+ ELM_CLOCK_NONE = 0,
+ ELM_CLOCK_HOUR_DECIMAL = 1 << 0,
+ ELM_CLOCK_HOUR_UNIT = 1 << 1,
+ ELM_CLOCK_MIN_DECIMAL = 1 << 2,
+ ELM_CLOCK_MIN_UNIT = 1 << 3,
+ ELM_CLOCK_SEC_DECIMAL = 1 << 4,
+ ELM_CLOCK_SEC_UNIT = 1 << 5,
+ ELM_CLOCK_ALL = (1 << 6) - 1
+ } Elm_Clock_Digedit;
+
#ifndef ELM_LIB_QUICKLAUNCH
#define ELM_MAIN() int main(int argc, char **argv) {elm_init(argc, argv); return elm_main(argc, argv);}
#else
EAPI void elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec);
EAPI void elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit);
EAPI Eina_Bool elm_clock_edit_get(const Evas_Object *obj);
+ EAPI void elm_clock_digit_edit_set(Evas_Object *obj, unsigned int digedit);
+ EAPI unsigned int elm_clock_digit_edit_get(const Evas_Object *obj);
EAPI void elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm);
EAPI Eina_Bool elm_clock_show_am_pm_get(const Evas_Object *obj);
EAPI void elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds);
Eina_Bool seconds : 1;
Eina_Bool am_pm : 1;
Eina_Bool edit : 1;
+ unsigned int digedit;
int hrs, min, sec;
Evas_Object *digit[6];
Evas_Object *ampm;
Eina_Bool seconds : 1;
Eina_Bool am_pm : 1;
Eina_Bool edit : 1;
+ unsigned int digedit;
} cur;
};
const char *style = elm_widget_style_get(obj);
if (!wd) return;
if ((wd->cur.seconds != wd->seconds) || (wd->cur.am_pm != wd->am_pm) ||
- (wd->cur.edit != wd->edit))
+ (wd->cur.edit != wd->edit) || (wd->cur.digedit != wd->digedit))
{
int i;
Evas_Coord mw, mh;
_elm_theme_set(wd->digit[i], "clock", "flipdigit", style);
edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) *
_elm_config->scale);
- if (wd->edit)
+ if (wd->edit && (wd->digedit & (1 << i)))
edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
edje_object_signal_callback_add(wd->digit[i], "elm,action,up", "",
_signal_clock_val_up, obj);
wd->cur.seconds = wd->seconds;
wd->cur.am_pm = wd->am_pm;
wd->cur.edit = wd->edit;
+ wd->cur.digedit = wd->digedit;
}
if (wd->hrs != wd->cur.hrs)
{
wd->cur.seconds = EINA_TRUE;
wd->cur.am_pm = EINA_TRUE;
wd->cur.edit = EINA_TRUE;
+ wd->cur.digedit = ELM_CLOCK_NONE;
_time_update(obj);
_ticker(obj);
* @param edit Bool option for edited (1 = yes, 0 = no)
*
* This function sets if the clock settings can be edited or not.
+ * By default or if digit_edit option was previously set to ELM_CLOCK_NONE,
+ * all digits are editable. To choose what digits to make editable
+ * use elm_clock_digit_edit_set().
*
* @ingroup Clock
*/
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->edit = edit;
- _time_update(obj);
+ if (edit && (wd->digedit == ELM_CLOCK_NONE))
+ elm_clock_digit_edit_set(obj, ELM_CLOCK_ALL);
+ else
+ _time_update(obj);
}
/**
}
/**
+ * Set what digits of the clock are editable
+ *
+ * @param obj The clock object
+ * @param digedit Bit mask indicating the digits to edit
+ *
+ * If the digedit param is ELM_CLOCK_NONE, editing will be disabled.
+ *
+ * @ingroup Clock
+ */
+EAPI void
+elm_clock_digit_edit_set(Evas_Object *obj, Elm_Clock_Digedit digedit)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->digedit = digedit;
+ if (digedit == ELM_CLOCK_NONE)
+ elm_clock_edit_set(obj, EINA_FALSE);
+ else
+ _time_update(obj);
+}
+
+/**
+ * Get what digits of the clock are editable
+ *
+ * @param obj The clock object
+ * @return Bit mask indicating the digits.
+ *
+ * @ingroup Clock
+ */
+EAPI unsigned int
+elm_clock_digit_edit_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+ return wd->digedit;
+}
+
+/**
* Set if the clock shows hours in military or am/pm mode
*
* @param obj The clock object