forked from enlightenment/efl
efl_ui_calendar: create new efl_ui_calendar
Summary: This calendar widget will support basic functionality of calendar. I've separated this widget from elm_calendar since elm_calendar had lots of unuseful things inside. Reviewers: jpeg, singh.amitesh, cedric, CHAN, Jaehyun_Cho Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5346
This commit is contained in:
parent
40589a92a0
commit
9442f4687c
|
@ -748,6 +748,101 @@ group "Elm_Config" struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Calendar";
|
||||
group "key_bindings" list {
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Return";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Enter";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "space";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Check";
|
||||
group "key_bindings" list {
|
||||
|
|
|
@ -752,6 +752,101 @@ group "Elm_Config" struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Calendar";
|
||||
group "key_bindings" list {
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Return";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Enter";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "space";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Check";
|
||||
group "key_bindings" list {
|
||||
|
|
|
@ -749,6 +749,101 @@ group "Elm_Config" struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Calendar";
|
||||
group "key_bindings" list {
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Prior";
|
||||
value "action" string: "move";
|
||||
value "params" string: "prior";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Next";
|
||||
value "action" string: "move";
|
||||
value "params" string: "next";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Left";
|
||||
value "action" string: "move";
|
||||
value "params" string: "left";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Right";
|
||||
value "action" string: "move";
|
||||
value "params" string: "right";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Up";
|
||||
value "action" string: "move";
|
||||
value "params" string: "up";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Down";
|
||||
value "action" string: "move";
|
||||
value "params" string: "down";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "Return";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "KP_Enter";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
group "Elm_Config_Binding_Key" struct {
|
||||
value "context" int: 0;
|
||||
value "key" string: "space";
|
||||
value "action" string: "activate";
|
||||
value "params" string: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
group "Elm_Config_Bindings_Widget" struct {
|
||||
value "name" string: "Efl.Ui.Check";
|
||||
group "key_bindings" list {
|
||||
|
|
|
@ -108,6 +108,7 @@ src/lib/elementary/elm_box.c
|
|||
src/lib/elementary/elm_bubble.c
|
||||
src/lib/elementary/efl_ui_button.c
|
||||
src/lib/elementary/elm_calendar.c
|
||||
src/lib/elementary/efl_ui_calendar.c
|
||||
src/lib/elementary/efl_ui_check.c
|
||||
src/lib/elementary/elm_clock.c
|
||||
src/lib/elementary/elm_cnp.c
|
||||
|
|
|
@ -7,6 +7,7 @@ elm_public_eolian_files = \
|
|||
lib/elementary/efl_ui_bg.eo \
|
||||
lib/elementary/efl_ui_button.eo \
|
||||
lib/elementary/elm_calendar.eo \
|
||||
lib/elementary/efl_ui_calendar.eo \
|
||||
lib/elementary/efl_ui_check.eo \
|
||||
lib/elementary/elm_clock.eo \
|
||||
lib/elementary/elm_colorselector.eo \
|
||||
|
@ -247,6 +248,7 @@ includesunstable_HEADERS = \
|
|||
lib/elementary/efl_ui_button_private.h \
|
||||
lib/elementary/efl_ui_bg_private.h \
|
||||
lib/elementary/elm_widget_calendar.h \
|
||||
lib/elementary/efl_ui_calendar_private.h \
|
||||
lib/elementary/efl_ui_check_private.h \
|
||||
lib/elementary/elm_widget_clock.h \
|
||||
lib/elementary/elm_widget_colorselector.h \
|
||||
|
@ -370,6 +372,8 @@ includesub_HEADERS = \
|
|||
lib/elementary/elm_calendar_eo.h \
|
||||
lib/elementary/elm_calendar_legacy.h \
|
||||
lib/elementary/elm_calendar_common.h \
|
||||
lib/elementary/efl_ui_calendar.h \
|
||||
lib/elementary/efl_ui_calendar_common.h \
|
||||
lib/elementary/elm_check.h \
|
||||
lib/elementary/efl_ui_check_eo.h \
|
||||
lib/elementary/elm_check_legacy.h \
|
||||
|
@ -584,6 +588,7 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/elm_bubble.c \
|
||||
lib/elementary/efl_ui_button.c \
|
||||
lib/elementary/elm_calendar.c \
|
||||
lib/elementary/efl_ui_calendar.c \
|
||||
lib/elementary/efl_ui_check.c \
|
||||
lib/elementary/elm_clock.c \
|
||||
lib/elementary/elm_cnp.c \
|
||||
|
|
|
@ -200,6 +200,7 @@ void test_panes_minsize(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_calendar(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_calendar2(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_calendar3(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_efl_ui_calendar(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_map(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_weather(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flip(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -1002,6 +1003,7 @@ add_tests:
|
|||
ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
|
||||
ADD_TEST(NULL, "Times & Dates", "Calendar 2", test_calendar2);
|
||||
ADD_TEST(NULL, "Times & Dates", "Calendar 3", test_calendar3);
|
||||
ADD_TEST(NULL, "Times & Dates", "Efl Ui Calendar", test_efl_ui_calendar);
|
||||
ADD_TEST(NULL, "Times & Dates", "Clock", test_clock);
|
||||
ADD_TEST(NULL, "Times & Dates", "Clock Edit", test_clock_edit);
|
||||
ADD_TEST(NULL, "Times & Dates", "Clock Edit 2", test_clock_edit2);
|
||||
|
|
|
@ -379,3 +379,59 @@ test_calendar3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
|
|||
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
_cal_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||
{
|
||||
struct tm selected_date;
|
||||
struct tm max_date;
|
||||
struct tm min_date;
|
||||
|
||||
selected_date = efl_ui_calendar_date_get(ev->object);
|
||||
min_date = efl_ui_calendar_date_min_get(ev->object);
|
||||
max_date = efl_ui_calendar_date_max_get(ev->object);
|
||||
printf("Selected Date is %i/%i/%i\n",
|
||||
selected_date.tm_mday,
|
||||
selected_date.tm_mon + 1,
|
||||
selected_date.tm_year + 1900);
|
||||
printf("Minimum Date is %i/%i/%i\n",
|
||||
min_date.tm_mday,
|
||||
min_date.tm_mon + 1,
|
||||
min_date.tm_year + 1900);
|
||||
printf("Max Date is %i/%i/%i\n",
|
||||
max_date.tm_mday,
|
||||
max_date.tm_mon + 1,
|
||||
max_date.tm_year + 1900);
|
||||
}
|
||||
|
||||
void
|
||||
test_efl_ui_calendar(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *win, *box;
|
||||
struct tm selected_date, min_date, max_date;
|
||||
time_t current_date;
|
||||
|
||||
current_date = time(NULL) + SEC_PER_DAY;
|
||||
localtime_r(¤t_date, &selected_date);
|
||||
current_date = time(NULL) - SEC_PER_YEAR;
|
||||
localtime_r(¤t_date, &min_date);
|
||||
current_date = time(NULL) + SEC_PER_YEAR;
|
||||
localtime_r(¤t_date, &max_date);
|
||||
|
||||
win = efl_add(EFL_UI_WIN_CLASS, NULL,
|
||||
efl_text_set(efl_added, "Efl Ui Calendar"),
|
||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||
|
||||
box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||
efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
efl_add(EFL_UI_CALENDAR_CLASS, win,
|
||||
efl_ui_calendar_date_set(efl_added, selected_date),
|
||||
efl_ui_calendar_date_min_set(efl_added, min_date),
|
||||
efl_ui_calendar_date_max_set(efl_added, max_date),
|
||||
efl_event_callback_add(efl_added, EFL_UI_CALENDAR_EVENT_CHANGED, _cal_changed_cb, NULL),
|
||||
efl_pack(box, efl_added));
|
||||
|
||||
efl_gfx_size_set(win, EINA_SIZE2D(300, 300));
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ EAPI extern Elm_Version *elm_version;
|
|||
#include <elm_button.h>
|
||||
#include <elm_cache.h>
|
||||
#include <elm_calendar.h>
|
||||
#include <efl_ui_calendar.h>
|
||||
#include <elm_check.h>
|
||||
#include <elm_clock.h>
|
||||
#include <elm_cnp.h>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,149 @@
|
|||
import efl_types;
|
||||
|
||||
type Efl_Ui_Calendar_Format_Cb: __undefined_type; [[Elementary calendar format callback type]]
|
||||
|
||||
enum Efl.Ui.Calendar.Weekday
|
||||
{
|
||||
[[A weekday
|
||||
|
||||
See also @Efl.Ui.Calendar.first_day_of_week.set.
|
||||
]]
|
||||
sunday, [[Sunday weekday]]
|
||||
monday, [[Monday weekday]]
|
||||
tuesday, [[Tusday weekday]]
|
||||
wednesday, [[Wednesday weekday]]
|
||||
thursday, [[Thursday weekday]]
|
||||
friday, [[Friday weekday]]
|
||||
saturday, [[Saturday weekday]]
|
||||
last [[Sentinel value to indicate last enum field during iteration]]
|
||||
}
|
||||
|
||||
class Efl.Ui.Calendar (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface.Atspi_Widget_Action)
|
||||
{
|
||||
[[Calendar widget
|
||||
|
||||
It helps applications to flexibly display a calendar with day of the week,
|
||||
date, year and month. Applications are able to set specific dates to be
|
||||
reported back, when selected, in the smart callbacks of the calendar widget.
|
||||
]]
|
||||
methods {
|
||||
@property first_day_of_week {
|
||||
[[The first day of week to use on calendar widgets'.]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
day: Efl.Ui.Calendar.Weekday(Efl.Ui.Calendar.Weekday.sunday); [[Weekday enum value, see @Elm.Calendar.Weekday]]
|
||||
}
|
||||
}
|
||||
@property format_function {
|
||||
set {
|
||||
[[Set a function to format the string that will be used to display
|
||||
month and year;
|
||||
|
||||
By default it uses strftime with "%B %Y" format string.
|
||||
It should allocate the memory that will be used by the string,
|
||||
that will be freed by the widget after usage.
|
||||
A pointer to the string and a pointer to the time struct will be provided.
|
||||
]]
|
||||
/* FIXME-doc
|
||||
* Example:
|
||||
* @code
|
||||
* static char
|
||||
* _format_month_year(struct tm *selected_time)
|
||||
* {
|
||||
* char buf[32];
|
||||
* if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
|
||||
* return strdup(buf);
|
||||
* }
|
||||
*
|
||||
* efl_ui_calendar_format_function_set(calendar, _format_month_year);
|
||||
* @endcode
|
||||
*/
|
||||
}
|
||||
values {
|
||||
format_function: Efl_Ui_Calendar_Format_Cb; [[Function to set the month-year string given
|
||||
the selected date.]]
|
||||
}
|
||||
}
|
||||
@property date_min {
|
||||
[[Minimum date on calendar.]]
|
||||
set {
|
||||
[[Set the minimum date on calendar.
|
||||
|
||||
Set the minimum date, changing the displayed month or year if needed.
|
||||
Displayed day also to be disabled if it is smaller than minimum date.
|
||||
If the minimum date is greater than current maximum date, the minimum
|
||||
date would be changed to the maximum date with returning $false.
|
||||
]]
|
||||
return: bool; [[$true, on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
[[Get the minimum date.
|
||||
|
||||
Default value is 1 JAN,1902.
|
||||
]]
|
||||
}
|
||||
values {
|
||||
min: Efl.Time; [[Time structure containing the minmum date.]]
|
||||
}
|
||||
}
|
||||
@property date_max {
|
||||
[[Maximum date on calendar.]]
|
||||
set {
|
||||
[[Set the maximum date on calendar.
|
||||
|
||||
Set the maximum date, changing the displayed month or year if needed.
|
||||
Displayed day also to be disabled if it is bigger than maximum date.
|
||||
If the maximum date is less than current minimum date, the maximum date
|
||||
would be changed to the minimum date with returning $false.
|
||||
]]
|
||||
return: bool; [[$true, on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
[[Get the maximum date.
|
||||
|
||||
Default maximum year is -1.
|
||||
Default maximum day and month are 31 and DEC.
|
||||
|
||||
If the maximum year is a negative value, it will be limited depending
|
||||
on the platform architecture (year 2037 for 32 bits);
|
||||
]]
|
||||
}
|
||||
values {
|
||||
max: Efl.Time; [[Time structure containing the maximum date.]]
|
||||
}
|
||||
}
|
||||
@property date {
|
||||
[[The selected date on calendar.]]
|
||||
set {
|
||||
[[Set the selected date. If the date is greater than the maximum date,
|
||||
the date would be changed to the maximum date with returning $false.
|
||||
In the opposite case with the minimum date,
|
||||
this would give the same result.
|
||||
]]
|
||||
return: bool; [[$true, on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
date: Efl.Time; [[Time structure containing the selected date.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class.constructor;
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Canvas.Group.group_calculate;
|
||||
Elm.Widget.theme_apply;
|
||||
Elm.Widget.on_access_update;
|
||||
Elm.Widget.on_focus_update;
|
||||
Elm.Widget.widget_event;
|
||||
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
|
||||
}
|
||||
events {
|
||||
changed; [[Emitted when the selected date in the calendar is changed]]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* @defgroup Elm_Calendar Calendar
|
||||
* @ingroup Elementary
|
||||
*
|
||||
* @image html calendar_inheritance_tree.png
|
||||
* @image latex calendar_inheritance_tree.eps
|
||||
*
|
||||
* This is a calendar widget. It helps applications to flexibly
|
||||
* display a calendar with day of the week, date, year and
|
||||
* month. Applications are able to set specific dates to be reported
|
||||
* back, when selected, in the smart callbacks of the calendar
|
||||
* widget. The API of this widget lets the applications perform other
|
||||
* functions, like:
|
||||
*
|
||||
* - placing marks on specific dates
|
||||
* - setting the bounds for the calendar (minimum and maximum years)
|
||||
* - setting the day names of the week (e.g. "Thu" or "Thursday")
|
||||
* - setting the year and month format.
|
||||
*
|
||||
* This widget inherits from the @ref Layout one, so that all the
|
||||
* functions acting on it also work for calendar objects.
|
||||
*
|
||||
* This widget emits the following signals, besides the ones sent from
|
||||
* @ref Layout:
|
||||
* - @c "changed" - emitted when the date in the calendar is changed.
|
||||
* - @c "display,changed" - emitted when the current month displayed in the
|
||||
* calendar is changed.
|
||||
* - @c "focused" - When the calendar has received focus. (since 1.8)
|
||||
* - @c "unfocused" - When the calendar has lost focus. (since 1.8)
|
||||
* - @c "language,changed" - the program's language changed (since 1.9)
|
||||
*
|
||||
* Supported elm_object common APIs.
|
||||
* @li @ref elm_object_signal_emit
|
||||
* @li @ref elm_object_signal_callback_add
|
||||
* @li @ref elm_object_signal_callback_del
|
||||
*
|
||||
* Here is some sample code using it:
|
||||
* @li @ref calendar_example_01
|
||||
* @li @ref calendar_example_02
|
||||
* @li @ref calendar_example_03
|
||||
* @li @ref calendar_example_04
|
||||
* @li @ref calendar_example_05
|
||||
* @li @ref calendar_example_06
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Elm_Calendar
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "efl_ui_calendar_common.h"
|
||||
#ifdef EFL_EO_API_SUPPORT
|
||||
#include "efl_ui_calendar.eo.h"
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @addtogroup Elm_Calendar
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This callback type is used to format the string that will be used
|
||||
* to display month and year.
|
||||
*
|
||||
* @param stime Struct representing time.
|
||||
* @return String representing time that will be set to calendar's text.
|
||||
*
|
||||
* @see elm_calendar_format_function_set()
|
||||
*/
|
||||
typedef char * (*Efl_Ui_Calendar_Format_Cb)(struct tm *stime);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -0,0 +1,65 @@
|
|||
#ifndef EFL_UI_CALENDAR_PRIVATE_H
|
||||
#define ELM_WIDGET_CALENDAR_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 elm-calendar-class The Elementary Calendar Class
|
||||
*
|
||||
* Elementary, besides having the @ref Calendar widget, exposes its
|
||||
* foundation -- the Elementary Calendar Class -- in order to create other
|
||||
* widgets which are a calendar with some more logic on top.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base layout smart data extended with calendar instance data.
|
||||
*/
|
||||
typedef struct _Efl_Ui_Calendar_Data Efl_Ui_Calendar_Data;
|
||||
|
||||
struct _Efl_Ui_Calendar_Data
|
||||
{
|
||||
Evas_Object *obj; // the object itself
|
||||
double interval, first_interval;
|
||||
int spin_speed;
|
||||
int today_it, selected_it, focused_it;
|
||||
Ecore_Timer *spin_month, *spin_year, *update_timer;
|
||||
Efl_Ui_Calendar_Format_Cb format_func;
|
||||
const char *weekdays[ELM_DAY_LAST];
|
||||
struct tm current_date, shown_date, date, date_min, date_max;
|
||||
Evas_Object *inc_btn_month;
|
||||
Evas_Object *dec_btn_month;
|
||||
Evas_Object *month_access;
|
||||
Evas_Object *inc_btn_year;
|
||||
Evas_Object *dec_btn_year;
|
||||
Evas_Object *year_access;
|
||||
Eo *items[42];
|
||||
|
||||
Efl_Ui_Calendar_Weekday first_week_day;
|
||||
|
||||
unsigned char first_day_it;
|
||||
|
||||
Eina_Bool selected : 1;
|
||||
Eina_Bool double_spinners : 1;
|
||||
Eina_Bool filling : 1;
|
||||
Eina_Bool weekdays_set : 1;
|
||||
Eina_Bool month_repeated : 1;
|
||||
Eina_Bool year_repeated : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define EFL_UI_CALENDAR_DATA_GET(o, sd) \
|
||||
Efl_Ui_Calendar_Data * sd = efl_data_scope_get(o, EFL_UI_CALENDAR_CLASS)
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue