diff options
author | Seungkeun Lee <sngn.lee@samsung.com> | 2017-06-12 02:06:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2017-06-12 02:06:18 +0000 |
commit | 35938cb245eff3661b500bea2cc6e859e6dd1ef8 (patch) | |
tree | f28e2a3c782dfd11987ce89089e2e940b65a7b2f /ElmSharp/ElmSharp | |
parent | 2d64c67da19ce070590a5ad938404dfc15bd3e6f (diff) | |
parent | 489f4eb01b12d77511243c6642f1dab45f0316d2 (diff) | |
download | elm-sharp-35938cb245eff3661b500bea2cc6e859e6dd1ef8.tar.gz elm-sharp-35938cb245eff3661b500bea2cc6e859e6dd1ef8.tar.bz2 elm-sharp-35938cb245eff3661b500bea2cc6e859e6dd1ef8.zip |
Merge "Enhance Calendar Widget" into tizen
Diffstat (limited to 'ElmSharp/ElmSharp')
-rw-r--r--[-rwxr-xr-x] | ElmSharp/ElmSharp/Calendar.cs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ElmSharp/ElmSharp/Calendar.cs b/ElmSharp/ElmSharp/Calendar.cs index f6d96c2..38eace6 100755..100644 --- a/ElmSharp/ElmSharp/Calendar.cs +++ b/ElmSharp/ElmSharp/Calendar.cs @@ -30,22 +30,27 @@ namespace ElmSharp /// Default value. Marks will be displayed only on event day. /// </summary> Unique, + /// <summary> /// Marks will be displayed every day after event day. /// </summary> Daily, + /// <summary> /// Marks will be displayed every week after event day. /// </summary> Weekly, + /// <summary> /// Marks will be displayed every month day that coincides to event day. /// </summary> Monthly, + /// <summary> /// Marks will be displayed every year that coincides to event day. /// </summary> Annually, + /// <summary> /// Marks will be displayed every last day of month after event day. /// </summary> @@ -61,20 +66,32 @@ namespace ElmSharp /// Default value. a day is always selected. /// </summary> Default, + /// <summary> /// A day is always selected. /// </summary> Always, + /// <summary> /// None of the days can be selected. /// </summary> None, + /// <summary> /// User may have selected a day or not. /// </summary> OnDemand } + [Flags] + public enum CalendarSelectable + { + None = 0, + Year = 1 << 0, + Month = 1 << 1, + Day = 1 << 2 + } + /// <summary> /// The CalendarMark is a Item for marking a Calendar's type,date and repeat type. /// </summary> @@ -122,6 +139,9 @@ namespace ElmSharp SmartEvent _displayedMonthChanged; int _cacheDisplayedMonth; + Interop.Elementary.Elm_Calendar_Format_Cb _calendarFormat; + DateFormatDelegate _dateFormatDelegate = null; + /// <summary> /// Creates and initializes a new instance of the Calendar class. /// </summary> @@ -145,6 +165,8 @@ namespace ElmSharp DisplayedMonthChanged?.Invoke(this, new DisplayedMonthChangedEventArgs(_cacheDisplayedMonth, currentDisplayedMonth)); _cacheDisplayedMonth = currentDisplayedMonth; }; + + _calendarFormat = (t) => { return _dateFormatDelegate(t); }; } /// <summary> @@ -158,6 +180,13 @@ namespace ElmSharp public event EventHandler<DisplayedMonthChangedEventArgs> DisplayedMonthChanged; /// <summary> + /// This delegate type is used to format the string that will be used to display month and year. + /// </summary> + /// <param name="time">DateTime</param> + /// <returns></returns> + public delegate string DateFormatDelegate(DateTime time); + + /// <summary> /// Sets or gets the minimum for year. /// </summary> public int MinimumYear @@ -327,6 +356,46 @@ namespace ElmSharp } /// <summary> + /// Gets or sets fields of a datetime will be taken into account, when SelectedDate set is invoked. + /// </summary> + public CalendarSelectable Selectable + { + get + { + return (CalendarSelectable)Interop.Elementary.elm_calendar_selectable_get(RealHandle); + } + set + { + Interop.Elementary.elm_calendar_selectable_set(RealHandle, (int)value); + } + } + + /// <summary> + /// Gets or sets date 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. + /// </summary> + public DateFormatDelegate DateFormat + { + get + { + return _dateFormatDelegate; + } + set + { + _dateFormatDelegate = value; + if (value != null) + { + Interop.Elementary.elm_calendar_format_function_set(RealHandle, _calendarFormat); + } + else + { + Interop.Elementary.elm_calendar_format_function_set(RealHandle, null); + } + } + } + + /// <summary> /// Add a new mark to the calendar. /// </summary> /// <param name="type">A string used to define the type of mark. It will be emitted to the theme, that should display a related modification on these days representation.</param> |