App:Library:LVGL:docs:Overview:Input devices

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

https://docs.lvgl.io/8.2/overview/indev.html

Input devices

英文 自動翻訳

An input device usually means:

  • Pointer-like input device like touchpad or mouse
  • Keypads like a normal keyboard or simple numeric keypad
  • Encoders with left/right turn and push options
  • External hardware buttons which are assigned to specific points on the screen

Important
Before reading further, please read the [Porting](/porting/indev) section of Input devices

入力デバイスとは、通常、以下のようなものを指す。
  • タッチパッドやマウスなど、ポインターのような入力デバイス。
  • 通常のキーボードやテンキーのようなキーパッド
  • 左/右回転やプッシュオプションのあるエンコーダ
  • 画面上の特定のポイントに割り当てられる外部ハードウェアボタン

重要事項
この先を読む前に、入力デバイスの[移植](/porting/indev)セクションを読んでください。

戻る : Previous


Pointers

Cursor

英文 自動翻訳

Pointer input devices (like a mouse) can have a cursor.

 ...
 lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
 
 LV_IMG_DECLARE(mouse_cursor_icon);                          /*Declare the image source.*/
 lv_obj_t * cursor_obj = lv_img_create(lv_scr_act());       /*Create an image object for the cursor */
 lv_img_set_src(cursor_obj, &mouse_cursor_icon);             /*Set the image source*/
 lv_indev_set_cursor(mouse_indev, cursor_obj);               /*Connect the image  object to the driver*/

Note that the cursor object should have lv_obj_clear_flag(cursor_obj, LV_OBJ_FLAG_CLICKABLE).

For images, clicking is disabled by default.

ポインタ入力デバイス(マウスなど)は、カーソルを持つことができます。
 ...
 lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
 
 LV_IMG_DECLARE(mouse_cursor_icon);                          /*Declare the image source.*/
 lv_obj_t * cursor_obj = lv_img_create(lv_scr_act());       /*Create an image object for the cursor */
 lv_img_set_src(cursor_obj, &mouse_cursor_icon);             /*Set the image source*/
 lv_indev_set_cursor(mouse_indev, cursor_obj);               /*Connect the image  object to the driver*/

カーソルオブジェクトは lv_obj_clear_flag(cursor_obj, LV_OBJ_FLAG_CLICKABLE). を持っている必要があることに注意してください。

画像の場合、クリックはデフォルトで無効になっています。

戻る : Previous


Gestures

英文 自動翻訳

Pointer input devices can detect basic gestures.

By default, most of the widgets send the gestures to its parent, so finally the gestures can be detected on the screen object in a form of an LV_EVENT_GESTURE event.

For example:

 void my_event(lv_event_t * e)
 {
   lv_obj_t * screen = lv_event_get_current_target(e);
   lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_act());
   switch(dir) {
     case LV_DIR_LEFT:
       ...
       break;
     case LV_DIR_RIGHT:
       ...
       break;
     case LV_DIR_TOP:
       ...
       break;
     case LV_DIR_BOTTOM:
       ...
       break;
   }
 }
 
 ...
 
 lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL);

To prevent passing the gesture event to the parent from an object use lv_obj_clear_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE).

Note that, gestures are not triggered if an object is being scrolled.

ポインタ入力デバイスは、基本的なジェスチャーを検出することができます。

デフォルトでは、ほとんどのWidgetは、ジェスチャーをその親に送りますので、最終的にジェスチャーは、LV_EVENT_GESTURE イベントの形でスクリーンオブジェクト上で検出することができます。

例えば

 void my_event(lv_event_t * e)
 {
   lv_obj_t * screen = lv_event_get_current_target(e);
   lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_act());
   switch(dir) {
     case LV_DIR_LEFT:
       ...
       break;
     case LV_DIR_RIGHT:
       ...
       break;
     case LV_DIR_TOP:
       ...
       break;
     case LV_DIR_BOTTOM:
       ...
       break;
   }
 }
 
 ...
 
 lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL);

オブジェクトから親にジェスチャーイベントを渡さないようにするには、lv_obj_clear_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE).

を使用してください。

オブジェクトがスクロールされている場合、ジェスチャーはトリガーされないことに注意してください。

戻る : Previous


Keypad and encoder

英文 自動翻訳

