App:Library:LVGL:docs:Widgets:Calendar (lv calendar)

提供: robot-jp wiki
ナビゲーションに移動検索に移動

https://docs.lvgl.io/8.2/widgets/extra/calendar.html https://docs.lvgl.io/latest/en/html/widgets/calendar.html

Calendar (lv_calendar)

Overview

英文 自動翻訳

The Calendar object is a classic calendar which can:

  • show the days of any month in a 7x7 matrix
  • Show the name of the days
  • highlight the current day (today)
  • highlight any user-defined dates


The Calendar is added to the default group (if it is set). Calendar is an editable object which allow selecting and clicking the dates with encoder navigation too.

To make the Calendar flexible, by default it doesn't show the current year or month. Instead, there are optional "headers" that can be attached to the calendar.

Calendarオブジェクトは、次のことができる従来のカレンダーです。
  • 任意の月の日付を7 x 7行列で表示する
  • 曜日名を表示する
  • 現在の日を強調表示する
  • ユーザー定義の日付を強調表示する


カレンダがデフォルト・グループに追加されます (設定されている場合) 。Calendarは、エンコーダーナビゲーションで日付を選択してクリックすることもできる編集可能なオブジェクトです。


カレンダーを柔軟にするために、既定では現在の年または月は表示されません。代わりに、カレンダーに追加できるオプションの"ヘッダー"があります。

戻る : Previous


Parts and Styles

英文 自動翻訳

The calendar object uses the Button matrix object under the hood to arrange the days into a matrix.

  • LV_PART_MAIN The background of the calendar. Uses all the background related style properties.
  • LV_PART_ITEMS Refers to the dates and day names. Button matrix control flags are set to differentiate the buttons and a custom drawer event is added modify the properties of the buttons as follows:
    • day names have no border, no background and drawn with a gray color
    • days of the previous and next month have LV_BTNMATRIX_CTRL_DISABLED flag
    • today has a thicker border with the theme's primary color
    • highlighted days have some opacity with the theme's primary color.
calendarオブジェクトは、内部的にButton matrixオブジェクトを使用して、日付をマトリックスに配置します。
  • LV_PART_MAIN カレンダーの背景。背景に関連するすべてのスタイルプロパティを使用します。
  • LV_PART_ITEMS 日付と曜日の名前を参照します。ボタンを区別するためにボタンマトリックスコントロールフラグが設定され、カスタムドロワーイベントが追加されます。ボタンのプロパティを次のように変更します。
    • 曜日名はボーダーも背景もなく、灰色で描画されます。
    • 前月と翌月の曜日はLV_BTNMATRIX_CTRL_DISABLED フラグを持つ。
    • 今日は、テーマの原色で太いボーダーが表示されます。
    • ハイライトされた日は、テーマの原色で不透明化されます。
戻る : Previous


Usage

英文 自動翻訳

Some functions use the lv_calendar_date_t type which is a structure with year, month and day fields.

いくつかの関数では、yearmonthday のフィールドを持つ構造体である lv_calendar_date_t 型を使用する。
戻る : Previous


Current date

英文 自動翻訳

To set the current date (today), use the lv_calendar_set_today_date(calendar, year, month, day) function. month needs to be in 1..12 range and day in 1..31 range.

現在の日付(今日)を設定するには、 lv_calendar_set_today_date(calendar, year, month, day)関数を使用します。

month は1〜12、day は1〜31の範囲である必要があります。

戻る : Previous


Shown date

英文 自動翻訳

To set the shown date, use lv_calendar_set_shown_date(calendar, year, month);

表示する日付を設定するには、lv_calendar_set_shown_date(calendar, year, month)を使用します。
戻る : Previous


Highlighted days

英文 自動翻訳

The list of highlighted dates should be stored in a lv_calendar_date_t array loaded by lv_calendar_set_highlighted_dates(calendar, highlighted_dates, date_num).

Only the array's pointer will be saved so the array should be a static or global variable.

ハイライトされた日付のリストは lv_calendar_set_highlighted_dates(calendar, highlighted_dates, date_num) で読み込んだ lv_calendar_date_t 配列に格納されなければなりません。

配列のポインタだけが保存されるので、配列は静的変数かグローバル変数であるべきです。

戻る : Previous


Name of the days

英文 自動翻訳

The name of the days can be adjusted with lv_calendar_set_day_names(calendar, day_names) where day_names looks like const char * day_names[7] = {"Su", "Mo", ...};

Only the pointer of the day names is saved so the elements should be static, global or constant variables.

曜日名は lv_calendar_set_day_names(calendar, day_names)で調整可能で、day_namesconst char * day_names[7] = {"Su", "Mo", ...}; のようになります。

曜日のポインタだけが保存されるので、その要素は静的変数、グローバル変数、定数変数である必要があります。

戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED Sent if a date is clicked. lv_calendar_get_pressed_date(calendar, &date) set date to the date currently being pressed.
  • Returns LV_RES_OK if there is a valid pressed date, else LV_RES_INV.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGED日付がクリックされた場合に送出されます。 lv_calendar_get_pressed_date(calendar, &date)date 付を現在押されている日付に設定する。
  • 押された有効な日付があればLV_RES_OK、なければLV_RES_INVを返す。


