lv_calendar.h

Functions

lv_obj_t *lv_calendar_create(lv_obj_t *parent)

Create a calendar widget

Parameters:

parent – pointer to an object, it will be the parent of the new calendar

Returns:

pointer the created calendar

void lv_calendar_set_today_date(lv_obj_t *obj, uint32_t year, uint32_t month, uint32_t day)

Set the today's date

Parameters:
  • obj – pointer to a calendar object

  • year – today's year

  • month – today's month [1..12]

  • day – today's day [1..31]

void lv_calendar_set_month_shown(lv_obj_t *obj, uint32_t year, uint32_t month)

Set the currently showed

Parameters:
  • obj – pointer to a calendar object

  • year – today's year

  • month – today's month [1..12]

void lv_calendar_set_highlighted_dates(lv_obj_t *obj, lv_calendar_date_t highlighted[], size_t date_num)

Set the highlighted dates

Parameters:
  • obj – pointer to a calendar object

  • highlighted – pointer to an lv_calendar_date_t array containing the dates. Only the pointer will be saved so this variable can't be local which will be destroyed later.

  • date_num – number of dates in the array

void lv_calendar_set_day_names(lv_obj_t *obj, const char **day_names)

Set the name of the days

Parameters:
  • obj – pointer to a calendar object

  • day_names – pointer to an array with the names. E.g. const char * days[7] = {"Sun", "Mon", ...} Only the pointer will be saved so this variable can't be local which will be destroyed later.

lv_obj_t *lv_calendar_get_btnmatrix(const lv_obj_t *obj)

Get the button matrix object of the calendar. It shows the dates and day names.

Parameters:

obj – pointer to a calendar object

Returns:

pointer to a the button matrix

const lv_calendar_date_t *lv_calendar_get_today_date(const lv_obj_t *calendar)

Get the today's date

Parameters:

calendar – pointer to a calendar object

Returns:

return pointer to an lv_calendar_date_t variable containing the date of today.

const lv_calendar_date_t *lv_calendar_get_showed_date(const lv_obj_t *calendar)

Get the currently showed

Parameters:

calendar – pointer to a calendar object

Returns:

pointer to an lv_calendar_date_t variable containing the date is being shown.

lv_calendar_date_t *lv_calendar_get_highlighted_dates(const lv_obj_t *calendar)

Get the highlighted dates

Parameters:

calendar – pointer to a calendar object

Returns:

pointer to an lv_calendar_date_t array containing the dates.

size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t *calendar)

Get the number of the highlighted dates

Parameters:

calendar – pointer to a calendar object

Returns:

number of highlighted days

lv_result_t lv_calendar_get_pressed_date(const lv_obj_t *calendar, lv_calendar_date_t *date)

Get the currently pressed day

Parameters:
  • calendar – pointer to a calendar object

  • date – store the pressed date here

Returns:

LV_RESULT_OK: there is a valid pressed date LV_RESULT_INVALID: there is no pressed data

Variables

const lv_obj_class_t lv_calendar_class
struct lv_calendar_date_t
#include <lv_calendar.h>

Represents a date on the calendar object (platform-agnostic).

Public Members

uint16_t year
int8_t month

1..12

int8_t day

1..31