1 #ifndef _ELM_CALENDAR_EO_LEGACY_H_ 2 #define _ELM_CALENDAR_EO_LEGACY_H_ 3 4 #ifndef _ELM_CALENDAR_EO_CLASS_TYPE 5 #define _ELM_CALENDAR_EO_CLASS_TYPE 6 7 typedef Eo Elm_Calendar; 8 9 #endif 10 11 #ifndef _ELM_CALENDAR_EO_TYPES 12 #define _ELM_CALENDAR_EO_TYPES 13 14 /** 15 * @brief Event periodicity, used to define if a mark should be repeated beyond 16 * event's day. 17 * 18 * It's set when a mark is added. So, for a mark added to 13th May with 19 * periodicity set to WEEKLY, there will be marks every week after this date. 20 * Marks will be displayed at 13th, 20th, 27th, 3rd June ... 21 * 22 * Values don't work as bitmask, only one can be chosen. See also 23 * @ref elm_calendar_mark_add. 24 * 25 * @ingroup Elm_Calendar_Mark_Repeat 26 */ 27 typedef enum 28 { 29 ELM_CALENDAR_UNIQUE = 0, /**< Default value. Marks will be displayed only on 30 * event day. */ 31 ELM_CALENDAR_DAILY, /**< Marks will be displayed every day after event day 32 * (inclusive). */ 33 ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day 34 * (inclusive) - i.e. each seven days. */ 35 ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that 36 * coincides to event day. E.g.: if an event is set to 37 * 30th Jan, no marks will be displayed on Feb, but 38 * will be displayed on 30th Mar. */ 39 ELM_CALENDAR_ANNUALLY, /**< Marks will be displayed every year that coincides 40 * to event day (and month). E.g. an event added to 41 * 30th Jan 2012 will be repeated on 30th Jan 2013. */ 42 ELM_CALENDAR_LAST_DAY_OF_MONTH, /**< Marks will be displayed every last day of 43 * month after event day (inclusive). 44 * 45 * @since 1.7 */ 46 ELM_CALENDAR_REVERSE_DAILY /**< Marks will be displayed every day before event 47 * day. 48 * 49 * @since 1.19 */ 50 } Elm_Calendar_Mark_Repeat_Type; 51 52 /** 53 * @brief A weekday 54 * 55 * See also @ref elm_calendar_first_day_of_week_set. 56 * 57 * @ingroup Elm_Calendar 58 */ 59 typedef enum 60 { 61 ELM_DAY_SUNDAY = 0, /**< Sunday weekday */ 62 ELM_DAY_MONDAY, /**< Monday weekday */ 63 ELM_DAY_TUESDAY, /**< Tuesday weekday */ 64 ELM_DAY_WEDNESDAY, /**< Wednesday weekday */ 65 ELM_DAY_THURSDAY, /**< Thursday weekday */ 66 ELM_DAY_FRIDAY, /**< Friday weekday */ 67 ELM_DAY_SATURDAY, /**< Saturday weekday */ 68 ELM_DAY_LAST /**< Sentinel value to indicate last enum field during iteration 69 */ 70 } Elm_Calendar_Weekday; 71 72 /** 73 * @brief The mode, who determine how user could select a day 74 * 75 * See also @ref elm_calendar_select_mode_set() 76 * 77 * @ingroup Elm_Calendar_Select 78 */ 79 typedef enum 80 { 81 ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /**< Default value. A day is always 82 * selected. */ 83 ELM_CALENDAR_SELECT_MODE_ALWAYS, /**< A day is always selected. */ 84 ELM_CALENDAR_SELECT_MODE_NONE, /**< None of the days can be selected. */ 85 ELM_CALENDAR_SELECT_MODE_ONDEMAND /**< User may have selected a day or not. */ 86 } Elm_Calendar_Select_Mode; 87 88 /** 89 * @brief A bitmask used to define which fields of a @c tm struct will be taken 90 * into account, when elm_calendar_selected_time_set() is invoked. 91 * 92 * See also @ref elm_calendar_selectable_set, 93 * @ref elm_calendar_selected_time_set. 94 * 95 * @since 1.8 96 * 97 * @ingroup Elm_Calendar 98 */ 99 typedef enum 100 { 101 ELM_CALENDAR_SELECTABLE_NONE = 0, /**< Take no field into account */ 102 ELM_CALENDAR_SELECTABLE_YEAR = 1 /* 1 >> 0 */, /**< Take year field into 103 * account */ 104 ELM_CALENDAR_SELECTABLE_MONTH = 2 /* 1 >> 1 */, /**< Take month field into 105 * account */ 106 ELM_CALENDAR_SELECTABLE_DAY = 4 /* 1 >> 2 */ /**< Take day field into account 107 */ 108 } Elm_Calendar_Selectable; 109 110 /** Item handle for a calendar mark. Created with @ref elm_calendar_mark_add 111 * and deleted with @ref Elm.Calendar.mark_del. 112 * 113 * @ingroup Elm_Calendar 114 */ 115 typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; 116 117 118 #endif 119 120 /** 121 * @brief The first day of week to use on calendar widgets'. 122 * 123 * @param[in] obj The object. 124 * @param[in] day Weekday enum value, see @ref Elm_Calendar_Weekday 125 * 126 * @ingroup Elm_Calendar_Group 127 */ 128 EAPI void elm_calendar_first_day_of_week_set(Elm_Calendar *obj, Elm_Calendar_Weekday day); 129 130 /** 131 * @brief The first day of week to use on calendar widgets'. 132 * 133 * @param[in] obj The object. 134 * 135 * @return Weekday enum value, see @ref Elm_Calendar_Weekday 136 * 137 * @ingroup Elm_Calendar_Group 138 */ 139 EAPI Elm_Calendar_Weekday elm_calendar_first_day_of_week_get(const Elm_Calendar *obj); 140 141 /** 142 * @brief Define which fields of a tm struct will be taken into account, when 143 * Elm.Calendar.selected_time.set is invoked. 144 * 145 * By Default the bitmask is set to use all fields of a tm struct (year, month 146 * and day of the month). 147 * 148 * See also @ref elm_calendar_selected_time_set. 149 * 150 * @param[in] obj The object. 151 * @param[in] selectable A bitmask of Elm_Calendar_Selectable 152 * 153 * @since 1.8 154 * 155 * @ingroup Elm_Calendar_Group 156 */ 157 EAPI void elm_calendar_selectable_set(Elm_Calendar *obj, Elm_Calendar_Selectable selectable); 158 159 /** 160 * @brief Define which fields of a tm struct will be taken into account, when 161 * Elm.Calendar.selected_time.set is invoked. 162 * 163 * By Default the bitmask is set to use all fields of a tm struct (year, month 164 * and day of the month). 165 * 166 * See also @ref elm_calendar_selected_time_set. 167 * 168 * @param[in] obj The object. 169 * 170 * @return A bitmask of Elm_Calendar_Selectable 171 * 172 * @since 1.8 173 * 174 * @ingroup Elm_Calendar_Group 175 */ 176 EAPI Elm_Calendar_Selectable elm_calendar_selectable_get(const Elm_Calendar *obj); 177 178 /** 179 * @brief The interval on time updates for a user mouse button hold on 180 * calendar widgets' month/year selection. 181 * 182 * This interval value is decreased while the user holds the mouse pointer 183 * either selecting next or previous month/year. 184 * 185 * This helps the user to get to a given month distant from the current one 186 * easier/faster, as it will start to change quicker and quicker on mouse 187 * button holds. 188 * 189 * The calculation for the next change interval value, starting from the one 190 * set with this call, is the previous interval divided by 1.05, so it 191 * decreases a little bit. 192 * 193 * The default starting interval value for automatic changes is 0.85 seconds. 194 * 195 * @param[in] obj The object. 196 * @param[in] interval The (first) interval value in seconds 197 * 198 * @ingroup Elm_Calendar_Group 199 */ 200 EAPI void elm_calendar_interval_set(Elm_Calendar *obj, double interval); 201 202 /** 203 * @brief The interval on time updates for a user mouse button hold on 204 * calendar widgets' month/year selection. 205 * 206 * This interval value is decreased while the user holds the mouse pointer 207 * either selecting next or previous month/year. 208 * 209 * This helps the user to get to a given month distant from the current one 210 * easier/faster, as it will start to change quicker and quicker on mouse 211 * button holds. 212 * 213 * The calculation for the next change interval value, starting from the one 214 * set with this call, is the previous interval divided by 1.05, so it 215 * decreases a little bit. 216 * 217 * The default starting interval value for automatic changes is 0.85 seconds. 218 * 219 * @param[in] obj The object. 220 * 221 * @return The (first) interval value in seconds 222 * 223 * @ingroup Elm_Calendar_Group 224 */ 225 EAPI double elm_calendar_interval_get(const Elm_Calendar *obj); 226 227 /** 228 * @brief Weekdays names to be displayed by the calendar. 229 * 230 * By default, weekdays abbreviations get from system are displayed: E.g. for 231 * an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" 232 * 233 * The first string should be related to Sunday, the second to Monday... 234 * 235 * See also @ref elm_calendar_weekdays_names_get. 236 * 237 * @ref calendar_example_02. @ref calendar_example_05. 238 * 239 * @param[in] obj The object. 240 * @param[in] weekdays Array of seven strings to be used as weekday names. 241 * Warning: It must have 7 elements, or it will access invalid memory. Warning: 242 * The strings must be @c null terminated ('@\0'). 243 * 244 * @ingroup Elm_Calendar_Group 245 */ 246 EAPI void elm_calendar_weekdays_names_set(Elm_Calendar *obj, const char **weekdays); 247 248 /** 249 * @brief Weekdays names to be displayed by the calendar. 250 * 251 * By default, weekdays abbreviations get from system are displayed: E.g. for 252 * an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" 253 * 254 * The first string should be related to Sunday, the second to Monday... 255 * 256 * See also @ref elm_calendar_weekdays_names_get. 257 * 258 * @ref calendar_example_02. @ref calendar_example_05. 259 * 260 * @param[in] obj The object. 261 * 262 * @return Array of seven strings to be used as weekday names. Warning: It must 263 * have 7 elements, or it will access invalid memory. Warning: The strings must 264 * be @c null terminated ('@\0'). 265 * 266 * @ingroup Elm_Calendar_Group 267 */ 268 EAPI const char **elm_calendar_weekdays_names_get(const Elm_Calendar *obj); 269 270 /** 271 * @brief Select day mode to use. 272 * 273 * The day selection mode used. 274 * 275 * @param[in] obj The object. 276 * @param[in] mode The select mode to use. 277 * 278 * @ingroup Elm_Calendar_Group 279 */ 280 EAPI void elm_calendar_select_mode_set(Elm_Calendar *obj, Elm_Calendar_Select_Mode mode); 281 282 /** 283 * @brief Select day mode to use. 284 * 285 * The day selection mode used. 286 * 287 * @param[in] obj The object. 288 * 289 * @return The select mode to use. 290 * 291 * @ingroup Elm_Calendar_Group 292 */ 293 EAPI Elm_Calendar_Select_Mode elm_calendar_select_mode_get(const Elm_Calendar *obj); 294 295 /** 296 * @brief Set a function to format the string that will be used to display 297 * month and year; 298 * 299 * By default it uses strftime with "%B %Y" format string. It should allocate 300 * the memory that will be used by the string, that will be freed by the widget 301 * after usage. A pointer to the string and a pointer to the time struct will 302 * be provided. 303 * 304 * @ref calendar_example_02. 305 * 306 * @param[in] obj The object. 307 * @param[in] format_function Function to set the month-year string given the 308 * selected date. 309 * 310 * @ingroup Elm_Calendar_Group 311 */ 312 EAPI void elm_calendar_format_function_set(Elm_Calendar *obj, Elm_Calendar_Format_Cb format_function); 313 314 /** 315 * @brief Get a list of all the calendar marks. 316 * 317 * See also @ref elm_calendar_mark_add, @ref Elm.Calendar.mark_del(), 318 * @ref elm_calendar_marks_clear. 319 * 320 * @param[in] obj The object. 321 * 322 * @return List with all calendar marks 323 * 324 * @ingroup Elm_Calendar_Group 325 */ 326 EAPI const Eina_List *elm_calendar_marks_get(const Elm_Calendar *obj); 327 328 /** 329 * @brief Minimum date on calendar. 330 * 331 * See also @ref elm_calendar_date_max_set, @ref elm_calendar_date_max_get 332 * 333 * Set minimum date on calendar. 334 * 335 * Set the minimum date, changing the displayed month or year if needed. 336 * Displayed day also to be disabled if it is smaller than minimum date. 337 * 338 * @param[in] obj The object. 339 * @param[in] min A tm struct to point to minimum date. 340 * 341 * @since 1.19 342 * 343 * @ingroup Elm_Calendar_Group 344 */ 345 EAPI void elm_calendar_date_min_set(Elm_Calendar *obj, const Efl_Time *min); 346 347 /** 348 * @brief Minimum date on calendar. 349 * 350 * See also @ref elm_calendar_date_max_set, @ref elm_calendar_date_max_get 351 * 352 * Get minimum date. 353 * 354 * Default value is 1 JAN,1902. 355 * 356 * @param[in] obj The object. 357 * 358 * @return A tm struct to point to minimum date. 359 * 360 * @since 1.19 361 * 362 * @ingroup Elm_Calendar_Group 363 */ 364 EAPI const Efl_Time *elm_calendar_date_min_get(const Elm_Calendar *obj); 365 366 /** 367 * @brief Maximum date on calendar. 368 * 369 * See also @ref elm_calendar_date_min_set, @ref elm_calendar_date_min_get 370 * 371 * Set maximum date on calendar. 372 * 373 * Set the maximum date, changing the displayed month or year if needed. 374 * Displayed day also to be disabled if it is bigger than maximum date. 375 * 376 * @param[in] obj The object. 377 * @param[in] max A tm struct to point to maximum date. 378 * 379 * @since 1.19 380 * 381 * @ingroup Elm_Calendar_Group 382 */ 383 EAPI void elm_calendar_date_max_set(Elm_Calendar *obj, const Efl_Time *max); 384 385 /** 386 * @brief Maximum date on calendar. 387 * 388 * See also @ref elm_calendar_date_min_set, @ref elm_calendar_date_min_get 389 * 390 * Get maximum date. 391 * 392 * Default maximum year is -1. Default maximum day and month are 31 and DEC. 393 * 394 * If the maximum year is a negative value, it will be limited depending on the 395 * platform architecture (year 2037 for 32 bits); 396 * 397 * @param[in] obj The object. 398 * 399 * @return A tm struct to point to maximum date. 400 * 401 * @since 1.19 402 * 403 * @ingroup Elm_Calendar_Group 404 */ 405 EAPI const Efl_Time *elm_calendar_date_max_get(const Elm_Calendar *obj); 406 407 /** 408 * @brief Set selected date to be highlighted on calendar. 409 * 410 * Set the selected date, changing the displayed month if needed. Selected date 411 * changes when the user goes to next/previous month or select a day pressing 412 * over it on calendar. 413 * 414 * See also @ref elm_calendar_selected_time_get. 415 * 416 * @ref calendar_example_04 417 * 418 * @param[in] obj The object. 419 * @param[in] selected_time A tm struct to represent the selected date. 420 * 421 * @ingroup Elm_Calendar_Group 422 */ 423 EAPI void elm_calendar_selected_time_set(Elm_Calendar *obj, Efl_Time *selected_time); 424 425 /** 426 * @brief Get selected date. 427 * 428 * Get date selected by the user or set by function 429 * @ref elm_calendar_selected_time_set(). Selected date changes when the user 430 * goes to next/previous month or select a day pressing over it on calendar. 431 * 432 * See also @ref elm_calendar_selected_time_get. 433 * 434 * @ref calendar_example_05. 435 * 436 * @param[in] obj The object. 437 * @param[in,out] selected_time A tm struct to point to selected date. 438 * 439 * @return @c true if the method succeeded, @c false otherwise 440 * 441 * @ingroup Elm_Calendar_Group 442 */ 443 EAPI Eina_Bool elm_calendar_selected_time_get(const Elm_Calendar *obj, Efl_Time *selected_time); 444 445 /** 446 * @brief Add a new mark to the calendar 447 * 448 * Add a mark that will be drawn in the calendar respecting the insertion time 449 * and periodicity. It will emit the type as signal to the widget theme. 450 * Default theme supports "holiday" and "checked", but it can be extended. 451 * 452 * It won't immediately update the calendar, drawing the marks. For this, 453 * @ref elm_calendar_marks_draw(). However, when user selects next or previous 454 * month calendar forces marks drawn. 455 * 456 * Marks created with this method can be deleted with 457 * @ref Elm.Calendar.mark_del(). 458 * 459 * See also @ref elm_calendar_marks_draw, @ref Elm.Calendar.mark_del(). 460 * 461 * @ref calendar_example_06 462 * 463 * @param[in] obj The object. 464 * @param[in] mark_type A string used to define the type of mark. It will be 465 * emitted to the theme, that should display a related modification on these 466 * days representation. 467 * @param[in] mark_time A time struct to represent the date of inclusion of the 468 * mark. For marks that repeats it will just be displayed after the inclusion 469 * date in the calendar. 470 * @param[in] repeat Repeat the event following this periodicity. Can be a 471 * unique mark (that don't repeat), daily, weekly, monthly or annually. 472 * 473 * @return The newly added calendar mark 474 * 475 * @ingroup Elm_Calendar_Group 476 */ 477 EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Elm_Calendar *obj, const char *mark_type, Efl_Time *mark_time, Elm_Calendar_Mark_Repeat_Type repeat); 478 479 480 /** 481 * @brief Remove all calendar's marks 482 * 483 * See also @ref elm_calendar_mark_add, @ref Elm.Calendar.mark_del(). 484 * @param[in] obj The object. 485 * 486 * @ingroup Elm_Calendar_Group 487 */ 488 EAPI void elm_calendar_marks_clear(Elm_Calendar *obj); 489 490 /** 491 * @brief Draw calendar marks. 492 * 493 * Should be used after adding, removing or clearing marks. It will go through 494 * the entire marks list updating the calendar. If lots of marks will be added, 495 * add all the marks and then call this function. 496 * 497 * When the month is changed, i.e. user selects next or previous month, marks 498 * will be drawn. 499 * 500 * See also @ref elm_calendar_mark_add, @ref Elm.Calendar.mark_del(), 501 * @ref elm_calendar_marks_clear. 502 * 503 * @ref calendar_example_06 504 * @param[in] obj The object. 505 * 506 * @ingroup Elm_Calendar_Group 507 */ 508 EAPI void elm_calendar_marks_draw(Elm_Calendar *obj); 509 510 /** 511 * @brief Get the current time displayed in the widget 512 * 513 * @param[in] obj The object. 514 * @param[in,out] displayed_time A tm struct to point to displayed date. 515 * 516 * @return @c true if the method succeeded, @c false otherwise 517 * 518 * @since 1.8 519 * 520 * @ingroup Elm_Calendar_Group 521 */ 522 EAPI Eina_Bool elm_calendar_displayed_time_get(const Elm_Calendar *obj, Efl_Time *displayed_time); 523 524 #endif 525