You can fully control the user interface without a touchpad or mouse by using a keypad or encoder(s). It works similar to the TAB key on the PC to select an element in an application or a web page.

タッチパッドやマウスがなくても、キーパッドやエンコーダー(複数可)を使ってユーザーインターフェースを完全に制御することができます。PCのTABキーでアプリケーションやウェブページの要素を選択するのと同じような動作です。
戻る : Previous


Groups

英文 自動翻訳

Objects you want to control with a keypad or encoder need to be added to a Group. In every group there is exactly one focused object which receives the pressed keys or the encoder actions.

For example, if a Text area is focused and you press some letter on a keyboard, the keys will be sent and inserted into the text area.

Similarly, if a Slider is focused and you press the left or right arrows, the slider's value will be changed.


You need to associate an input device with a group.

An input device can send key events to only one group but a group can receive data from more than one input device.

To create a group use lv_group_t * g = lv_group_create() and to add an object to the group use lv_group_add_obj(g, obj).

To associate a group with an input device use lv_indev_set_group(indev, g), where indev is the return value of lv_indev_drv_register()

キーパッドやエンコーダで操作したいオブジェクトは、グループに追加する必要があります。各グループには、押されたキーやエンコーダの操作を受け取る、フォーカスされたオブジェクトが1つだけあります。

たとえば、テキストエリアにフォーカスがあり、キーボードで文字を押すと、そのキーが送信され、テキストエリアに挿入されます。

同様に、スライダーがフォーカスされていて、左または右の矢印を押すと、スライダーの値が変更されます。


入力デバイスをグループと関連付ける必要があります。

入力デバイスはキーイベントを1つのグループにしか送れませんが、グループは複数の入力デバイスからデータを受信することができます。

グループを作るには、lv_group_t * g = lv_group_create() を使い、グループにオブジェクトを追加するには lv_group_add_obj(g, obj)を使用します。


グループと入力デバイスを関連付けるには、 lv_indev_set_group(indev, g), を使用します。ここで、 indevlv_indev_drv_register()の戻り値です。

戻る : Previous


Keys

英文 自動翻訳

There are some predefined keys which have special meaning:

  • LV_KEY_NEXT Focus on the next object
  • LV_KEY_PREV Focus on the previous object
  • LV_KEY_ENTER Triggers LV_EVENT_PRESSED/CLICKED/LONG_PRESSED etc. events
  • LV_KEY_UP Increase value or move upwards
  • LV_KEY_DOWN Decrease value or move downwards
  • LV_KEY_RIGHT Increase value or move to the right
  • LV_KEY_LEFT Decrease value or move to the left
  • LV_KEY_ESC Close or exit (E.g. close a Drop down list)
  • LV_KEY_DEL Delete (E.g. a character on the right in a Text area)
  • LV_KEY_BACKSPACE Delete a character on the left (E.g. in a Text area)
  • LV_KEY_HOME Go to the beginning/top (E.g. in a Text area)
  • LV_KEY_END Go to the end (E.g. in a Text area)


The most important special keys are LV_KEY_NEXT/PREV, LV_KEY_ENTER and LV_KEY_UP/DOWN/LEFT/RIGHT.


In your read_cb function, you should translate some of your keys to these special keys to support navigation in a group and interact with selected objects.

Usually, it's enough to use only LV_KEY_LEFT/RIGHT because most objects can be fully controlled with them.

With an encoder you should use only LV_KEY_LEFT, LV_KEY_RIGHT, and LV_KEY_ENTER.

特別な意味を持つ定義済みのキーがいくつかある。
  • LV_KEY_NEXT 次のオブジェクトにフォーカスする。
  • LV_KEY_PREV 前のオブジェクトにフォーカスを当てる
  • LV_KEY_ENTERLV_EVENT_PRESSED/CLICKED/LONG_PRESSED などのイベントを発生させる
  • LV_KEY_UP 値の増加または上方向への移動
  • LV_KEY_DOWN 値を減らす、または下に移動する
  • LV_KEY_RIGHT 値を増やす、または右方向に移動する
  • LV_KEY_LEFT 値を小さくする、または左に移動する
  • LV_KEY_ESC 閉じるまたは終了 (例: ドロップダウンリストを閉じる)
  • LV_KEY_DEL 削除(テキストエリアの右側の文字など)
  • LV_KEY_BACKSPACE 左側の文字の削除 (テキストエリアでの削除など)
  • LV_KEY_HOME 先頭に戻る(テキストエリアなど)。
  • LV_KEY_END 最後に移動する(テキストエリアなど)。


