efl_ui_clock: Merge datetime/dayselector/clock widgets into efl_ui_clock.

Summary:
Datetime widget is module based, so datetime widget is used as base for efl_ui_clock and merged dayselector/clock features into efl_ui_clock.
Added day selection and seconds support in efl_ui_clock.
 Added clock features like auto updation of time, stop timer etc in efl_ui_clock.
 Added API to enable/disable edit_mode. efl_ui_clock can be configurable to display either only day/date/time or display any two of them or display all three.
Added efl_ui_clock.c and test_ui_clock.c. Theme and Module is added in another patch by Amitesh.

Original author is Yeshwanth <r.yeshwanth@samsung.com>. I have polished this patch a bit and make it compatible with current EFL code.

Test Plan: test_ui_clock

Reviewers: bu5hm4n, tasn, yashu21985, jpeg, cedric, raster

Subscribers: CHAN, woohyun

Differential Revision: https://phab.enlightenment.org/D3938
This commit is contained in:
Amitesh Singh 2016-11-03 12:00:17 +05:30
parent b0d2e987f3
commit 0bcb0302fb
13 changed files with 1917 additions and 6 deletions

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131084;
value "config_version" int: 131085;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
@ -39,7 +39,7 @@ group "Elm_Config" struct {
value "finger_size" int: 10;
value "fps" double: 60.0;
value "theme" string: "default";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api:clock_input_ctxpopup>clock/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 0;
value "focus_highlight_enable" uchar: 0;

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131084;
value "config_version" int: 131085;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
@ -39,7 +39,7 @@ group "Elm_Config" struct {
value "finger_size" int: 40;
value "fps" double: 60.0;
value "theme" string: "default";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api:clock_input_ctxpopup>clock/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 0;
value "focus_highlight_enable" uchar: 0;

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131084;
value "config_version" int: 131085;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 0;
@ -39,7 +39,7 @@ group "Elm_Config" struct {
value "finger_size" int: 10;
value "fps" double: 60.0;
value "theme" string: "default";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api:clock_input_ctxpopup>clock/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 0;
value "focus_highlight_enable" uchar: 0;

View File

@ -121,6 +121,7 @@ elm_public_eolian_files = \
# Private classes (not exposed or shipped)
elm_private_eolian_files = \
lib/elementary/efl_ui_internal_text_interactive.eo \
lib/elementary/efl_ui_clock.eo \
$(NULL)
# Legacy classes - not part of public EO API
@ -662,6 +663,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/efl_ui_grid_static.c \
lib/elementary/efl_ui_grid_private.h \
lib/elementary/efl_ui_text.c \
lib/elementary/efl_ui_clock.c \
$(NULL)
@ -823,6 +825,7 @@ bin/elementary/test_tooltip.c \
bin/elementary/test_transit.c \
bin/elementary/test_transit_bezier.c \
bin/elementary/test_ui_box.c \
bin/elementary/test_ui_clock.c \
bin/elementary/test_ui_grid.c \
bin/elementary/test_video.c \
bin/elementary/test_weather.c \

View File

@ -125,6 +125,7 @@ test_toolbar.c \
test_tooltip.c \
test_transit.c \
test_transit_bezier.c \
test_ui_clock.c \
test_video.c \
test_weather.c \
test_web.c \

View File

@ -254,6 +254,7 @@ void test_naviframe3(void *data, Evas_Object *obj, void *event_info);
void test_naviframe_complex(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_ui_clock(void *data, Evas_Object *obj, void *event_info);
void test_popup(void *data, Evas_Object *obj, void *event_info);
void test_dayselector(void *data, Evas_Object *obj, void *event_info);
void test_image(void *data, Evas_Object *obj, void *event_info);
@ -917,6 +918,7 @@ add_tests:
ADD_TEST(NULL, "Times & Dates", "Clock Edit 2", test_clock_edit2);
ADD_TEST(NULL, "Times & Dates", "Clock Pause", test_clock_pause);
ADD_TEST(NULL, "Times & Dates", "Datetime", test_datetime);
ADD_TEST(NULL, "Times & Dates", "Ui.Clock", test_ui_clock);
//------------------------------//
ADD_TEST(NULL, "Text", "Label", test_label);

View File

@ -0,0 +1,117 @@
#ifdef HAVE_CONFIG_H
#include "elementary_config.h"
#endif
#include <Elementary.h>
/* A simple test, just displaying clock in its default format */
Evas_Object *dt1, *dt2, *dt3, *dt4;
static void
_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
printf("Clock value is changed\n");
}
static void
_bt_clicked(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
time_t t;
struct tm new_time;
t = time(NULL);
localtime_r(&t, &new_time);
new_time.tm_year = 85;
new_time.tm_mon = 9;
new_time.tm_mday = 26;
new_time.tm_hour = 9;
new_time.tm_min = 0;
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_HOUR, EINA_TRUE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_MINUTE, EINA_TRUE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_AMPM, EINA_TRUE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_SECOND, EINA_TRUE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_DAY, EINA_TRUE);
efl_ui_clock_value_set(dt1, &new_time);
elm_object_disabled_set(dt1, EINA_TRUE);
elm_object_disabled_set(obj, EINA_TRUE);
evas_object_del(dt2);
evas_object_del(dt3);
dt2 = dt3 = NULL;
}
void
test_ui_clock(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *win, *bx, *bt, *lb;
win = elm_win_util_standard_add("ui_clock", "ui_clock");
elm_win_autodel_set(win, EINA_TRUE);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
elm_box_horizontal_set(bx, EINA_FALSE);
evas_object_show(bx);
evas_object_size_hint_min_set(bx, 360, 240);
dt1 = efl_add(EFL_UI_CLOCK_CLASS, bx);
evas_object_size_hint_weight_set(dt1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(dt1, EVAS_HINT_FILL, 0.5);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_HOUR, EINA_FALSE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_MINUTE, EINA_FALSE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_AMPM, EINA_FALSE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_SECOND, EINA_FALSE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_DAY, EINA_FALSE);
efl_ui_clock_pause_set(dt1, EINA_TRUE);
elm_box_pack_end(bx, dt1);
evas_object_smart_callback_add(dt1, "changed", _changed_cb, NULL);
evas_object_show(dt1);
dt2 = efl_add(EFL_UI_CLOCK_CLASS, bx);
evas_object_size_hint_weight_set(dt2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(dt2, EVAS_HINT_FILL, 0.5);
efl_ui_clock_field_visible_set(dt2, EFL_UI_CLOCK_TYPE_YEAR, EINA_FALSE);
efl_ui_clock_field_visible_set(dt2, EFL_UI_CLOCK_TYPE_MONTH, EINA_FALSE);
efl_ui_clock_field_visible_set(dt2, EFL_UI_CLOCK_TYPE_DATE, EINA_FALSE);
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_SECOND, EINA_FALSE);
elm_box_pack_end(bx, dt2);
efl_ui_clock_pause_set(dt2, EINA_TRUE);
elm_object_disabled_set(dt2, EINA_TRUE);
evas_object_show(dt2);
dt3 = efl_add(EFL_UI_CLOCK_CLASS, bx);
evas_object_size_hint_weight_set(dt3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(dt3, EVAS_HINT_FILL, 0.5);
elm_box_pack_end(bx, dt3);
evas_object_show(dt3);
//editable
lb = efl_add(ELM_LABEL_CLASS, bx);
elm_object_text_set(lb,
"<b>Editable Clock:</b>"
);
evas_object_size_hint_weight_set(lb, 0.0, 0.0);
evas_object_size_hint_align_set(lb, 0, EVAS_HINT_FILL);
evas_object_size_hint_min_set(lb, 100, 25);
elm_box_pack_end(bx, lb);
evas_object_show(lb);
dt4 = efl_add(EFL_UI_CLOCK_CLASS, bx);
evas_object_size_hint_weight_set(dt4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(dt4, EVAS_HINT_FILL, 0.5);
efl_ui_clock_edit_mode_set(dt4, EINA_TRUE);
efl_ui_clock_pause_set(dt4, EINA_TRUE);
elm_box_pack_end(bx, dt4);
evas_object_show(dt4);
bt = elm_button_add(win);
elm_object_text_set(bt, "Back to the future...");
evas_object_smart_callback_add(bt, "clicked", _bt_clicked, NULL);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
evas_object_show(win);
}

View File

@ -263,6 +263,7 @@ EAPI extern Elm_Version *elm_version;
# include <efl_ui_text_interactive.eo.h>
# include <efl_ui_text.eo.h>
# include <efl_ui_text_editable.eo.h>
# include <efl_ui_clock.eo.h>
#endif
/* include deprecated calls last of all */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,260 @@
import efl_types;
enum Efl.Ui.Clock.Type
{
[[Identifies a clock field, The widget supports 6 fields : Year, month,
Date, Hour, Minute, AM/PM
]]
year = 0, [[Indicates Year field.]]
month = 1, [[Indicates Month field.]]
date = 2, [[Indicates Date field.]]
hour = 3, [[Indicates Hour field.]]
minute = 4, [[Indicates Minute field.]]
second = 5, [[Indicates Second field.]]
day = 6, [[Indicated Day field.]]
ampm = 7, [[Indicates AM/PM field .]]
}
class Efl.Ui.Clock (Elm.Layout)
{
methods {
@property format {
[[The current clock format.
Format is a combination of allowed
Libc date format specifiers like: "%b %d, %Y %I : %M %p".
Maximum allowed format length is 64 chars.
Format can include separators for each individual clock
field except for AM/PM field.
Each separator can be a maximum of 6 UTF-8 bytes.
Space is also taken as a separator.
These specifiers can be arranged in any order and the widget
will display the fields accordingly.
Default format is taken as per the system locale settings.
]]
/* FIXME-doc
Following are the allowed set of format specifiers for each clock field.
@b %%Y : The year as a decimal number including the century.
@b %%y : The year as a decimal number without a century (range 00 to 99).
@b %%m : The month as a decimal number (range 01 to 12).
@b %%b : The abbreviated month name according to the current locale.
@b %%B : The full month name according to the current locale.
@b %%h : The abbreviated month name according to the current locale(same as %%b).
@b %%d : The day of the month as a decimal number (range 01 to 31).
@b %%e : The day of the month as a decimal number (range 1 to 31). single
digits are preceded by a blank.
@b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
@b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
@b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
digits are preceded by a blank.
@b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
digits are preceded by a blank.
@b %%M : The minute as a decimal number (range 00 to 59).
@b %%p : Either 'AM' or 'PM' according to the given time value, or the
corresponding strings for the current locale. Noon is treated as 'PM'
and midnight as 'AM'.
@b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for
the current locale.
@b %%c : The preferred date and time representation for the current locale.
@b %%x : The preferred date representation for the current locale without the time.
@b %%X : The preferred time representation for the current locale without the date.
@b %%r : The complete calendar time using the AM/PM format of the current locale.
@b %%R : The hour and minute in decimal numbers using the format %H:%M.
@b %%T : The time of day in decimal numbers using the format %H:%M:%S.
@b %%D : The date using the format %%m/%%d/%%y.
@b %%F : The date using the format %%Y-%%m-%%d.
*/
set {} get {}
values {
fmt: const(char)* @nullable; [[The clock format.]]
}
}
@property pause {
[[Whether the given clock widget should be paused or not.
This function pauses or starts the clock widget.
]]
set {} get {}
values {
paused: bool; [[$true to pause clock, $false otherwise]]
}
}
@property edit_mode {
[[Digits of the given clock widget should be editable when in editing mode.]]
set {} get {}
values {
value: bool; [[$true to set edit mode, $false otherwise]]
}
}
@property value_min {
[[The lower boundary of a field.
Year: years since 1900. Negative value represents year below 1900
(year value -30 represents 1870). Year default range is from 70
to 137.
Month: default value range is from 0 to 11.
Date: default value range is from 1 to 31 according to the month
value.
Hour: default value will be in terms of 24 hr format (0~23)
Minute: default value range is from 0 to 59.
]]
set {
return: bool;
}
get {
return: bool;
}
keys {
mintime: Efl.Time*; [[Time structure containing the minimum time value.]]
}
}
@property value_max {
[[The upper boundary of a field.
Year: years since 1900. Negative value represents year below 1900
(year value -30 represents 1870). Year default range is from 70
to 137.
Month: default value range is from 0 to 11.
Date: default value range is from 1 to 31 according to the month
value.
Hour: default value will be in terms of 24 hr format (0~23)
Minute: default value range is from 0 to 59.
]]
set {
return: bool;
}
get {
return: bool;
}
keys {
maxtime: Efl.Time*; [[Time structure containing the minimum time value.]]
}
}
@property value {
[[The current value of a clock object.
Year: years since 1900. Negative value represents year below 1900
(year value -30 represents 1870). Year default range is from 70
to 137.
Month: default value range is from 0 to 11.
Date: default value range is from 1 to 31 according to the month
value.
Hour: default value will be in terms of 24 hr format (0~23)
Minute: default value range is from 0 to 59.
]]
set {
return: bool;
}
get {
return: bool;
}
keys {
curtime: Efl.Time*; [[Time structure containing the minimum time value.]]
}
}
@property field_visible {
[[ The field to be visible/not.]]
set{} get{}
keys {
fieldtype: Efl.Ui.Clock.Type; [[Type of the field. #EFL_UI_CLOCK_TYPE_YEAR etc.]]
}
values {
visible: bool; [[$true field can be visible, $false otherwise.]]
}
}
@property field_limit {
set {
[[Set a field to be visible or not.
Setting this API to $true does not ensure that the field is
visible, apart from this, the field's format must be present
in clock overall format. If a field's visibility is set
to $false then it won't appear even though its format is
present in overall format. So if and only if this API is
set true and the corresponding field's format is present
in clock format, the field is visible.
By default the field visibility is set to $true.
]]
}
get {
[[ Get the field limits of a field.
Limits can be set to individual fields, independently, except
for AM/PM field. Any field can display the values only in between
these minimum and maximum limits unless the corresponding time
value is restricted from MinTime to MaxTime. That is, min/max
field limits always works under the limitations of mintime/maxtime.
There is no provision to set the limits of AM/PM field.
]]
}
keys {
fieldtype: Efl.Ui.Clock.Type; [[Type of the field. #EFL_UI_CLOCK_TYPE_YEAR etc.]]
}
values {
min: int; [[Reference to field's minimum value.]]
max: int; [[Reference to field's maximum value.]]
}
}
}
implements {
class.constructor;
Efl.Object.constructor;
Efl.Canvas.Group.group_add;
Efl.Canvas.Group.group_del;
Elm.Widget.theme_apply;
Elm.Widget.focus_next_manager_is;
Elm.Widget.focus_next;
Elm.Widget.disable;
Elm.Widget.on_focus;
Elm.Widget.translate;
Elm.Layout.sizing_eval;
}
events {
changed;
}
}

View File

@ -0,0 +1,204 @@
/**
* @defgroup efl_ui_clock
* @ingroup Elementary
*
* @image html clock_inheritance_tree.png
* @image latex clock_inheritance_tree.eps
*
* @image html img/widget/clock/preview-00.png
* @image latex img/widget/clock/preview-00.eps
*
* @image html img/widget/clock/preview-01.png
* @image latex img/widget/clock/preview-01.eps
*
* @image html img/widget/clock/preview-02.png
* @image latex img/widget/clock/preview-02.eps
*
* Clock widget is used to display and input date & time values.
* This widget displays date and time as per the <b>system's locale</b> settings (Date
* includes Day, Month & Year along with the defined separators and
* Time includes Hour, Minute & AM/PM fields. Separator for AM/PM field is ignored.
*
* The corresponding Month, AM/PM strings are displayed according to the
* systems language settings.
*
* Clock format is a combination of LIBC standard characters like
* %%d %%b %%Y %%I : %%M %%p which, as a whole represents both Date as well as Time
* format.
*
* efl_ui_clock supports only the following sub set of libc date format specifiers:
*
* @b %%Y : The year as a decimal number including the century (example: 2011).
*
* @b %%y : The year as a decimal number without a century (range 00 to 99)
*
* @b %%m : The month as a decimal number (range 01 to 12).
*
* @b %%b : The abbreviated month name according to the current locale.
*
* @b %%B : The full month name according to the current locale.
*
* @b %%h : The abbreviated month name according to the current locale(same as %%b).
*
* @b %%d : The day of the month as a decimal number (range 01 to 31).
*
* @b %%e : The day of the month as a decimal number (range 1 to 31). single
* digits are preceded by a blank.
*
* @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
*
* @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
*
* @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
* digits are preceded by a blank.
*
* @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
* digits are preceded by a blank.
*
* @b %%M : The minute as a decimal number (range 00 to 59).
*
* @b %%p : Either 'AM' or 'PM' according to the given time value, or the
* corresponding strings for the current locale. Noon is treated as 'PM'
* and midnight as 'AM'
*
* @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for
* the current locale.
*
* @b %%c : The preferred date and time representation for the current locale.
*
* @b %%x : The preferred date representation for the current locale without the time.
*
* @b %%X : The preferred time representation for the current locale without the date.
*
* @b %%r : The complete calendar time using the AM/PM format of the current locale.
*
* @b %%R : The hour and minute in decimal numbers using the format %H:%M.
*
* @b %%T : The time of day in decimal numbers using the format %H:%M:%S.
*
* @b %%D : The date using the format %%m/%%d/%%y.
*
* @b %%F : The date using the format %%Y-%%m-%%d.
*
* (For more reference on the available <b>LIBC date format specifiers</b>, please
* visit the link:
* http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time )
*
* Clock widget can provide Unicode @b separators in between its fields
* except for AM/PM field.
* A separator can be any <b>Unicode character</b> other than the LIBC standard
* date format specifiers.( Example: In the format %%b %%d @b , %%y %%H @b : %%M
* comma(,) is separator for date field %%d and colon(:) is separator for
* hour field %%H ).
*
* The default format is a predefined one, based on the system Locale.
*
* Hour format 12hr(1-12) or 24hr(0-23) display can be selected by setting
* the corresponding user format.
*
* Clock supports six fields: Year, Month, Date, Hour, Minute, AM/PM.
* Depending on the Clock module that is loaded, the user can see
* different UI to select the individual field values.
*
* The individual fields of Clock can be arranged in any order according to the format
* set by application.
*
* There is a provision to set the visibility of a particular field as TRUE/ FALSE
* so that <b>only time/ only date / only required fields</b> will be displayed.
*
* Each field is having a default minimum and maximum values just like the daily
* calendar information. These min/max values can be modified as per the application usage.
*
* User can enter the values only in between the range of maximum and minimum.
* Apart from these APIs, there is a provision to display only a limited set of
* values out of the possible values. APIs to select the individual field limits
* are intended for this purpose.
*
* The whole widget is left aligned and its size grows horizontally depending
* on the current format and each field's visible/disabled state.
*
* Clock individual field selection is implemented in a modular style.
* Module can be implemented as a Ctxpopup based selection or an ISE based
* selection or even a spinner like selection etc.
*
* <b>Clock Module design:</b>
*
* The following functions are expected to be implemented in a Clock module:
*
* <b>Field creation:</b>
* <pre>
*
* __________ __________
* | |----- obj_hook() ---------------------->>>| |
* | |<<<----------------returns Mod_data ------| |
* | Clock |_______ | |
* | widget | |Assign module call backs | Module |
* | base |<<<____| | |
* | | | |
* | |----- field_create() ------------------>>>| |
* |__________|<<<----------------returns field_obj -----|__________|
*
* </pre>
*
* <b>Field value setting:</b>
* <pre>
*
* __________ __________
* | | | |
* | Clock |<<<----------efl_ui_clock_value_set()---| |
* | widget | | Module |
* | base |----display_field_value()------------>>>| |
* |__________| |__________|
*
* </pre>
*
* <b>del_hook:</b>
* <pre>
* __________ __________
* | | | |
* | Clock |----obj_unhook()-------------------->>>>| |
* | widget | | Module |
* | base | <<<-----frees mod_data---------| |
* |__________| |__________|
*
* </pre>
*
*
* Any module can use the following shared functions that are implemented in efl_ui_clock.c :
*
* <b>field_format_get()</b> - gives the field format.
*
* <b>field_limit_get()</b> - gives the field minimum, maximum limits.
*
* To enable a module, set the ELM_MODULES environment variable as shown:
*
* <b>export ELM_MODULES="clock_input_ctxpopup>clock/api"</b>
*
* This widget inherits from the @ref Layout one, so that all the
* functions acting on it also work for Clock objects.
*
* This widget emits the following signals, besides the ones sent from
* @ref Layout:
* @li @b "changed" - whenever Clock field value is changed, this
* signal is sent.
* @li @b "language,changed" - whenever system locale changes, this
* signal is sent.
* @li @c "focused" - When the Clock has received focus. (since 1.8)
* @li @c "unfocused" - When the Clock has lost focus. (since 1.8)
*
* Here is an example on its usage:
* @li @ref clock_example
*
*/
/**
* @addtogroup efl_ui_clock
* @{
*/
#ifdef EFL_EO_API_SUPPORT
#include "efl_ui_clock.eo.h"
#endif
/**
* @}
*/

View File

@ -0,0 +1,130 @@
#ifndef EFL_UI_CLOCK_PRIVATE_H
#define EFL_UI_CLOCK_PRIVATE_H
#include "Elementary.h"
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
* FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
* IT AT RUNTIME.
*/
/**
* @addtogroup Widget
* @{
*
* @section efl-ui-clock-class The Elementary Clock Class
*
* Elementary, besides having the @ref Clock widget, exposes its
* foundation -- the Elementary Clock Class -- in order to create other
* widgets which are a Clock with some more logic on top.
*/
/**
* Base layout smart data extended with Clock instance data.
*/
typedef struct _Efl_Ui_Clock_Module_Data Efl_Ui_Clock_Module_Data;
typedef struct _Efl_Ui_Clock_Data Efl_Ui_Clock_Data;
typedef struct _Clock_Field Clock_Field;
typedef struct _Clock_Mod_Api Clock_Mod_Api;
typedef struct _Format_Map Format_Map;
#define EFL_UI_CLOCK_TYPE_COUNT 8
#define EFL_UI_CLOCK_MAX_FORMAT_LEN 64
#define EFL_UI_CLOCK_MAX_FIELD_FORMAT_LEN 3
struct _Efl_Ui_Clock_Module_Data
{
Evas_Object *base;
void (*field_limit_get)(Evas_Object *obj,
Efl_Ui_Clock_Type field_type,
int *range_min,
int *range_max);
const char *(*field_format_get)(Evas_Object * obj,
Efl_Ui_Clock_Type field_type);
};
struct _Clock_Field
{
Evas_Object *item_obj;
char fmt[EFL_UI_CLOCK_MAX_FIELD_FORMAT_LEN];
Efl_Ui_Clock_Type type;
const char *separator;
int location; /* location of the field as per
* current format */
int min, max;
Eina_Bool fmt_exist : 1; /* whether field format is
* present or not */
Eina_Bool visible : 1; /* whether field can be
* visible or not */
};
struct _Clock_Mod_Api
{
Efl_Ui_Clock_Module_Data *(*obj_hook)(Evas_Object * obj);
void (*obj_unhook)(Efl_Ui_Clock_Module_Data *mdata);
void (*obj_hide)(Efl_Ui_Clock_Module_Data *mdata);
Evas_Object *(*field_create)(Efl_Ui_Clock_Module_Data * mdata,
Efl_Ui_Clock_Type ftype);
void (*field_value_display)(Efl_Ui_Clock_Module_Data
*mdata,
Evas_Object *obj);
};
struct _Efl_Ui_Clock_Data
{
/* fixed set of fields. */
Clock_Field field_list[EFL_UI_CLOCK_TYPE_COUNT];
struct tm curr_time, min_limit, max_limit;
Efl_Ui_Clock_Module_Data *mod_data;
char format[EFL_UI_CLOCK_MAX_FORMAT_LEN];
Evas_Object *access_obj;
int enabled_field_count;
Ecore_Timer *ticker;
Eina_Bool paused : 1;
Eina_Bool edit_mode : 1;
Eina_Bool user_format : 1; /* whether user set
* format or default
* format. */
Eina_Bool freeze_sizing : 1; /* freeze sizing_eval to
* reduce unnecessary sizing */
};
struct _Format_Map
{
char *fmt_char;
int def_min;
int def_max;
char *ignore_sep;
};
/**
* @}
*/
#define EFL_UI_CLOCK_DATA_GET(o, sd) \
Efl_Ui_Clock_Data * sd = efl_data_scope_get(o, EFL_UI_CLOCK_CLASS)
#define EFL_UI_CLOCK_DATA_GET_OR_RETURN(o, ptr) \
EFL_UI_CLOCK_DATA_GET(o, ptr); \
if (EINA_UNLIKELY(!ptr)) \
{ \
CRI("No widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
return; \
}
#define EFL_UI_CLOCK_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
EFL_UI_CLOCK_DATA_GET(o, ptr); \
if (EINA_UNLIKELY(!ptr)) \
{ \
CRI("No widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
return val; \
}
#define EFL_UI_CLOCK_CHECK(obj) \
if (EINA_UNLIKELY(!eo_isa((obj), EFL_UI_CLOCK_CLASS))) \
return
#endif

View File

@ -2194,6 +2194,10 @@ _config_update(void)
IFCFG(0x000a)
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
IFCFGEND
IFCFG(0x000b)
eina_stringshare_refplace(&_elm_config->modules, tcfg->modules);
IFCFGEND
/**
* Fix user config for current ELM_CONFIG_EPOCH here.
**/