Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/elementary.git] / src / lib / elm_calendar.h
index 0d0d284..cc94646 100644 (file)
@@ -4,7 +4,7 @@
  * This is a Calendar widget. Calender widget helps applications to flexibly
  * display a calender with day of the week, day, year and month. Applications will be
  * able to choose a specific date that will be reported in the smart_callbacks for
- * the calendar widget. The APIs of calendar widget let the applications perform 
+ * the calendar widget. The APIs of calendar widget let the applications perform
  * other functions like,
  * placing marks on specific dates
  * Setting the bounds for the calendar (minimum and maximum years)
  * @li elm_object_signal_callback_add
  * @li 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
  */
 
 /**
  * @{
  */
 
+typedef enum
+{
+   ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
+   ELM_CALENDAR_DAILY, /**< Marks will be displayed every day after event day (inclusive). */
+   ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
+   ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that coincides to event day. E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar*/
+   ELM_CALENDAR_ANNUALLY /**< Marks will be displayed every year that coincides to event day (and month). E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013. */
+} _Elm_Calendar_Mark_Repeat_Type;
+
 /**
- * @enum _Elm_Calendar_Mark_Repeat
- * @typedef Elm_Calendar_Mark_Repeat
+ * @enum _Elm_Calendar_Mark_Repeat_Type
+ * @typedef Elm_Calendar_Mark_Repeat_Type
  *
  * Event periodicity, used to define if a mark should be repeated
  * @b beyond event's day. It's set when a mark is added.
  *
  * @ingroup Calendar
  */
+typedef _Elm_Calendar_Mark_Repeat_Type Elm_Calendar_Mark_Repeat_Type;
+
 typedef enum
 {
-   ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */
-   ELM_CALENDAR_DAILY, /**< Marks will be displayed everyday after event day (inclusive). */
-   ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */
-   ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that coincides to event day. E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar*/
-   ELM_CALENDAR_ANNUALLY /**< Marks will be displayed every year that coincides to event day (and month). E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013. */
-} Elm_Calendar_Mark_Repeat;
-// XXX: Elm_Calendar_Mark_Repeat_Type
+   ELM_DAY_SUNDAY,
+   ELM_DAY_MONDAY,
+   ELM_DAY_TUESDAY,
+   ELM_DAY_WEDNESDAY,
+   ELM_DAY_THURSDAY,
+   ELM_DAY_FRIDAY,
+   ELM_DAY_SATURDAY,
+   ELM_DAY_LAST
+} _Elm_Calendar_Weekday;
+
+/**
+ * @enum _Elm_Calendar_Weekday
+ * @typedef Elm_Calendar_Weekday
+ *
+ * a weekday
+ *
+ * @see elm_calendar_first_day_of_week_set()
+ *
+ * @ingroup Calendar
+ */
+typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday;
 
 typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark;    /**< Item handle for a calendar mark. Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del(). */
 
 /**
+ * @typedef Elm_Calendar_Format_Cb
+ *
+ * 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 * (*Elm_Calendar_Format_Cb)(struct tm *stime);
+
+/**
  * Add a new calendar widget to the given parent Elementary
  * (container) object.
  *
@@ -239,7 +284,7 @@ EAPI Eina_Bool            elm_calendar_selected_time_get(const Evas_Object *obj,
  * month and year;
  *
  * @param obj The calendar object
- * @param format_function Function to set the month-year string given
+ * @param format_func Function to set the month-year string given
  * the selected date
  *
  * By default it uses strftime with "%B %Y" format string.
@@ -264,7 +309,7 @@ EAPI Eina_Bool            elm_calendar_selected_time_get(const Evas_Object *obj,
  *
  * @ingroup Calendar
  */
-EAPI void                 elm_calendar_format_function_set(Evas_Object *obj, char *(*format_function)(struct tm *stime));
+EAPI void                 elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_func);
 
 /**
  * Add a new mark to the calendar
@@ -315,7 +360,7 @@ EAPI void                 elm_calendar_format_function_set(Evas_Object *obj, cha
  *
  * @ingroup Calendar
  */
-EAPI Elm_Calendar_Mark   *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat repeat);
+EAPI Elm_Calendar_Mark   *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat);
 
 /**
  * Delete mark from the calendar.
@@ -423,5 +468,29 @@ EAPI void                 elm_calendar_interval_set(Evas_Object *obj, double int
 EAPI double               elm_calendar_interval_get(const Evas_Object *obj);
 
 /**
+ * Set the first day of week to use on calendar widgets'.
+ *
+ * @param obj The calendar object
+ * @param day An int which correspond to the first day of the week (Sunday = 0, monday = 1,
+ * ..., saturday = 6)
+ *
+ * @ingroup Calendar
+ */
+EAPI void                 elm_calendar_first_day_of_week_set(Evas_Object *obj, Elm_Calendar_Weekday day);
+
+/**
+ * Get the first day of week, who are used on calendar widgets'.
+ *
+ * @param obj The calendar object
+ * @return An int which correspond to the first day of the week (Sunday = 0, monday = 1,
+ * ..., saturday = 6)
+ *
+ * @see elm_calendar_first_day_of_week_set() for more details
+ *
+ * @ingroup Calendar
+ */
+EAPI Elm_Calendar_Weekday elm_calendar_first_day_of_week_get(const Evas_Object *obj);
+
+/**
  * @}
  */