最も重要な特殊キーは、LV_KEY_NEXT/PREV, LV_KEY_ENTER and LV_KEY_UP/DOWN/LEFT/RIGHTです。


read_cb 関数では、グループ内のナビゲーションをサポートし、選択されたオブジェクトと対話するために、キーの一部をこれらの特殊キーに変換する必要があります。


ほとんどのオブジェクトはこれで完全にコントロールできるため、通常は、 LV_KEY_LEFT/RIGHT だけを使用すれば十分です。


エンコーダでは、 LV_KEY_LEFT, LV_KEY_RIGHT, LV_KEY_ENTERのみを使用する必要があります。

戻る : Previous


Edit and navigate mode

英文 自動翻訳

Since a keypad has plenty of keys, it's easy to navigate between objects and edit them using the keypad.

But encoders have a limited number of "keys" and hence it is difficult to navigate using the default options.

Navigate and Edit modes are used to avoid this problem with encoders.


In Navigate mode, an encoder's LV_KEY_LEFT/RIGHT is translated to LV_KEY_NEXT/PREV.

Therefore, the next or previous object will be selected by turning the encoder.

Pressing LV_KEY_ENTER will change to Edit mode.


In Edit mode, LV_KEY_NEXT/PREV is usually used to modify an object.

Depending on the object's type, a short or long press of LV_KEY_ENTER changes back to Navigate mode.

Usually, an object which cannot be pressed (like a Slider) leaves Edit mode upon a short click.

But with objects where a short click has meaning (e.g. Button), a long press is required.

キーパッドにはたくさんのキーがあるので、キーパッドを使用してオブジェクト間を移動し、編集することは簡単です。

しかし、エンコーダは「キー」の数が限られているため、デフォルトのオプションを使用してナビゲートすることは困難です。

ナビゲートモードと編集モードは、エンコーダのこの問題を回避するために使用されます。

ナビゲートモードでは、エンコーダのLV_KEY_LEFT/RIGHTLV_KEY_NEXT/PREVに変換されます。

そのため、エンコーダを回すと、次のオブジェクトや前のオブジェクトが選択されます。

LV_KEY_ENTER を押すと、エディットモードに切り替わります。


Editモードでは、通常LV_KEY_NEXT/PREVを使用してオブジェクトを変更します。

オブジェクトの種類によっては、LV_KEY_ENTER を短押しまたは長押しすることで、ナビゲートモードに戻ります。

通常、スライダーのように押せないオブジェクトはショートクリックでEditモードになります。

しかし、ショートクリックが意味を持つオブジェクト(例:ボタン)の場合は、長押しが必要です。

戻る : Previous


Default group

英文 自動翻訳

Interactive widgets - such as buttons, checkboxes, sliders, etc. - can be automatically added to a default group.


Just create a group with lv_group_t * g = lv_group_create(); and set the default group with lv_group_set_default(g);

Don't forget to assign one or more input devices to the default group with lv_indev_set_group(my_indev, g);.

ボタン、チェックボックス、スライダーなどのインタラクティブなウィジェットを、デフォルトのグループに自動的に追加できます。- は、デフォルト・グループに自動的に追加することができます。


lv_group_t * g = lv_group_create(); でグループを作成し、lv_group_set_default(g);でデフォルト・グループを設定するだけです。


lv_indev_set_group(my_indev, g);で、デフォルトグループに1つ以上の入力デバイスを割り当てることを忘れないでください。

戻る : Previous


Styling

英文 自動翻訳

If an object is focused either by clicking it via touchpad or focused via an encoder or keypad it goes to the LV_STATE_FOCUSED state. Hence, focused styles will be applied to it.

If an object switches to edit mode it enters the LV_STATE_FOCUSED | LV_STATE_EDITED states so these style properties will be shown.

For a more detailed description read the Style section.

オブジェクトがタッチパッドでクリックされるか、エンコーダやキーパッドでフォーカスされると、 LV_STATE_FOCUSED の状態になる。

したがって、フォーカスされたスタイルが適用されます。


