App:Library:LVGL:docs:Widgets:Bar (lv bar)

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

https://docs.lvgl.io/8.2/widgets/core/arc.html

Bar (lv_bar)

Overview

英文 自動翻訳

The bar object has a background and an indicator on it. The width of the indicator is set according to the current value of the bar.

Vertical bars can be created if the width of the object is smaller than its height.

Not only the end, but also the start value of the bar can be set, which changes the start position of the indicator.

バーオブジェクトには、背景とインジケーターがあります。インジケーターの幅は、バーの現在の値に応じて設定されます。

オブジェクトの幅が高さよりも小さい場合は、垂直バーを作成できます。

終了だけでなく、バ​​ーの開始値も設定でき、インジケーターの開始位置を変更します。

戻る : Previous


Parts and Styles

英文 自動翻訳
  • LV_PART_MAIN The background of the bar and it uses the typical background style properties. Adding padding makes the indicator smaller or larger. The anim_time style property sets the animation time if the values set with LV_ANIM_ON.
  • LV_PART_INDICATOR The indicator itselfalso uses all the typical background properties.
  • LV_PART_MAINバーの背景とそれは典型的な背景スタイルのプロパティを使用します。パディングを追加すると、インジケーターが小さくなったり大きくなったりします。値が。で設定されている場合、anim_timestyleプロパティはアニメーション時間を設定しLV_ANIM_ONます。
  • LV_PART_INDICATORインジケーター自体も、すべての一般的な背景プロパティを使用します。
戻る : Previous


Usage

Value and range

英文 自動翻訳

A new value can be set by lv_bar_set_value(bar, new_value, LV_ANIM_ON/OFF).

The value is interpreted in a range (minimum and maximum values) which can be modified with lv_bar_set_range(bar, min, max).

The default range is 0..100.

The new value in lv_bar_set_value can be set with or without an animation depending on the last parameter (LV_ANIM_ON/OFF).

lv_bar_set_value(bar, new_value, LV_ANIM_ON/OFF)で新しい値を設定できます。

値は、lv_bar_set_range(bar, min, max)で変更できる範囲(最小値と最大値)で解釈されます。

デフォルトの範囲は0..100です。

lv_bar_set_valueの新しい値は、最後のパラメータ(LV_ANIM_ON/OFF)に応じて、アニメーションの有無にかかわらず設定できます

戻る : Previous


Modes

英文 自動翻訳

The bar can be one of the following modes:

  • LV_BAR_MODE_NORMAL A normal bar as described above
  • LV_BAR_MODE_SYMMETRICAL Draw the indicator from the zero value to current value. Requires a negative minimum range and positive maximum range.
  • LV_BAR_MODE_RANGE Allows setting the start value too by lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF). The start value always has to be smaller than the end value.


バーは、次のいずれかのモードになります。

  • LV_BAR_MODE_NORMAL上記の通常のバー
  • LV_BAR_MODE_SYMMETRICALインジケーターをゼロ値から現在の値まで描画します。負の最小範囲と正の最大範囲が必要です。
  • LV_BAR_MODE_RANGEで開始値も設定できますlv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)。開始値は常に終了値よりも小さくする必要があります。
戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END are sent for the following parts:
    • LV_BAR_DRAW_PART_INDICATOR The indicator of the bar
      • part: LV_PART_INDICATOR
      • draw_area: area of the indicator
      • rect_dsc

See the events of the Base object too.

Learn more about Events.

  • LV_EVENT_DRAW_PART_BEGINバーオブジェクトには、背景とインジケーターがあります。インジケーターの幅は、バーの現在の値に応じて設定されます。LV_EVENT_DRAW_PART_END次の部分に送信されます 。
    • LV_BAR_DRAW_PART_INDICATORバーのインジケーター
      • part: LV_PART_INDICATOR
      • draw_area:インジケーターの面積
      • rect_dsc

Baseオブジェクトのイベントも参照してください。

