「App:Library:LVGL:docs:Widgets:Base object」の版間の差分
244行目: | 244行目: | ||
オブジェクトの画面を取得するには、lv_obj_get_screen(obj) 関数を使用します。 | オブジェクトの画面を取得するには、lv_obj_get_screen(obj) 関数を使用します。 | ||
+ | |||
+ | |} | ||
+ | :[[App:Library:LVGL#Widgets|戻る : Previous]] | ||
+ | |||
+ | |||
+ | === Layers === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | There are two automatically generated layers: | ||
+ | |||
+ | * top layer | ||
+ | * system layer | ||
+ | |||
+ | |||
+ | They are independent of the screens and they will be shown on every screen. | ||
+ | |||
+ | The ''top layer'' is above every object on the screen and the ''system layer'' is above the ''top layer'' too. You can add any pop-up windows to the ''top layer'' freely. | ||
+ | |||
+ | But, the ''system layer'' is restricted to system-level things (e.g. mouse cursor will be placed here in <code>lv_indev_set_cursor()</code>). | ||
+ | |||
+ | |||
+ | The <code>lv_layer_top()</code> and <code>lv_layer_sys()</code> functions gives a pointer to the top or system layer. | ||
+ | |||
+ | |||
+ | You can bring an object to the foreground or send it to the background with <code>lv_obj_move_foreground(obj)</code> and <code>lv_obj_move_background(obj)</code>. | ||
+ | |||
+ | |||
+ | Read the Layer overview section to learn more about [[App:Library:LVGL:docs:Overview:Layers|<u>'''layers'''</u>]]. | ||
+ | |2 つの自動生成レイヤーがあります。 | ||
+ | |||
+ | * 上層 | ||
+ | * システム層 | ||
+ | |||
+ | |||
+ | それらは画面から独立しており、すべての画面に表示されます。 最上位レイヤーは画面上のすべてのオブジェクトの上にあり、システム レイヤーも最上位レイヤーの上にあります。 | ||
+ | |||
+ | 最上層に任意のポップアップ ウィンドウを自由に追加できます。 | ||
+ | |||
+ | ただし、システム レイヤーはシステム レベルのものに制限されます (たとえば、マウス カーソルは lv_indev_set_cursor() でここに配置されます)。 | ||
+ | |||
+ | |||
+ | lv_layer_top() および lv_layer_sys() 関数は、最上位層またはシステム層へのポインターを提供します。 | ||
+ | |||
+ | |||
+ | lv_obj_move_foreground(obj) と lv_obj_move_background(obj) を使用して、オブジェクトをフォアグラウンドに移動したり、バックグラウンドに移動したりできます。 | ||
+ | |||
+ | |||
+ | [[App:Library:LVGL:docs:Overview:Layers|<u>'''layers'''</u>]]の詳細については、レイヤーの概要セクションを参照してください。 | ||
|} | |} | ||
265行目: | 316行目: | ||
イベントの詳細については、 「イベントの概要」 を参照してください。 | イベントの詳細については、 「イベントの概要」 を参照してください。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL#Widgets|戻る : Previous]] | ||
+ | |||
+ | |||
+ | === Parts === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | |To set an event callback for an object, use <code>lv_obj_set_event_cb(obj, event_cb)</code>, | ||
+ | |||
+ | |||
+ | To manually send an event to an object, use <code>lv_event_send(obj, LV_EVENT_..., data)</code> | ||
+ | |||
+ | |||
+ | Read the Event overview to learn more about the events. | ||
+ | |オブジェクトのイベント コールバックを設定するには、lv_obj_set_event_cb(obj, event_cb) を使用します。 | ||
+ | |||
+ | |||
+ | イベントをオブジェクトに手動で送信するには、lv_event_send(obj, LV_EVENT_..., data) を使用します。 | ||
+ | |||
+ | |||
+ | イベントの詳細については、イベントの概要をご覧ください。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL#Widgets|戻る : Previous]] | ||
+ | |||
+ | |||
+ | === States === | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | |The widgets can have multiple parts. For example a Button has only a main part but a Slider is built from a background, an indicator and a knob. | ||
+ | |||
+ | |||
+ | The name of the parts is constructed like <code>LV_ + <TYPE> _PART_ <NAME></code>. For example <code>LV_BTN_PART_MAIN</code> or <code>LV_SLIDER_PART_KNOB</code>. The parts are usually used when styles are add to the objects. Using parts different styles can be assigned to the different parts of the objects. | ||
+ | |||
+ | |||
+ | To learn more about the parts read the related section of the Style overview. | ||
+ | |ウィジェットには複数のパーツを含めることができます。 たとえば、ボタンには主要な部分しかありませんが、スライダーは背景、インジケーター、およびノブから構築されます。 | ||
+ | |||
+ | |||
+ | パーツの名前は、LV_ + <TYPE> _PART_ <NAME> のように構成されます。 たとえば、LV_BTN_PART_MAIN または LV_SLIDER_PART_KNOB です。 パーツは通常、オブジェクトにスタイルを追加するときに使用されます。 パーツを使用すると、オブジェクトのさまざまなパーツにさまざまなスタイルを割り当てることができます。 | ||
+ | |||
+ | |||
+ | パーツの詳細については、スタイルの概要の関連セクションをお読みください。 | ||
|} | |} | ||
:[[App:Library:LVGL#Widgets|戻る : Previous]] | :[[App:Library:LVGL#Widgets|戻る : Previous]] | ||
275行目: | 372行目: | ||
|- | |- | ||
| | | | ||
− | Be sure to read the Style overview. | + | Be sure to read the Style overview first. |
+ | |||
+ | |||
+ | To add a style to an object use <code>lv_obj_add_style(obj, part, &new_style)</code> function. | ||
+ | |||
+ | The Base object use all the rectangle-like style properties. | ||
+ | |||
+ | |||
+ | To remove all styles from an object use <code>lv_obj_reset_style_list(obj, part)</code> | ||
+ | |||
+ | |||
+ | If you modify a style, which is already used by objects, in order to refresh the affected objects you can use either <code>lv_obj_refresh_style(obj)</code> on each object using it or to notify all objects with a given style use <code>lv_obj_report_style_mod(&style)</code>. | ||
+ | |||
+ | If the parameter of <code>lv_obj_report_style_mod</code> is <code>NULL</code>, all objects will be notified. | ||
+ | |最初に必ずスタイルの概要をお読みください。 | ||
+ | |||
+ | |||
+ | オブジェクトにスタイルを追加するには、lv_obj_add_style(obj, part, &new_style) 関数を使用します。 | ||
+ | |||
+ | Base オブジェクトは、すべての長方形のようなスタイル プロパティを使用します。 | ||
− | + | オブジェクトからすべてのスタイルを削除するには、lv_obj_reset_style_list(obj, part) を使用します | |
− | |||
− | |||
− | |||
− | + | オブジェクトで既に使用されているスタイルを変更する場合、影響を受けるオブジェクトを更新するには、それを使用する各オブジェクトで lv_obj_refresh_style(obj) を使用するか、指定されたスタイルを持つすべてのオブジェクトに lv_obj_report_style_mod(&style) を使用して通知します。 lv_obj_report_style_mod のパラメーターが NULL の場合、すべてのオブジェクトが通知されます。 | |
|} | |} | ||
:[[App:Library:LVGL#Widgets|戻る : Previous]] | :[[App:Library:LVGL#Widgets|戻る : Previous]] |
2022年8月31日 (水) 20:54時点における版
https://docs.lvgl.io/latest/en/html/widgets/obj.html
https://docs.lvgl.io/8.2/widgets/index.html
Base object (lv_obj)
Overview
英文 | 自動翻訳 |
---|---|
The 'Base Object' implements the basic properties of widgets on a screen, such as:
In object-oriented thinking, it is the base class from which all other objects in LVGL are inherited. This, among another things, helps reduce code duplication. The functions and functionalities of Base object can be used with other widgets too. For example
|
ベースオブジェクト」は、画面上のウィジェットの基本的なプロパティを実装したもので、次のようなものです。
オブジェクト指向の考え方では、LVGL の他のすべてのオブジェクトが継承される基本クラスです。 これはコードの重複を減らすのに役立ちます。
|
Coordinates
Size
英文 | 自動翻訳 |
---|---|
The object size can be modified on individual axes with
In a more exact way:
|
オブジェクトのサイズは、lv_obj_set_width(obj, new_width) およびlv_obj_set_height(obj, new_height) を使用して個々の軸上で変更することも、lv_obj_set_size(obj, new_width, new_height) を使用して両方の軸を同時に変更することもできます。
より正確な方法: new_width = left_pad + object_width + right_pad パディングによって削減された幅または高さを取得するには、lv_obj_get_width/height_fit(obj) を使用します。 これは「オブジェクトの有用なサイズ」と見なすことができます。
|
Position
英文 | 自動翻訳 |
---|---|
You can set the position relative to the parent with |
親からの相対位置は、lv_obj_set_x(obj, new_x) とlv_obj_set_y(obj, new_y) 、またはlv_obj_set_pos(obj, new_x, new_y) を使用して同時に設定できます。
|
Alignment
英文 | 自動翻訳 |
---|---|
You can align the object to another with lv_obj_align(obj, obj_ref, LV_ALIGN_..., x_ofs, y_ofs) .
|
lv_obj_align(obj, obj_ref, LV_ALIGN_..., x_ofs, y_ofs) を使用して、オブジェクトを別のオブジェクトに位置合わせできます。
|
|
|
For example, to align a text below an image: lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10) .
Or to align a text in the middle of its parent:
You can then realign the objects simply by calling It's equivalent to calling |
たとえば、画像の下にテキストを配置するには: lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)。
または、テキストをその親の中央に配置するには: lv_obj_align(text, NULL, LV_ALIGN_CENTER, 0, 0)。
その後、lv_obj_realign(obj) を呼び出すだけでオブジェクトを再配置できます。 同じパラメーターで lv_obj_align を再度呼び出すことと同じです。 |
If the alignment happened with lv_obj_align_origo , then it will be used when the object is realigned.
|
アライメントが lv_obj_align_origo で発生した場合、オブジェクトが再アライメントされるときに使用されます。
|
Parents and children
英文 | 自動翻訳 |
---|---|
You can set a new parent for an object with lv_obj_set_parent(obj, new_parent) .
To get the current parent, use To get the children of an object, use |
lv_obj_set_parent(obj, new_parent) を使用して、オブジェクトの新しい親を設定できます。
現在の親を取得するには、lv_obj_get_parent(obj) を使用します。
|
lv_obj_t * child = lv_obj_get_child(parent, NULL);
while(child) {
/*Do something with "child" */
child = lv_obj_get_child(parent, child);
}
| |
lv_obj_get_index(obj) tells the number of children on an object.
It is equivalent to the number of younger children in the parent.
|
lv_obj_get_index(obj) は、オブジェクトの子の数を示します。
これは、親の年少の子供の数に相当します。
|
Screens
英文 | 自動翻訳 |
---|---|
When you have created a screen like
|
lv_obj_t * screen = lv_obj_create(NULL, NULL) のように画面を作成したら、lv_scr_load(screen) で読み込むことができます。 lv_scr_act() 関数は、現在の画面へのポインターを提供します。
|
Layers
英文 | 自動翻訳 |
---|---|
There are two automatically generated layers:
The top layer is above every object on the screen and the system layer is above the top layer too. You can add any pop-up windows to the top layer freely. But, the system layer is restricted to system-level things (e.g. mouse cursor will be placed here in
|
2 つの自動生成レイヤーがあります。
最上層に任意のポップアップ ウィンドウを自由に追加できます。 ただし、システム レイヤーはシステム レベルのものに制限されます (たとえば、マウス カーソルは lv_indev_set_cursor() でここに配置されます)。
|
Events
英文 | 自動翻訳 |
---|---|
To set an event callback for an object, use
Read the Event overview to learn more about events. |
オブジェクトにイベントコールバックを設定するには、lv_obj_add_event_cb(obj, event_cb, LV_EVENT_..., user_data) を使い、
イベントを手動でオブジェクトに送信するには、 イベントの詳細については、 「イベントの概要」 を参照してください。 |
Parts
英文 | 自動翻訳 |
---|---|
To set an event callback for an object, use lv_obj_set_event_cb(obj, event_cb) ,
|
オブジェクトのイベント コールバックを設定するには、lv_obj_set_event_cb(obj, event_cb) を使用します。
|
States
英文 | 自動翻訳 |
---|---|
The widgets can have multiple parts. For example a Button has only a main part but a Slider is built from a background, an indicator and a knob.
|
ウィジェットには複数のパーツを含めることができます。 たとえば、ボタンには主要な部分しかありませんが、スライダーは背景、インジケーター、およびノブから構築されます。
|
Styles
英文 | 自動翻訳 |
---|---|
Be sure to read the Style overview first.
The Base object use all the rectangle-like style properties.
If the parameter of |
最初に必ずスタイルの概要をお読みください。
Base オブジェクトは、すべての長方形のようなスタイル プロパティを使用します。
|
Flags
英文 | 自動翻訳 |
---|---|
/*Hide on object*/
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
/*Hide on object*/
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
/*オブジェクトを非表示にする*/
lv_obj_add_flag (obj 、 LV_OBJ_FLAG_HIDDEN );
/*オブジェクトをクリック不可にする*/
lv_obj_clear_flag (obj 、 LV_OBJ_FLAG_CLICKABLE );
いくつかの例: /*オブジェクトを非表示にする*/
lv_obj_add_flag (obj 、 LV_OBJ_FLAG_HIDDEN );
/*オブジェクトをクリック不可にする*/
lv_obj_clear_flag (obj 、 LV_OBJ_FLAG_CLICKABLE );
|
Groups
英文 | 自動翻訳 |
---|---|
Read the Input devices overview to learn more about Groups.
|
グループについての詳細は、入力デバイスの概要を参照してください。
オブジェクトは
|
Extended click area
英文 | 自動翻訳 |
---|---|
By default, the objects can be clicked only within their bounding area. However, this can be extended with |
デフォルトでは、オブジェクトは境界領域内でのみクリックできます。ただし、これは。lv_obj_set_ext_click_area(obj, size) で拡張できます。
|
Events
英文 | 自動翻訳 |
---|---|
Learn more about Events. |
|
Keys
英文 | 自動翻訳 |
---|---|
If
Learn more about Keys. |
LV_OBJ_FLAG_CHECKABLE が有効な場合、LV_KEY_RIGHT と LV_KEY_UP はオブジェクトをチェック状態にし、LV_KEY_LEFT と LV_KEY_DOWN は非チェック状態にする。
|
Example
Base objects with custom styles
英文 | 自動翻訳 |
---|---|
Make an object draggable |
API
英文 | 自動翻訳 |
---|---|
Typedefs typedef uint16_t lv_state_t typedef uint32_t lv_part_t typedef uint32_t lv_obj_flag_t typedef struct _lv_obj_t lv_obj_t Enums enum [anonymous]
enum [anonymous]
enum [anonymous]
enum lv_obj_draw_part_type_t
Functions void lv_init(void)
void lv_deinit(void)
bool lv_is_initialized(void)
lv_obj_t *lv_obj_create(lv_obj_t *parent)
void lv_obj_add_flag(lv_obj_t *obj, lv_obj_flag_t f)
void lv_obj_clear_flag(lv_obj_t *obj, lv_obj_flag_t f)
void lv_obj_add_state(lv_obj_t *obj, lv_state_t state)
void lv_obj_clear_state(lv_obj_t *obj, lv_state_t state)
static inline void lv_obj_set_user_data(lv_obj_t *obj, void *user_data)
bool lv_obj_has_flag(const lv_obj_t *obj, lv_obj_flag_t f)
bool lv_obj_has_flag_any(const lv_obj_t *obj, lv_obj_flag_t f)
lv_state_t lv_obj_get_state(const lv_obj_t *obj)
bool lv_obj_has_state(const lv_obj_t *obj, lv_state_t state)
void *lv_obj_get_group(const lv_obj_t *obj)
static inline void *lv_obj_get_user_data(lv_obj_t *obj)
void lv_obj_allocate_spec_attr(lv_obj_t *obj)
bool lv_obj_check_type(const lv_obj_t *obj, const lv_obj_class_t *class_p)
bool lv_obj_has_class(const lv_obj_t *obj, const lv_obj_class_t *class_p)
const lv_obj_class_t *lv_obj_get_class(const lv_obj_t *obj)
bool lv_obj_is_valid(const lv_obj_t *obj)
static inline lv_coord_t lv_obj_dpx(const lv_obj_t *obj, lv_coord_t n)
Variables const lv_obj_class_t lv_obj_class
struct _lv_obj_spec_attr_t
|
Typedef typedef uint16_t lv_state_t typedef uint32_t lv_part_t typedef uint32_t lv_obj_flag_t typedef struct _lv_obj_t lv_obj_t 列挙型 列挙型[匿名]
列挙型[匿名]
列挙型[匿名]
列挙型lv_obj_draw_part_type_t
機能 void lv_init(void)
void lv_deinit(void)
bool lv_is_initialized(void)
lv_obj_t * lv_obj_create(lv_obj_t * parent)
void lv_obj_add_flag(lv_obj_t * obj、lv_obj_flag_t f)
void lv_obj_clear_flag(lv_obj_t * obj、lv_obj_flag_t f)
void lv_obj_add_state(lv_obj_t * obj、lv_state_t state)
void lv_obj_clear_state(lv_obj_t * obj、lv_state_t state)
static inline void lv_obj_set_user_data(lv_obj_t * obj、void * user_data)
bool lv_obj_has_flag(const lv_obj_t * obj、lv_obj_flag_t f)
bool lv_obj_has_flag_any(const lv_obj_t * obj、lv_obj_flag_t f)
lv_state_t lv_obj_get_state(const lv_obj_t * obj)
bool lv_obj_has_state(const lv_obj_t * obj、lv_state_t state)
void * lv_obj_get_group(const lv_obj_t * obj)
static inline void * lv_obj_get_user_data(lv_obj_t * obj)
void lv_obj_allocate_spec_attr(lv_obj_t * obj)
bool lv_obj_check_type(const lv_obj_t * obj、const lv_obj_class_t * class_p)
bool lv_obj_has_class(const lv_obj_t * obj、const lv_obj_class_t * class_p)
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj)
bool lv_obj_is_valid(const lv_obj_t * obj)
静的インラインlv_coord_tlv_obj_dpx(const lv_obj_t * obj、lv_coord_t n)
変数 const lv_obj_class_t lv_obj_class
struct _lv_obj_spec_attr_t
struct _lv_obj_t
|