オブジェクトが編集モードに切り替わると、LV_STATE_FOCUSED | LV_STATE_EDITED の状態になり、これらのスタイルプロパティが表示されます。

より詳細な説明については、スタイルセクションを参照してください。

戻る : Previous


API

Input device

英文 自動翻訳

Functions

void lv_indev_read_timer_cb(lv_timer_t *timer)

Called periodically to read the input devices
Parameters
timer -- pointer to a timer to read

void lv_indev_enable(lv_indev_t *indev, bool en)

lv_indev_t *lv_indev_get_act(void)

Get the currently processed input device. Can be used in action functions too.
Returns
pointer to the currently processed input device or NULL if no input device processing right now

lv_indev_type_t lv_indev_get_type(const lv_indev_t *indev)

Get the type of an input device
Parameters
indev -- pointer to an input device
Returns
the type of the input device from lv_hal_indev_type_t (LV_INDEV_TYPE_...)

void lv_indev_reset(lv_indev_t *indev, lv_obj_t *obj)

Reset one or all input devices
Parameters
  • indev -- pointer to an input device to reset or NULL to reset all of them
  • obj -- pointer to an object which triggers the reset.

void lv_indev_reset_long_press(lv_indev_t *indev)

Reset the long press state of an input device
Parameters
indev -- pointer to an input device

void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)

Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
Parameters
  • indev -- pointer to an input device
  • cur_obj -- pointer to an object to be used as cursor

void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)

Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
Parameters
  • indev -- pointer to an input device
  • group -- point to a group

void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t points[])

Set the an array of points for LV_INDEV_TYPE_BUTTON. These points will be assigned to the buttons to press a specific point on the screen
Parameters
  • indev -- pointer to an input device
  • group -- point to a group

void lv_indev_get_point(const lv_indev_t *indev, lv_point_t *point)

Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
  • indev -- pointer to an input device
  • point -- pointer to a point to store the result

lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t *indev)

Get the current gesture direct
Parameters
indev -- pointer to an input device
Returns
current gesture direct

uint32_t lv_indev_get_key(const lv_indev_t *indev)

Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
Parameters
indev -- pointer to an input device
Returns
the last pressed key (0 on error)

lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t *indev)

Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
indev -- pointer to an input device
Returns
LV_DIR_NONE: no scrolling now LV_DIR_HOR/VER

lv_obj_t *lv_indev_get_scroll_obj(const lv_indev_t *indev)

Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
indev -- pointer to an input device
Returns
pointer to the currently scrolled object or NULL if no scrolling by this indev

void lv_indev_get_vect(const lv_indev_t *indev, lv_point_t *point)

Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
  • indev -- pointer to an input device
  • point -- pointer to a point to store the types.pointer.vector

void lv_indev_wait_release(lv_indev_t *indev)

Do nothing until the next release
Parameters
indev -- pointer to an input device

lv_obj_t *lv_indev_get_obj_act(void)

Gets a pointer to the currently active object in the currently processed input device.
Returns
pointer to currently active object or NULL if no active object

lv_timer_t *lv_indev_get_read_timer(lv_disp_t *indev)

Get a pointer to the indev read timer to modify its parameters with lv_timer_... functions.
Parameters
indev -- pointer to an input device
Returns
pointer to the indev read refresher timer. (NULL on error)

lv_obj_t *lv_indev_search_obj(lv_obj_t *obj, lv_point_t *point)

Search the most top, clickable object by a point
Parameters
  • obj -- pointer to a start object, typically the screen
  • point -- pointer to a point for searching the most top child
Returns
pointer to the found object or NULL if there was no suitable object
Functions

void lv_indev_read_timer_cb(lv_timer_t *timer)

入力デバイスを読み込むために定期的に呼び出される
Parameters
timer -- 読み込むべきタイマへのポインタ

void lv_indev_enable(lv_indev_t *indev, bool en)

lv_indev_t *lv_indev_get_act(void)

現在処理中の入力デバイスを取得する。アクション関数でも使用可能。
Returns
現在処理中の入力デバイスへのポインタ、または現在処理中の入力デバイスがない場合は NULL

lv_indev_type_t lv_indev_get_type(const lv_indev_t *indev)