イベントの詳細をご覧ください。

戻る : Previous


Keys

英文 自動翻訳

No Keys are processed by the object type.

Learn more about Keys.

オブジェクトタイプによって処理される キーはありません。

キーの詳細をご覧ください。

戻る : Previous


Example

英文 自動翻訳

Simple Bar

LVGL docs example 046.png

Styling a bar

LVGL docs example 047.png

Temperature meter

LVGL docs example 048.png

Stripe pattern and range value

LVGL docs example 049.png

Bar with LTR and RTL base direction

LVGL docs example 050.png

Custom drawer to show the current value

LVGL docs example 051.png

戻る : Previous


API

英文 自動翻訳

Typedefs

typedef uint8_t lv_bar_mode_t

Enums

enum [anonymous]

Values:
enumerator LV_BAR_MODE_NORMAL
enumerator LV_BAR_MODE_SYMMETRICAL
enumerator LV_BAR_MODE_RANGE

enum lv_bar_draw_part_type_t

type field in lv_obj_draw_part_dsc_t if class_p = lv_bar_class Used in LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END
Values:
enumerator LV_BAR_DRAW_PART_INDICATOR
The indicator

Functions

lv_obj_t *lv_bar_create(lv_obj_t *parent)

Create a bar object
Parameters
parent -- pointer to an object, it will be the parent of the new bar
Returns
pointer to the created bar

void lv_bar_set_value(lv_obj_t *obj, int32_t value, lv_anim_enable_t anim)

Set a new value on the bar
Parameters
  • bar -- pointer to a bar object
  • value -- new value
  • anim -- LV_ANIM_ON: set the value with an animationLV_ANIM_OFF: change the value immediately

void lv_bar_set_start_value(lv_obj_t *obj, int32_t start_value, lv_anim_enable_t anim)

Set a new start value on the bar
Parameters
  • obj -- pointer to a bar object
  • value -- new start value
  • anim -- LV_ANIM_ON: set the value with an animationLV_ANIM_OFF: change the value immediately

void lv_bar_set_range(lv_obj_t *obj, int32_t min, int32_t max)

Set minimum and the maximum values of a bar
Parameters
  • obj -- pointer to the bar object
  • min -- minimum value
  • max -- maximum value

void lv_bar_set_mode(lv_obj_t *obj, lv_bar_mode_t mode)

Set the type of bar.
Parameters
  • obj -- pointer to bar object
  • mode -- bar type from ::lv_bar_mode_t

int32_t lv_bar_get_value(const lv_obj_t *obj)

Get the value of a bar
Parameters
obj -- pointer to a bar object
Returns
the value of the bar

int32_t lv_bar_get_start_value(const lv_obj_t *obj)

Get the start value of a bar
Parameters
obj -- pointer to a bar object
Returns
the start value of the bar

int32_t lv_bar_get_min_value(const lv_obj_t *obj)

Get the minimum value of a bar
Parameters
obj -- pointer to a bar object
Returns
the minimum value of the bar

int32_t lv_bar_get_max_value(const lv_obj_t *obj)

Get the maximum value of a bar
Parameters
obj -- pointer to a bar object
Returns
the maximum value of the bar

lv_bar_mode_t lv_bar_get_mode(lv_obj_t *obj)

Get the type of bar.
Parameters
obj -- pointer to bar object
Returns
bar type from ::lv_bar_mode_t

Variables

const lv_obj_class_t lv_bar_class

struct _lv_bar_anim_t

Public Members
lv_obj_t *bar
int32_t anim_start
int32_t anim_end
int32_t anim_state

struct lv_bar_t

Public Members
lv_obj_t obj
int32_t cur_value
Current value of the bar
int32_t min_value
Minimum value of the bar
int32_t max_value
Maximum value of the bar
int32_t start_value
Start value of the bar
lv_area_t indic_area
Save the indicator area. Might be used by derived types
_lv_bar_anim_t cur_value_anim
_lv_bar_anim_t start_value_anim
lv_bar_mode_t mode
Type of bar


