summaryrefslogtreecommitdiff
path: root/lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-06-12 17:54:40 +1000
committerjacqueline <me@jacqueline.id.au>2024-06-12 17:54:40 +1000
commit64bd9053a25297f7a442ca831c7da5b44bd33f84 (patch)
treea90c6cad25a12028302ab1a5334510fba0229bae /lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h
parent611176ed667c4ed7ee9f609e958f9404f4aee91d (diff)
downloadtangara-fw-64bd9053a25297f7a442ca831c7da5b44bd33f84.tar.gz
Update LVGL to v9.1.0
Diffstat (limited to 'lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h')
-rw-r--r--lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h b/lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h
new file mode 100644
index 00000000..1f91eb68
--- /dev/null
+++ b/lib/lvgl/src/widgets/imagebutton/lv_imagebutton.h
@@ -0,0 +1,134 @@
+/**
+ * @file lv_imagebutton.h
+ *
+ */
+
+#ifndef LV_IMAGEBUTTON_H
+#define LV_IMAGEBUTTON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*********************
+ * INCLUDES
+ *********************/
+#include "../../core/lv_obj.h"
+
+#if LV_USE_IMAGEBUTTON != 0
+
+/*********************
+ * DEFINES
+ *********************/
+typedef enum {
+ LV_IMAGEBUTTON_STATE_RELEASED,
+ LV_IMAGEBUTTON_STATE_PRESSED,
+ LV_IMAGEBUTTON_STATE_DISABLED,
+ LV_IMAGEBUTTON_STATE_CHECKED_RELEASED,
+ LV_IMAGEBUTTON_STATE_CHECKED_PRESSED,
+ LV_IMAGEBUTTON_STATE_CHECKED_DISABLED,
+ _LV_IMAGEBUTTON_STATE_NUM,
+} lv_imagebutton_state_t;
+
+typedef struct {
+ const void * img_src;
+ lv_image_header_t header;
+} lv_imagebutton_src_info_t;
+
+/**********************
+ * TYPEDEFS
+ **********************/
+/*Data of image button*/
+typedef struct {
+ lv_obj_t obj;
+ lv_imagebutton_src_info_t src_mid[_LV_IMAGEBUTTON_STATE_NUM]; /*Store center images to each state*/
+ lv_imagebutton_src_info_t src_left[_LV_IMAGEBUTTON_STATE_NUM]; /*Store left side images to each state*/
+ lv_imagebutton_src_info_t src_right[_LV_IMAGEBUTTON_STATE_NUM]; /*Store right side images to each state*/
+} lv_imagebutton_t;
+
+LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_imagebutton_class;
+
+/**********************
+ * GLOBAL PROTOTYPES
+ **********************/
+
+/**
+ * Create an image button object
+ * @param parent pointer to an object, it will be the parent of the new image button
+ * @return pointer to the created image button
+ */
+lv_obj_t * lv_imagebutton_create(lv_obj_t * parent);
+
+/*======================
+ * Add/remove functions
+ *=====================*/
+
+/*=====================
+ * Setter functions
+ *====================*/
+
+/**
+ * Set images for a state of the image button
+ * @param imagebutton pointer to an image button object
+ * @param state for which state set the new image
+ * @param src_left pointer to an image source for the left side of the button (a C array or path to
+ * a file)
+ * @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C
+ * array or path to a file)
+ * @param src_right pointer to an image source for the right side of the button (a C array or path
+ * to a file)
+ */
+void lv_imagebutton_set_src(lv_obj_t * imagebutton, lv_imagebutton_state_t state, const void * src_left,
+ const void * src_mid,
+ const void * src_right);
+
+/**
+ * Use this function instead of `lv_obj_add/remove_state` to set a state manually
+ * @param imagebutton pointer to an image button object
+ * @param state the new state
+ */
+void lv_imagebutton_set_state(lv_obj_t * imagebutton, lv_imagebutton_state_t state);
+
+/*=====================
+ * Getter functions
+ *====================*/
+
+/**
+ * Get the left image in a given state
+ * @param imagebutton pointer to an image button object
+ * @param state the state where to get the image (from `lv_button_state_t`) `
+ * @return pointer to the left image source (a C array or path to a file)
+ */
+const void * lv_imagebutton_get_src_left(lv_obj_t * imagebutton, lv_imagebutton_state_t state);
+
+/**
+ * Get the middle image in a given state
+ * @param imagebutton pointer to an image button object
+ * @param state the state where to get the image (from `lv_button_state_t`) `
+ * @return pointer to the middle image source (a C array or path to a file)
+ */
+const void * lv_imagebutton_get_src_middle(lv_obj_t * imagebutton, lv_imagebutton_state_t state);
+
+/**
+ * Get the right image in a given state
+ * @param imagebutton pointer to an image button object
+ * @param state the state where to get the image (from `lv_button_state_t`) `
+ * @return pointer to the left image source (a C array or path to a file)
+ */
+const void * lv_imagebutton_get_src_right(lv_obj_t * imagebutton, lv_imagebutton_state_t state);
+
+/*=====================
+ * Other functions
+ *====================*/
+
+/**********************
+ * MACROS
+ **********************/
+
+#endif /*LV_USE_IMAGEBUTTON*/
+
+#ifdef __cplusplus
+} /*extern "C"*/
+#endif
+
+#endif /*LV_IMAGEBUTTON_H*/