入力デバイスの種類を取得する
Parameters
indev -- 入力デバイスへのポインタ
Returns
lv_hal_indev_type_t からの入力デバイスのタイプ。(LV_INDEV_TYPE_...)

void lv_indev_reset(lv_indev_t *indev, lv_obj_t *obj)

1つまたはすべての入力デバイスをリセットする
Parameters
  • indev -- リセットする入力デバイスへのポインタ,またはすべてをリセットする場合はNULLを指定します.
  • obj -- リセットのトリガーとなるオブジェクトへのポインタを指定します。

void lv_indev_reset_long_press(lv_indev_t *indev)

入力デバイスの長押し状態のリセット
Parameters
indev -- 入力デバイスへのポインタ

void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)

ポインタ入力デバイスにカーソルを設定する(for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
Parameters
  • indev -- 入力デバイスへのポインタ
  • cur_obj -- カーソルとして使用するオブジェクトへのポインタ

void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)

キーパッド入力デバイスのデスティネーショングループを設定する (for LV_INDEV_TYPE_KEYPAD)
Parameters
  • indev -- 入力デバイスへのポインタ
  • group -- グループを指す

void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t points[])

LV_INDEV_TYPE_BUTTONのポイントの配列を設定する。これらのポイントは、画面上の特定のポイントを押すためのボタンに割り当てられます
Parameters
  • indev -- 入力デバイスへのポインタ
  • group -- グループを指す

void lv_indev_get_point(const lv_indev_t *indev, lv_point_t *point)

入力デバイスの最終点を取得する (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
  • indev -- 入力デバイスへのポインタ
  • point -- 結果を格納するポイントへのポインタ

lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t *indev)

現在のジェスチャーを直接取得する
Parameters
indev -- 入力デバイスへのポインタ
Returns
カレントジェスチャーダイレクト

uint32_t lv_indev_get_key(const lv_indev_t *indev)

入力デバイスの最後に押されたキーを取得する (for LV_INDEV_TYPE_KEYPAD)
Parameters
indev -- 入力デバイスへのポインタ
Returns
最後に押したキー (0 on error)

lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t *indev)