Typedef

typedef uint8_t lv_bar_mode_t

列挙型

列挙型[匿名]

値:
列挙子LV_BAR_MODE_NORMAL
列挙子LV_BAR_MODE_SYMMETRICAL
列挙子LV_BAR_MODE_RANGE

列挙型lv_bar_draw_part_type_t

typeおよびで使用されるlv_obj_draw_part_dsc_t場合のフィールドclass_p = lv_bar_classバーオブジェクトには、背景とインジケーターがあります。インジケーターの幅は、バーの現在の値に応じて設定されます。LV_EVENT_DRAW_PART_BEGINバーオブジェクトには、背景とインジケーターがあります。インジケーターの幅は、バーの現在の値に応じて設定されます。LV_EVENT_DRAW_PART_END
値:
列挙子LV_BAR_DRAW_PART_INDICATOR
インジケーター

機能

lv_obj_t * lv_bar_create( lv_obj_t * parent)

バーオブジェクトを作成する
パラメーター
parent-オブジェクトへのポインタ。新しいバーの親になります
戻り値
作成されたバーへのポインタ

void lv_bar_set_value(lv_obj_t * obj、int32_t value、lv_anim_enable_t anim)

バーに新しい値を設定します
パラメーター
  • bar-バーオブジェクトへのポインタ
  • -新しい値
  • anim -LV_ANIM_ON:animationで値を設定LV_ANIM_OFF:すぐに値を変更

void lv_bar_set_start_value(lv_obj_t * obj、int32_t start_value、lv_anim_enable_t anim)

バーに新しい開始値を設定します
パラメーター
  • obj-バーオブジェクトへのポインタ
  • -新しい開始値
  • anim -LV_ANIM_ON:animationで値を設定LV_ANIM_OFF:すぐに値を変更

void lv_bar_set_range(lv_obj_t * obj、int32_t min、int32_t max)

バーの最小値と最大値を設定します
パラメーター
  • obj-バーオブジェクトへのポインタ
  • min-最小
  • max-最大値

void lv_bar_set_mode(lv_obj_t * obj、lv_bar_mode_t mode)

バーの種類を設定します。
パラメーター
  • obj-バーオブジェクトへのポインタ
  • モード-::lv_bar_mode_tからのバータイプ

int32_t lv_bar_get_value(const lv_obj_t * obj)

バーの値を取得する
パラメーター
obj-バーオブジェクトへのポインタ
戻り値
バーの値

int32_t lv_bar_get_start_value(const lv_obj_t * obj)

バーの開始値を取得します
パラメーター
obj-バーオブジェクトへのポインタ
戻り値
バーの開始値

int32_t lv_bar_get_min_value(const lv_obj_t * obj)

バーの最小値を取得する
パラメーター
obj-バーオブジェクトへのポインタ
戻り値
バーの最小値

int32_t lv_bar_get_max_value(const lv_obj_t * obj)

バーの最大値を取得する
パラメーター
obj-バーオブジェクトへのポインタ
戻り値
バーの最大値

lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj)

バーの種類を取得します。
パラメーター
obj-バーオブジェクトへのポインタ
戻り値
::lv_bar_mode_tからのバータイプ

変数

const lv_obj_class_t lv_bar_class

struct _lv_bar_anim_t

パブリックメンバー
lv_obj_t * bar
int32_t anim_start
int32_t anim_end
int32_t anim_state

struct lv_bar_t

パブリックメンバー
lv_obj_t obj
int32_t cur_value
バーの現在の値
int32_t min_value
バーの最小値
int32_t max_value
バーの最大値
int32_t start_value
バーの開始値
lv_area_t indic_area
インジケータ領域を保存します。派生型で使用される可能性があります
_lv_bar_anim_t cur_value_anim
_lv_bar_anim_t start_value_anim
lv_bar_mode_tモード
バーの種類


戻る : Previous