diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
| commit | 64bd9053a25297f7a442ca831c7da5b44bd33f84 (patch) | |
| tree | a90c6cad25a12028302ab1a5334510fba0229bae /lib/lvgl/src/widgets/button | |
| parent | 611176ed667c4ed7ee9f609e958f9404f4aee91d (diff) | |
| download | tangara-fw-64bd9053a25297f7a442ca831c7da5b44bd33f84.tar.gz | |
Update LVGL to v9.1.0
Diffstat (limited to 'lib/lvgl/src/widgets/button')
| -rw-r--r-- | lib/lvgl/src/widgets/button/lv_button.c | 71 | ||||
| -rw-r--r-- | lib/lvgl/src/widgets/button/lv_button.h | 56 |
2 files changed, 127 insertions, 0 deletions
diff --git a/lib/lvgl/src/widgets/button/lv_button.c b/lib/lvgl/src/widgets/button/lv_button.c new file mode 100644 index 00000000..8f57aa40 --- /dev/null +++ b/lib/lvgl/src/widgets/button/lv_button.c @@ -0,0 +1,71 @@ +/** + * @file lv_btn.c + * + */ + +/********************* + * INCLUDES + *********************/ + +#include "lv_button.h" +#if LV_USE_BUTTON != 0 + +/********************* + * DEFINES + *********************/ +#define MY_CLASS (&lv_button_class) + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void lv_button_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); + +/********************** + * STATIC VARIABLES + **********************/ +const lv_obj_class_t lv_button_class = { + .constructor_cb = lv_button_constructor, + .width_def = LV_SIZE_CONTENT, + .height_def = LV_SIZE_CONTENT, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, + .instance_size = sizeof(lv_button_t), + .base_class = &lv_obj_class, + .name = "btn", +}; + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +lv_obj_t * lv_button_create(lv_obj_t * parent) +{ + LV_LOG_INFO("begin"); + lv_obj_t * obj = lv_obj_class_create_obj(MY_CLASS, parent); + lv_obj_class_init_obj(obj); + return obj; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void lv_button_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) +{ + LV_UNUSED(class_p); + LV_TRACE_OBJ_CREATE("begin"); + + lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + + LV_TRACE_OBJ_CREATE("finished"); +} + +#endif diff --git a/lib/lvgl/src/widgets/button/lv_button.h b/lib/lvgl/src/widgets/button/lv_button.h new file mode 100644 index 00000000..08ba1cdb --- /dev/null +++ b/lib/lvgl/src/widgets/button/lv_button.h @@ -0,0 +1,56 @@ +/** + * @file lv_btn.h + * + */ + +#ifndef LV_BUTTON_H +#define LV_BUTTON_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../lv_conf_internal.h" + +#if LV_USE_BUTTON != 0 +#include "../../core/lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_obj_t obj; +} lv_button_t; + +LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_button_class; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Create a button object + * @param parent pointer to an object, it will be the parent of the new button + * @return pointer to the created button + */ +lv_obj_t * lv_button_create(lv_obj_t * parent); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_BUTTON*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BUTTON_H*/ |