入力デバイスの現在のスクロール方向を確認する (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
indev -- 入力デバイスへのポインタ
Returns
LV_DIR_NONE: 今はスクロールしない LV_DIR_HOR/VER

lv_obj_t *lv_indev_get_scroll_obj(const lv_indev_t *indev)

現在スクロールされているオブジェクトを取得します (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
indev -- 入力デバイスへのポインタ
Returns
現在スクロールされているオブジェクトへのポインタ。このindevによるスクロールがない場合はNULL

void lv_indev_get_vect(const lv_indev_t *indev, lv_point_t *point)

入力デバイスの移動ベクトルを取得します (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
Parameters
  • indev -- 入力デバイスへのポインタ
  • point -- types.pointer.vectorを格納するポイントへのポインタ

void lv_indev_wait_release(lv_indev_t *indev)

次のリリースまで何もしない
Parameters
indev -- 入力デバイスへのポインタ

lv_obj_t *lv_indev_get_obj_act(void)

現在処理されている入力デバイスで現在アクティブなオブジェクトへのポインタを取得します。
Returns
現在アクティブなオブジェクトへのポインタ。アクティブなオブジェクトがない場合はNULL

lv_timer_t *lv_indev_get_read_timer(lv_disp_t *indev)

indev読み取りタイマーへのポインターを取得して、 lv_timer_... 関数でパラメーターを変更します。
Parameters
indev -- 入力デバイスへのポインタ
Returns
indev読み取りリフレッシャータイマーへのポインター。 (エラーの場合はNULL)

lv_obj_t *lv_indev_search_obj(lv_obj_t *obj, lv_point_t *point)

一番上にあるクリック可能なオブジェクトをポイントで検索します
Parameters
  • obj -- 開始オブジェクト、通常は画面へのポインタ
  • point -- 最上位の子を検索するためのポイントへのポインタ
Returns
見つかったオブジェクトへのポインタ。適切なオブジェクトがなかった場合はNULL
戻る : Previous


Groups

英文 自動翻訳

Typedefs

typedef uint8_t lv_key_t

typedef void (*lv_group_focus_cb_t)(struct _lv_group_t*)

typedef struct _lv_group_t lv_group_t

Groups can be used to logically hold objects so that they can be individually focused.
They are NOT for laying out objects on a screen (try layouts for that).

Enums

enum [anonymous]

Values:
enumerator LV_KEY_UP
enumerator LV_KEY_DOWN
enumerator LV_KEY_RIGHT
enumerator LV_KEY_LEFT
enumerator LV_KEY_ESC
enumerator LV_KEY_DEL
enumerator LV_KEY_BACKSPACE
enumerator LV_KEY_ENTER
enumerator LV_KEY_NEXT
enumerator LV_KEY_PREV
enumerator LV_KEY_HOME
enumerator LV_KEY_END

enum lv_group_refocus_policy_t

Values:
enumerator LV_GROUP_REFOCUS_POLICY_NEXT
enumerator LV_GROUP_REFOCUS_POLICY_PREV

Functions

void _lv_group_init(void)

Init. the group module
Remark
Internal function, do not call directly.

lv_group_t *lv_group_create(void)

Create a new object group
Returns
pointer to the new object group

void lv_group_del(lv_group_t *group)

Delete a group object
Parameters
group -- pointer to a group

void lv_group_set_default(lv_group_t *group)

Set a default group.
New object are added to this group if it's enabled in their class with add_to_def_group = true
Parameters
group -- pointer to a group (can be NULL)

lv_group_t *lv_group_get_default(void)

Get the default group
Returns
pointer to the default group

void lv_group_add_obj(lv_group_t *group, struct _lv_obj_t *obj)

Add an object to a group
Parameters
  • group -- pointer to a group
  • obj -- pointer to an object to add

void lv_group_swap_obj(struct _lv_obj_t *obj1, struct _lv_obj_t *obj2)

Swap 2 object in a group. The object must be in the same group
Parameters
  • obj1 -- pointer to an object
  • obj2 -- pointer to an other object

void lv_group_remove_obj(struct _lv_obj_t *obj)

Remove an object from its group
Parameters
obj -- pointer to an object to remove

void lv_group_remove_all_objs(lv_group_t *group)

Remove all objects from a group
Parameters
group -- pointer to a group

void lv_group_focus_obj(struct _lv_obj_t *obj)

Focus on an object (defocus the current)
Parameters
obj -- pointer to an object to focus on

void lv_group_focus_next(lv_group_t *group)

Focus the next object in a group (defocus the current)
Parameters
group -- pointer to a group

void lv_group_focus_prev(lv_group_t *group)

Focus the previous object in a group (defocus the current)
Parameters
group -- pointer to a group

void lv_group_focus_freeze(lv_group_t *group, bool en)

Do not let to change the focus from the current object
Parameters
  • group -- pointer to a group
  • en -- true: freeze, false: release freezing (normal mode)

lv_res_t lv_group_send_data(lv_group_t *group, uint32_t c)

Send a control character to the focuses object of a group
Parameters
  • group -- pointer to a group
  • c -- a character (use LV_KEY_.. to navigate)
Returns
result of focused object in group.

void lv_group_set_focus_cb(lv_group_t *group, lv_group_focus_cb_t focus_cb)

Set a function for a group which will be called when a new object is focused
Parameters
  • group -- pointer to a group
  • focus_cb -- the call back function or NULL if unused

void lv_group_set_refocus_policy(lv_group_t *group, lv_group_refocus_policy_t policy)

Set whether the next or previous item in a group is focused if the currently focused obj is deleted.
Parameters
  • group -- pointer to a group
  • policy -- new refocus policy enum

void lv_group_set_editing(lv_group_t *group, bool edit)

Manually set the current mode (edit or navigate).
Parameters
  • group -- pointer to group
  • edit -- true: edit mode; false: navigate mode

void lv_group_set_wrap(lv_group_t *group, bool en)

Set whether focus next/prev will allow wrapping from first->last or last->first object.
Parameters
  • group -- pointer to group
  • en -- true: wrapping enabled; false: wrapping disabled

struct _lv_obj_t *lv_group_get_focused(const lv_group_t *group)

Get the focused object or NULL if there isn't one
Parameters
group -- pointer to a group
Returns
pointer to the focused object

lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)

Get the focus callback function of a group
Parameters
group -- pointer to a group
Returns
the call back function or NULL if not set

bool lv_group_get_editing(const lv_group_t *group)

Get the current mode (edit or navigate).
Parameters
group -- pointer to group
Returns
true: edit mode; false: navigate mode

bool lv_group_get_wrap(lv_group_t *group)

Get whether focus next/prev will allow wrapping from first->last or last->first object.
Parameters
  • group -- pointer to group
  • en -- true: wrapping enabled; false: wrapping disabled

uint32_t lv_group_get_obj_count(lv_group_t *group)

Get the number of object in the group
Parameters
group -- pointer to a group
Returns
number of objects in the group

struct _lv_group_t

#include <lv_group.h>
Groups can be used to logically hold objects so that they can be individually focused.
They are NOT for laying out objects on a screen (try layouts for that). Public Members
lv_ll_t obj_ll
Linked list to store the objects in the group
struct _lv_obj_t **obj_focus
The object in focus
lv_group_focus_cb_t focus_cb
A function to call when a new object is focused (optional)
void *user_data
uint8_t frozen
1: can't focus to new object
uint8_t editing
1: Edit mode, 0: Navigate mode
uint8_t refocus_policy
1: Focus prev if focused on deletion. 0: Focus next if focused on deletion.
uint8_t wrap
1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end of list.
Typedefs

typedef uint8_t lv_key_t

typedef void (*lv_group_focus_cb_t)(struct _lv_group_t*)

typedef struct _lv_group_t lv_group_t

グループを使用してオブジェクトを論理的に保持し、オブジェクトを個別にフォーカスできるようにすることができます。 画面上にオブジェクトをレイアウトするためのものではありません(そのためのレイアウトを試してください)。

Enums

enum [anonymous]

Values:
enumerator LV_KEY_UP
enumerator LV_KEY_DOWN
enumerator LV_KEY_RIGHT
enumerator LV_KEY_LEFT
enumerator LV_KEY_ESC
enumerator LV_KEY_DEL
enumerator LV_KEY_BACKSPACE
enumerator LV_KEY_ENTER
enumerator LV_KEY_NEXT
enumerator LV_KEY_PREV
enumerator LV_KEY_HOME
enumerator LV_KEY_END

enum lv_group_refocus_policy_t

Values:
enumerator LV_GROUP_REFOCUS_POLICY_NEXT
enumerator LV_GROUP_REFOCUS_POLICY_PREV

Functions

void _lv_group_init(void)

初期化。 グループモジュール
Remark
内部関数。直接呼び出さないでください。

lv_group_t *lv_group_create(void)

新しいオブジェクトグループを作成します
Returns
新しいオブジェクトグループへのポインタ

void lv_group_del(lv_group_t *group)

グループオブジェクトを削除する
Parameters
group -- グループへのポインタ

void lv_group_set_default(lv_group_t *group)

デフォルトのグループを設定します。
add_to_def_group = trueのクラスで有効になっている場合、新しいオブジェクトがこのグループに追加されます
Parameters
group -- グループへのポインタ(NULLにできます)

lv_group_t *lv_group_get_default(void)

デフォルトのグループを取得する
Returns
デフォルトグループへのポインタ

void lv_group_add_obj(lv_group_t *group, struct _lv_obj_t *obj)

グループにオブジェクトを追加する
Parameters
  • group -- グループへのポインタ
  • obj -- 追加するオブジェクトへのポインタ

void lv_group_swap_obj(struct _lv_obj_t *obj1, struct _lv_obj_t *obj2)

グループ内の2つのオブジェクトを交換します。 オブジェクトは同じグループに属している必要があります
Parameters
  • obj1 -- オブジェクトへのポインタ
  • obj2 -- 他のオブジェクトへのポインタ

void lv_group_remove_obj(struct _lv_obj_t *obj)

グループからオブジェクトを削除します
Parameters
obj -- 削除するオブジェクトへのポインタ

void lv_group_remove_all_objs(lv_group_t *group)

グループからすべてのオブジェクトを削除します
Parameters
group -- グループへのポインタ

void lv_group_focus_obj(struct _lv_obj_t *obj)

オブジェクトに焦点を合わせる(現在の焦点をぼかす)
Parameters
obj -- フォーカスするオブジェクトへのポインタ

void lv_group_focus_next(lv_group_t *group)

グループ内の次のオブジェクトに焦点を合わせます(現在のオブジェクトに焦点を合わせます)
Parameters
group -- グループへのポインタ

void lv_group_focus_prev(lv_group_t *group)

グループ内の前のオブジェクトに焦点を合わせます(現在のオブジェクトに焦点を合わせます)
Parameters
group -- グループへのポインタ

void lv_group_focus_freeze(lv_group_t *group, bool en)

現在のオブジェクトからフォーカスを変更させないでください
Parameters
  • group -- グループへのポインタ
  • en -- true: フリーズ, false: フリーズを解除(通常モード)

lv_res_t lv_group_send_data(lv_group_t *group, uint32_t c)

グループのフォーカスオブジェクトに制御文字を送信します
Parameters
  • group -- グループへのポインタ
  • c -- 文字(ナビゲートするには LV_KEY_.. を使用)
Returns
グループ内のフォーカスされたオブジェクトの結果。

void lv_group_set_focus_cb(lv_group_t *group, lv_group_focus_cb_t focus_cb)

新しいオブジェクトがフォーカスされたときに呼び出されるグループの関数を設定します
Parameters
  • group -- グループへのポインタ
  • focus_cb --コールバック関数または未使用の場合はNULL

void lv_group_set_refocus_policy(lv_group_t *group, lv_group_refocus_policy_t policy)

現在フォーカスされているオブジェクトが削除された場合に、グループ内の次のアイテムと前のアイテムのどちらをフォーカスするかを設定します。
Parameters
  • group -- グループへのポインタ
  • policy -- 新しいリフォーカスポリシー列挙型

void lv_group_set_editing(lv_group_t *group, bool edit)

現在のモードを手動で設定します(編集またはナビゲート)。
Parameters
  • group -- グループへのポインタ
  • edit --true:編集モード。 false:ナビゲートモード

void lv_group_set_wrap(lv_group_t *group, bool en)

focus next/prevでfirst->lastまたはlast->firstオブジェクトからの折り返しを許可するかどうかを設定します。
Parameters
  • group -- グループへのポインタ
  • en -- true:ラッピングが有効です。 false:ラッピングが無効

struct _lv_obj_t *lv_group_get_focused(const lv_group_t *group)

フォーカスされたオブジェクトを取得するか、オブジェクトがない場合はNULLを取得します
Parameters
group -- グループへのポインタ
Returns
フォーカスされたオブジェクトへのポインタ

lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)

グループのフォーカスコールバック関数を取得します
Parameters
group -- グループへのポインタ
Returns
コールバック関数または設定されていない場合はNULL

bool lv_group_get_editing(const lv_group_t *group)

現在のモードを取得します(編集またはナビゲート)。
Parameters
group -- グループへのポインタ
Returns
true:編集モード。 false:ナビゲートモード

bool lv_group_get_wrap(lv_group_t *group)

focus next/prevがfirst->lastまたはlast->firstオブジェクトからの折り返しを許可するかどうかを取得します。
Parameters
  • group -- グループへのポインタ
  • en -- true:ラッピングが有効です。 false:ラッピングが無効

uint32_t lv_group_get_obj_count(lv_group_t *group)

Get the number of object in the group
Parameters
group -- グループへのポインタ
Returns
グループ内のオブジェクトの数

struct _lv_group_t

#include <lv_group.h>
グループを使用してオブジェクトを論理的に保持し、オブジェクトを個別にフォーカスできるようにすることができます。 画面上にオブジェクトをレイアウトするためのものではありません(そのためのレイアウトを試してください)。
Public Members
lv_ll_t obj_ll
グループ内のオブジェクトを格納するためのリンクリスト
struct _lv_obj_t **obj_focus
フォーカスされているオブジェクト
lv_group_focus_cb_t focus_cb
新しいオブジェクトがフォーカスされたときに呼び出す関数(オプション)
void *user_data
uint8_t frozen
1: 新しいオブジェクトに焦点を合わせることができません
uint8_t editing
1:編集モード、 0:ナビゲートモード
uint8_t refocus_policy
1:削除に焦点を当てている場合は、前に焦点を当てます。 0:削除に焦点を当てている場合は、次に焦点を合わせます。
uint8_t wrap
1: フォーカスnext/prevは、リストの最後で折り返すことができます。
0:フォーカスの次/前の停止はリストの最後にあります。


戻る : Previous