イベントの詳細を確認してください。

戻る : Previous


Keys

英文 自動翻訳
  • LV_KEY_RIGHT/UP/LEFT/RIGHT To navigate among the buttons to dates
  • LV_KEY_ENTER To press/release the selected date

Learn more about Keys.

  • LV_KEY_RIGHT/UP/LEFT/RIGHT ボタンで日付に移動します。
  • LV_KEY_ENTER 選択した日付を押したり離したりします。

キーの詳細を確認してください。

戻る : Previous


Headers

英文 自動翻訳

From v8.1 the header is added directly into the Calendar widget and the API of the headers has been changed.

v 8.1から、ヘッダはカレンダウィジェットに直接追加され、ヘッダのAPIが変更されました。
戻る : Previous


Arrow buttons

英文 自動翻訳

lv_calendar_header_arrow_create(calendar) creates a header that contains a left and right arrow on the sides and a text with the current year and month between them.

lv_calendar_header_arrow_create(calendar) は、左右の矢印と、その間に現在の年と月を記したテキストを含むヘッダを作成します。
戻る : Previous


Drop-down

英文 自動翻訳

lv_calendar_header_dropdown_create(calendar) creates a header that contains 2 drop-drown lists: one for the year and another for the month.

lv_calendar_header_dropdown_create(calendar) は、2つのドロップダウンリスト(年、月)を含むヘッダーを作成します。
戻る : Previous


Example

英文 自動翻訳

Calendar with header

LVGL docs example 058.png

戻る : Previous


API

英文 自動翻訳

Functions

lv_obj_t *lv_calendar_create(lv_obj_t *parent)

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_showed_date(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[], uint16_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.

uint16_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_res_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_RES_OK: there is a valid pressed date; LV_RES_INV: 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
int8_t day
1..12

struct lv_calendar_t

Public Members
lv_obj_t obj
lv_obj_t *btnm
lv_calendar_date_t today
lv_calendar_date_t showed_date
lv_calendar_date_t *highlighted_dates
uint16_t highlighted_dates_num
const char *map[8 * 7]
char nums[7 * 6][4]


Functions

lv_obj_t *lv_calendar_create(lv_obj_t *parent)

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

今日の日付を設定する
Parameters
  • obj --カレンダーオブジェクトへのポインタ
  • year -- 今日の年
  • month -- 今日の月 [1..12]
  • day --今日 [1..31]

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

現在表示されているものを設定する
Parameters
  • obj -- カレンダーオブジェクトへのポインタ
  • year -- 今日の年
  • month -- 今日の月[1...12]

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

ハイライトされた日付を設定する
Parameters
  • obj -- カレンダーオブジェクトへのポインタ
  • highlighted -- 日付を含む lv_calendar_date_t 配列へのポインタを指定します。ポインタだけが保存されるので、この変数は後で破棄されるローカル変数にはなりえません。
  • date_num -- 配列内の日付の数

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

曜日名を設定する
Parameters
  • obj -- カレンダーオブジェクトへのポインタ
  • day_names -- 名前を持つ配列へのポインタ。例: const char * days[7] = {"Sun", "Mon", ...} ポインタだけが保存されるので、この変数は後で破棄されるようなローカルなものではありえない。

lv_obj_t *lv_calendar_get_btnmatrix(const lv_obj_t *obj)

カレンダーのボタン行列オブジェクトを取得します。日付と曜日名が表示されます。
Parameters
obj -- カレンダーオブジェクトへのポインタ
Returns
ボタン行列へのポインタ

const lv_calendar_date_t *lv_calendar_get_today_date(const lv_obj_t *calendar)

今日の日付を取得する
Parameters
calendar -- カレンダーオブジェクトへのポインタ
Returns
本日の日付を格納した lv_calendar_date_t 変数へのポインタを返します。

const lv_calendar_date_t *lv_calendar_get_showed_date(const lv_obj_t *calendar)

現在表示されているものを取得
Parameters
calendar -- カレンダーオブジェクトへのポインタ
Returns
表示中の日付を格納した lv_calendar_date_t 変数へのポインタを指定します。

lv_calendar_date_t *lv_calendar_get_highlighted_dates(const lv_obj_t *calendar)

強調表示された日付を取得する
Parameters
calendar -- カレンダーオブジェクトへのポインタ
Returns
日付を含む lv_calendar_date_t 配列へのポインタを指定します。

uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t *calendar)

強調表示された日付の数を取得する
Parameters
calendar -- カレンダーオブジェクトへのポインタ
Returns
ハイライトされた日数

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

Get the currently pressed day
Parameters
  • calendar -- カレンダーオブジェクトへのポインタ
  • date -- ここに押された日付を格納する
Returns
LV_RES_OK: 押された日付がある; LV_RES_INV: 押された日付がない。

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
int8_t day
1..12

struct lv_calendar_t

Public Members
lv_obj_t obj
lv_obj_t *btnm
lv_calendar_date_t today
lv_calendar_date_t showed_date
lv_calendar_date_t *highlighted_dates
uint16_t highlighted_dates_num
const char *map[8 * 7]
char nums[7 * 6][4]


戻る : Previous