initial commit

This commit is contained in:
Carter Essen committed 2026-11-09 17:35:03 -05:00
commit cff2a21efc
550 files changed
+154887

No files matched your search

@@ -0,0 +1,129 @@
/**
* @file lv_animimage.h
*
*/
#ifndef LV_ANIMIMAGE_H
#define LV_ANIMIMAGE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../image/lv_image.h"
#include "../../misc/lv_types.h"
#if LV_USE_ANIMIMG != 0
/*Testing of dependencies*/
#if LV_USE_IMAGE == 0
#error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMAGE 1)"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class;
/** Image parts */
typedef enum {
LV_ANIM_IMAGE_PART_MAIN,
} lv_animimg_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an animation image objects
* @param parent pointer to an object, it will be the parent of the new button
* @return pointer to the created animation image object
*/
lv_obj_t * lv_animimg_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the image animation images source.
* @param img pointer to an animation image object
* @param dsc pointer to a series images
* @param num images' number
*/
void lv_animimg_set_src(lv_obj_t * img, const void * dsc[], size_t num);
/**
* Startup the image animation.
* @param obj pointer to an animation image object
*/
void lv_animimg_start(lv_obj_t * obj);
/**
* Set the image animation duration time. unit:ms
* @param img pointer to an animation image object
* @param duration the duration in milliseconds
*/
void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration);
/**
* Set the image animation repeatedly play times.
* @param img pointer to an animation image object
* @param count the number of times to repeat the animation
*/
void lv_animimg_set_repeat_count(lv_obj_t * img, uint32_t count);
/*=====================
* Getter functions
*====================*/
/**
* Get the image animation images source.
* @param img pointer to an animation image object
* @return a pointer that will point to a series images
*/
const void ** lv_animimg_get_src(lv_obj_t * img);
/**
* Get the image animation images source.
* @param img pointer to an animation image object
* @return the number of source images
*/
uint8_t lv_animimg_get_src_count(lv_obj_t * img);
/**
* Get the image animation duration time. unit:ms
* @param img pointer to an animation image object
* @return the animation duration time
*/
uint32_t lv_animimg_get_duration(lv_obj_t * img);
/**
* Get the image animation repeat play times.
* @param img pointer to an animation image object
* @return the repeat count
*/
uint32_t lv_animimg_get_repeat_count(lv_obj_t * img);
/**
* Get the image animation underlying animation.
* @param img pointer to an animation image object
* @return the animation reference
*/
lv_anim_t * lv_animimg_get_anim(lv_obj_t * img);
#endif /*LV_USE_ANIMIMG*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_ANIMIMAGE_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_animimage_private.h
*
*/
#ifndef LV_ANIMIMAGE_PRIVATE_H
#define LV_ANIMIMAGE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../image/lv_image_private.h"
#include "../../misc/lv_anim_private.h"
#include "lv_animimage.h"
#if LV_USE_ANIMIMG != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of the animimage */
struct _lv_animimg_t {
lv_image_t img;
lv_anim_t anim;
/* picture sequence */
const void ** dsc;
int8_t pic_count;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_ANIMIMG != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ANIMIMAGE_PRIVATE_H*/
+247
View File
@@ -0,0 +1,247 @@
/**
* @file lv_arc.h
*
*/
#ifndef LV_ARC_H
#define LV_ARC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_ARC != 0
#include "../../core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_ARC_MODE_NORMAL,
LV_ARC_MODE_SYMMETRICAL,
LV_ARC_MODE_REVERSE
} lv_arc_mode_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an arc object
* @param parent pointer to an object, it will be the parent of the new arc
* @return pointer to the created arc
*/
lv_obj_t * lv_arc_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param obj pointer to an arc object
* @param start the start angle. (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_start_angle(lv_obj_t * obj, lv_value_precise_t start);
/**
* Set the end angle of an arc. 0 deg: right, 90 bottom, etc.
* @param obj pointer to an arc object
* @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_end_angle(lv_obj_t * obj, lv_value_precise_t end);
/**
* Set the start and end angles
* @param obj pointer to an arc object
* @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
* @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end);
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom, etc.
* @param obj pointer to an arc object
* @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_bg_start_angle(lv_obj_t * obj, lv_value_precise_t start);
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom etc.
* @param obj pointer to an arc object
* @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_bg_end_angle(lv_obj_t * obj, lv_value_precise_t end);
/**
* Set the start and end angles of the arc background
* @param obj pointer to an arc object
* @param start the start angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
* @param end the end angle (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
void lv_arc_set_bg_angles(lv_obj_t * obj, lv_value_precise_t start, lv_value_precise_t end);
/**
* Set the rotation for the whole arc
* @param obj pointer to an arc object
* @param rotation rotation angle
*/
void lv_arc_set_rotation(lv_obj_t * obj, int32_t rotation);
/**
* Set the type of arc.
* @param obj pointer to arc object
* @param type arc's mode
*/
void lv_arc_set_mode(lv_obj_t * obj, lv_arc_mode_t type);
/**
* Set a new value on the arc
* @param obj pointer to an arc object
* @param value new value
*/
void lv_arc_set_value(lv_obj_t * obj, int32_t value);
/**
* Set minimum and the maximum values of an arc
* @param obj pointer to the arc object
* @param min minimum value
* @param max maximum value
*/
void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max);
/**
* Set a change rate to limit the speed how fast the arc should reach the pressed point.
* @param obj pointer to an arc object
* @param rate the change rate
*/
void lv_arc_set_change_rate(lv_obj_t * obj, uint32_t rate);
/**
* Set an offset angle for the knob
* @param obj pointer to an arc object
* @param offset knob offset from main arc in degrees
*/
void lv_arc_set_knob_offset(lv_obj_t * obj, int32_t offset);
/*=====================
* Getter functions
*====================*/
/**
* Get the start angle of an arc.
* @param obj pointer to an arc object
* @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
lv_value_precise_t lv_arc_get_angle_start(lv_obj_t * obj);
/**
* Get the end angle of an arc.
* @param obj pointer to an arc object
* @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
lv_value_precise_t lv_arc_get_angle_end(lv_obj_t * obj);
/**
* Get the start angle of an arc background.
* @param obj pointer to an arc object
* @return the start angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
lv_value_precise_t lv_arc_get_bg_angle_start(lv_obj_t * obj);
/**
* Get the end angle of an arc background.
* @param obj pointer to an arc object
* @return the end angle [0..360] (if `LV_USE_FLOAT` is enabled it can be fractional too.)
*/
lv_value_precise_t lv_arc_get_bg_angle_end(lv_obj_t * obj);
/**
* Get the value of an arc
* @param obj pointer to an arc object
* @return the value of the arc
*/
int32_t lv_arc_get_value(const lv_obj_t * obj);
/**
* Get the minimum value of an arc
* @param obj pointer to an arc object
* @return the minimum value of the arc
*/
int32_t lv_arc_get_min_value(const lv_obj_t * obj);
/**
* Get the maximum value of an arc
* @param obj pointer to an arc object
* @return the maximum value of the arc
*/
int32_t lv_arc_get_max_value(const lv_obj_t * obj);
/**
* Get whether the arc is type or not.
* @param obj pointer to an arc object
* @return arc's mode
*/
lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj);
/**
* Get the rotation for the whole arc
* @param obj pointer to an arc object
* @return arc's current rotation
*/
int32_t lv_arc_get_rotation(const lv_obj_t * obj);
/**
* Get the current knob angle offset
* @param obj pointer to an arc object
* @return arc's current knob offset
*/
int32_t lv_arc_get_knob_offset(const lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Align an object to the current position of the arc (knob)
* @param obj pointer to an arc object
* @param obj_to_align pointer to an object to align
* @param r_offset consider the radius larger with this value (< 0: for smaller radius)
*/
void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset);
/**
* Rotate an object to the current position of the arc (knob)
* @param obj pointer to an arc object
* @param obj_to_rotate pointer to an object to rotate
* @param r_offset consider the radius larger with this value (< 0: for smaller radius)
*/
void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset);
/**********************
* MACROS
**********************/
#endif /*LV_USE_ARC*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ARC_H*/
@@ -0,0 +1,64 @@
/**
* @file lv_arc_private.h
*
*/
#ifndef LV_ARC_PRIVATE_H
#define LV_ARC_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_arc.h"
#if LV_USE_ARC != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_arc_t {
lv_obj_t obj;
int32_t rotation;
lv_value_precise_t indic_angle_start;
lv_value_precise_t indic_angle_end;
lv_value_precise_t bg_angle_start;
lv_value_precise_t bg_angle_end;
int32_t value; /**< Current value of the arc */
int32_t min_value; /**< Minimum value of the arc */
int32_t max_value; /**< Maximum value of the arc */
uint32_t dragging : 1;
uint32_t type : 2;
uint32_t min_close : 1; /**< 1: the last pressed angle was closer to minimum end */
uint32_t in_out : 1; /**< 1: The click was within the background arc angles. 0: Click outside */
uint32_t chg_rate; /**< Drag angle rate of change of the arc (degrees/sec) */
uint32_t last_tick; /**< Last dragging event timestamp of the arc */
lv_value_precise_t last_angle; /**< Last dragging angle of the arc */
int16_t knob_offset; /**< knob offset from the main arc */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_ARC != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ARC_PRIVATE_H*/
+162
View File
@@ -0,0 +1,162 @@
/**
* @file lv_bar.h
*
*/
#ifndef LV_BAR_H
#define LV_BAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_BAR != 0
#include "../../core/lv_obj.h"
#include "../../misc/lv_anim.h"
#include "../label/lv_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_BAR_MODE_NORMAL,
LV_BAR_MODE_SYMMETRICAL,
LV_BAR_MODE_RANGE
} lv_bar_mode_t;
typedef enum {
LV_BAR_ORIENTATION_AUTO,
LV_BAR_ORIENTATION_HORIZONTAL,
LV_BAR_ORIENTATION_VERTICAL
} lv_bar_orientation_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_bar_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a bar object
* @param parent pointer to an object, it will be the parent of the new bar
* @return pointer to the created bar
*/
lv_obj_t * lv_bar_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set a new value on the bar
* @param obj pointer to a bar object
* @param value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim);
/**
* Set a new start value on the bar
* @param obj pointer to a bar object
* @param start_value new start value
* @param anim LV_ANIM_ON: set the value with an animation; LV_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 minimum and the maximum values of a bar
* @param obj pointer to the bar object
* @param min minimum value
* @param max maximum value
* @note If min is greater than max, the drawing direction becomes to the opposite direction.
*/
void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max);
/**
* Set the type of bar.
* @param obj pointer to bar object
* @param mode bar type from ::lv_bar_mode_t
*/
void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode);
/**
* Set the orientation of bar.
* @param obj pointer to bar object
* @param orientation bar orientation from `lv_bar_orientation_t`
*/
void lv_bar_set_orientation(lv_obj_t * obj, lv_bar_orientation_t orientation);
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a bar
* @param obj pointer to a bar object
* @return the value of the bar
*/
int32_t lv_bar_get_value(const lv_obj_t * obj);
/**
* Get the start value of a bar
* @param obj pointer to a bar object
* @return the start value of the bar
*/
int32_t lv_bar_get_start_value(const lv_obj_t * obj);
/**
* Get the minimum value of a bar
* @param obj pointer to a bar object
* @return the minimum value of the bar
*/
int32_t lv_bar_get_min_value(const lv_obj_t * obj);
/**
* Get the maximum value of a bar
* @param obj pointer to a bar object
* @return the maximum value of the bar
*/
int32_t lv_bar_get_max_value(const lv_obj_t * obj);
/**
* Get the type of bar.
* @param obj pointer to bar object
* @return bar type from ::lv_bar_mode_t
*/
lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj);
/**
* Get the orientation of bar.
* @param obj pointer to bar object
* @return bar orientation from ::lv_bar_orientation_t
*/
lv_bar_orientation_t lv_bar_get_orientation(lv_obj_t * obj);
/**
* Give the bar is in symmetrical mode or not
* @param obj pointer to bar object
* @return true: in symmetrical mode false : not in
*/
bool lv_bar_is_symmetrical(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_BAR*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BAR_H*/
@@ -0,0 +1,66 @@
/**
* @file lv_bar_private.h
*
*/
#ifndef LV_BAR_PRIVATE_H
#define LV_BAR_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_bar.h"
#if LV_USE_BAR != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
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; /**< 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*/
bool val_reversed; /**< Whether value been reversed */
lv_bar_anim_t cur_value_anim;
lv_bar_anim_t start_value_anim;
lv_bar_mode_t mode : 3; /**< Type of bar*/
lv_bar_orientation_t orientation : 3; /**< Orientation of bar*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_BAR != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BAR_PRIVATE_H*/
@@ -0,0 +1,48 @@
/**
* @file lv_button.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
*********************/
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*/
@@ -0,0 +1,53 @@
/**
* @file lv_button_private.h
*
*/
#ifndef LV_BUTTON_PRIVATE_H
#define LV_BUTTON_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_button.h"
#if LV_USE_BUTTON != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_button_t {
lv_obj_t obj;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_BUTTON != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BUTTON_PRIVATE_H*/
@@ -0,0 +1,202 @@
/**
* @file lv_buttonmatrix.h
*
*/
#ifndef LV_BUTTONMATRIX_H
#define LV_BUTTONMATRIX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_BUTTONMATRIX != 0
#include "../../core/lv_obj.h"
/*********************
* DEFINES
*********************/
#define LV_BUTTONMATRIX_BUTTON_NONE 0xFFFF
LV_EXPORT_CONST_INT(LV_BUTTONMATRIX_BUTTON_NONE);
/**********************
* TYPEDEFS
**********************/
/** Type to store button control bits (disabled, hidden etc.)
* The first 3 bits are used to store the width*/
typedef enum {
LV_BUTTONMATRIX_CTRL_HIDDEN = 0x0010, /**< Button hidden*/
LV_BUTTONMATRIX_CTRL_NO_REPEAT = 0x0020, /**< Do not repeat press this button.*/
LV_BUTTONMATRIX_CTRL_DISABLED = 0x0040, /**< Disable this button.*/
LV_BUTTONMATRIX_CTRL_CHECKABLE = 0x0080, /**< The button can be toggled.*/
LV_BUTTONMATRIX_CTRL_CHECKED = 0x0100, /**< Button is currently toggled (e.g. checked).*/
LV_BUTTONMATRIX_CTRL_CLICK_TRIG = 0x0200, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/
LV_BUTTONMATRIX_CTRL_POPOVER = 0x0400, /**< Show a popover when pressing this key*/
LV_BUTTONMATRIX_CTRL_RECOLOR = 0x0800, /**< Enable text recoloring with `#color`*/
LV_BUTTONMATRIX_CTRL_RESERVED_2 = 0x1000, /**< Reserved for later use*/
LV_BUTTONMATRIX_CTRL_RESERVED_3 = 0x2000, /**< Reserved for later use*/
LV_BUTTONMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free to use flag*/
LV_BUTTONMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free to use flag*/
} lv_buttonmatrix_ctrl_t;
typedef bool (*lv_buttonmatrix_button_draw_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area,
const lv_area_t * clip_area);
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_buttonmatrix_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a button matrix object
* @param parent pointer to an object, it will be the parent of the new button matrix
* @return pointer to the created button matrix
*/
lv_obj_t * lv_buttonmatrix_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set a new map. Buttons will be created/deleted according to the map. The
* button matrix keeps a reference to the map and so the string array must not
* be deallocated during the life of the matrix.
* @param obj pointer to a button matrix object
* @param map pointer a string array. The last string has to be: "". Use "\n" to make a line break.
*/
void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * const map[]);
/**
* Set the button control map (hidden, disabled etc.) for a button matrix.
* The control map array will be copied and so may be deallocated after this
* function returns.
* @param obj pointer to a button matrix object
* @param ctrl_map pointer to an array of `lv_button_ctrl_t` control bytes. The
* length of the array and position of the elements must match
* the number and order of the individual buttons (i.e. excludes
* newline entries).
* An element of the map should look like e.g.:
* `ctrl_map[0] = width | LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_TGL_ENABLE`
*/
void lv_buttonmatrix_set_ctrl_map(lv_obj_t * obj, const lv_buttonmatrix_ctrl_t ctrl_map[]);
/**
* Set the selected buttons
* @param obj pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
*/
void lv_buttonmatrix_set_selected_button(lv_obj_t * obj, uint32_t btn_id);
/**
* Set the attributes of a button of the button matrix
* @param obj pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
* @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE`
*/
void lv_buttonmatrix_set_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl);
/**
* Clear the attributes of a button of the button matrix
* @param obj pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
* @param ctrl OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE`
*/
void lv_buttonmatrix_clear_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl);
/**
* Set attributes of all buttons of a button matrix
* @param obj pointer to a button matrix object
* @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed.
*/
void lv_buttonmatrix_set_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl);
/**
* Clear the attributes of all buttons of a button matrix
* @param obj pointer to a button matrix object
* @param ctrl attribute(s) to set from `lv_buttonmatrix_ctrl_t`. Values can be ORed.
*/
void lv_buttonmatrix_clear_button_ctrl_all(lv_obj_t * obj, lv_buttonmatrix_ctrl_t ctrl);
/**
* Set a single button's relative width.
* This method will cause the matrix be regenerated and is a relatively
* expensive operation. It is recommended that initial width be specified using
* `lv_buttonmatrix_set_ctrl_map` and this method only be used for dynamic changes.
* @param obj pointer to button matrix object
* @param btn_id 0 based index of the button to modify.
* @param width relative width compared to the buttons in the same row. [1..15]
*/
void lv_buttonmatrix_set_button_width(lv_obj_t * obj, uint32_t btn_id, uint32_t width);
/**
* Make the button matrix like a selector widget (only one button may be checked at a time).
* `LV_BUTTONMATRIX_CTRL_CHECKABLE` must be enabled on the buttons to be selected using
* `lv_buttonmatrix_set_ctrl()` or `lv_buttonmatrix_set_button_ctrl_all()`.
* @param obj pointer to a button matrix object
* @param en whether "one check" mode is enabled
*/
void lv_buttonmatrix_set_one_checked(lv_obj_t * obj, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the current map of a button matrix
* @param obj pointer to a button matrix object
* @return the current map
*/
const char * const * lv_buttonmatrix_get_map(const lv_obj_t * obj);
/**
* Get the index of the lastly "activated" button by the user (pressed, released, focused etc)
* Useful in the `event_cb` to get the text of the button, check if hidden etc.
* @param obj pointer to button matrix object
* @return index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset)
*/
uint32_t lv_buttonmatrix_get_selected_button(const lv_obj_t * obj);
/**
* Get the button's text
* @param obj pointer to button matrix object
* @param btn_id the index a button not counting new line characters.
* @return text of btn_index` button
*/
const char * lv_buttonmatrix_get_button_text(const lv_obj_t * obj, uint32_t btn_id);
/**
* Get the whether a control value is enabled or disabled for button of a button matrix
* @param obj pointer to a button matrix object
* @param btn_id the index of a button not counting new line characters.
* @param ctrl control values to check (ORed value can be used)
* @return true: the control attribute is enabled false: disabled
*/
bool lv_buttonmatrix_has_button_ctrl(lv_obj_t * obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl);
/**
* Tell whether "one check" mode is enabled or not.
* @param obj Button matrix object
* @return true: "one check" mode is enabled; false: disabled
*/
bool lv_buttonmatrix_get_one_checked(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_BUTTONMATRIX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BUTTONMATRIX_H*/
@@ -0,0 +1,57 @@
/**
* @file lv_buttonmatrix_private.h
*
*/
#ifndef LV_BUTTONMATRIX_PRIVATE_H
#define LV_BUTTONMATRIX_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_buttonmatrix.h"
#if LV_USE_BUTTONMATRIX != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of button matrix */
struct _lv_buttonmatrix_t {
lv_obj_t obj;
const char * const * map_p; /**< Pointer to the current map */
lv_area_t * button_areas; /**< Array of areas of buttons */
lv_buttonmatrix_ctrl_t * ctrl_bits; /**< Array of control bytes */
uint32_t btn_cnt; /**< Number of button in 'map_p'(Handled by the library) */
uint32_t row_cnt; /**< Number of rows in 'map_p'(Handled by the library) */
uint32_t btn_id_sel; /**< Index of the active button (being pressed/released etc) or LV_BUTTONMATRIX_BUTTON_NONE */
uint32_t one_check : 1; /**< Single button toggled at once */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_BUTTONMATRIX != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BUTTONMATRIX_PRIVATE_H*/
@@ -0,0 +1,160 @@
/**
* @file lv_calendar.h
*
*/
#ifndef LV_CALENDAR_H
#define LV_CALENDAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../buttonmatrix/lv_buttonmatrix.h"
#if LV_USE_CALENDAR
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Represents a date on the calendar object (platform-agnostic).
*/
typedef struct {
uint16_t year;
int8_t month; /**< 1..12 */
int8_t day; /**< 1..31 */
} lv_calendar_date_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar widget
* @param parent pointer to an object, it will be the parent of the new calendar
* @return pointer the created calendar
*/
lv_obj_t * lv_calendar_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the today's date
* @param obj pointer to a calendar object
* @param year today's year
* @param month today's month [1..12]
* @param day today's day [1..31]
*/
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day);
/**
* Set the currently showed
* @param obj pointer to a calendar object
* @param year today's year
* @param month today's month [1..12]
*/
void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month);
/**
* Set the highlighted dates
* @param obj pointer to a calendar object
* @param highlighted pointer to an `lv_calendar_date_t` array containing the dates.
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
* @param date_num number of dates in the array
*/
void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], size_t date_num);
/**
* Set the name of the days
* @param obj pointer to a calendar object
* @param day_names pointer to an array with the names.
* E.g. `const char * days[7] = {"Sun", "Mon", ...}`
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
*/
void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names);
/*=====================
* Getter functions
*====================*/
/**
* Get the button matrix object of the calendar.
* It shows the dates and day names.
* @param obj pointer to a calendar object
* @return pointer to a the button matrix
*/
lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj);
/**
* Get the today's date
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar);
/**
* Get the currently showed
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
/**
* Get the highlighted dates
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar);
/**
* Get the number of the highlighted dates
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
size_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar);
/**
* Get the currently pressed day
* @param calendar pointer to a calendar object
* @param date store the pressed date here
* @return LV_RESULT_OK: there is a valid pressed date
* LV_RESULT_INVALID: there is no pressed data
*/
lv_result_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#include "lv_calendar_header_arrow.h"
#include "lv_calendar_header_dropdown.h"
#include "lv_calendar_chinese.h"
#endif /*LV_USE_CALENDAR*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_H*/
@@ -0,0 +1,68 @@
/**
* @file lv_calendar_chinese.h
*
*/
#ifndef LV_CALENDAR_CHINESE_H
#define LV_CALENDAR_CHINESE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#include "lv_calendar.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_calendar_date_t today;
bool leep_month;
} lv_calendar_chinese_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Enable the chinese calendar.
* @param obj pointer to a calendar object.
* @param en true: enable chinese calendar; false: disable
*/
void lv_calendar_set_chinese_mode(lv_obj_t * obj, bool en);
/**
* Get the name of the day
* @param gregorian to obtain the gregorian time for the name
* @return return the name of the day
*/
const char * lv_calendar_get_day_name(lv_calendar_date_t * gregorian);
/**
* Get the chinese time of the gregorian time (reference: https://www.cnblogs.com/liyang31tg/p/4123171.html)
* @param gregorian_time need to convert to chinese time in gregorian time
* @param chinese_time the chinese time convert from gregorian time
*/
void lv_calendar_gregorian_to_chinese(lv_calendar_date_t * gregorian_time, lv_calendar_chinese_t * chinese_time);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR_CHINESE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_CHINESE_H*/
@@ -0,0 +1,53 @@
/**
* @file lv_calendar_chinese_private.h
*
*/
#ifndef LV_CALENDAR_CHINESE_PRIVATE_H
#define LV_CALENDAR_CHINESE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_calendar_chinese.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct lv_calendar_chinese_t {
lv_calendar_date_t today;
bool leep_month;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_CHINESE_PRIVATE_H*/
@@ -0,0 +1,49 @@
/**
* @file lv_calendar_header_arrow.h
*
*/
#ifndef LV_CALENDAR_HEADER_ARROW_H
#define LV_CALENDAR_HEADER_ARROW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_ARROW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_arrow_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar header with drop-drowns to select the year and month
* @param parent pointer to a calendar object.
* @return the created header
*/
lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR_HEADER_ARROW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_HEADER_ARROW_H*/
@@ -0,0 +1,62 @@
/**
* @file lv_calendar_header_dropdown.h
*
*/
#ifndef LV_CALENDAR_HEADER_DROPDOWN_H
#define LV_CALENDAR_HEADER_DROPDOWN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_DROPDOWN
#if LV_USE_DROPDOWN == 0
#error "LV_USE_DROPDOWN needs to be enabled"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_header_dropdown_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar header with drop-drowns to select the year and month
* @param parent pointer to a calendar object.
* @return the created header
*/
lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent);
/**
* Sets a custom calendar year list
* @param parent pointer to a calendar object
* @param years_list pointer to an const char array with the years list, see lv_dropdown set_options for more information.
* E.g. `const char * years = "2023\n2022\n2021\n2020\n2019"
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
*/
void lv_calendar_header_dropdown_set_year_list(lv_obj_t * parent, const char * years_list);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR_HEADER_ARROW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_HEADER_DROPDOWN_H*/
@@ -0,0 +1,70 @@
/**
* @file lv_calendar_private.h
*
*/
#ifndef LV_CALENDAR_PRIVATE_H
#define LV_CALENDAR_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_calendar.h"
#if LV_USE_CALENDAR
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of calendar */
struct _lv_calendar_t {
lv_obj_t obj;
/* New data for this type */
lv_obj_t * btnm;
lv_calendar_date_t today; /**< Date of today */
lv_calendar_date_t showed_date; /**< Currently visible month (day is ignored) */
lv_calendar_date_t * highlighted_dates; /**< Apply different style on these days (pointer to user-defined array) */
size_t highlighted_dates_num; /**< Number of elements in `highlighted_days` */
const char * map[8 * 7];
#ifdef LV_USE_CALENDAR_CHINESE
bool use_chinese_calendar;
/** 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total.
* 20: Including the number of dates, line breaks, names for each day,
* and reserving several spaces for addresses. */
char nums [7 * 6][20];
#else
/** 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total.
* 6: Including the number of dates, and reserving several spaces for
* addresses.*/
char nums [7 * 6][4];
#endif
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_CALENDAR */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_PRIVATE_H*/
+185
View File
@@ -0,0 +1,185 @@
/**
* @file lv_canvas.h
*
*/
#ifndef LV_CANVAS_H
#define LV_CANVAS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_CANVAS != 0
#include "../image/lv_image.h"
#include "../../draw/lv_draw_image.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_canvas_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a canvas object
* @param parent pointer to an object, it will be the parent of the new canvas
* @return pointer to the created canvas
*/
lv_obj_t * lv_canvas_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set a buffer for the canvas.
*
* Use lv_canvas_set_draw_buf() instead if you need to set a buffer with alignment requirement.
*
* @param obj pointer to a canvas object
* @param buf buffer where content of canvas will be.
* The required size is (lv_image_color_format_get_px_size(cf) * w) / 8 * h)
* It can be allocated with `lv_malloc()` or
* it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or
* it can be an address in RAM or external SRAM
* @param w width of canvas
* @param h height of canvas
* @param cf color format. `LV_COLOR_FORMAT...`
*/
void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, int32_t w, int32_t h, lv_color_format_t cf);
/**
* Set a draw buffer for the canvas. A draw buffer either can be allocated by `lv_draw_buf_create()`
* or defined statically by `LV_DRAW_BUF_DEFINE_STATIC`. When buffer start address and stride has alignment
* requirement, it's recommended to use `lv_draw_buf_create`.
* @param obj pointer to a canvas object
* @param draw_buf pointer to a draw buffer
*/
void lv_canvas_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf);
/**
* Set a pixel's color and opacity
* @param obj pointer to a canvas
* @param x X coordinate of the pixel
* @param y Y coordinate of the pixel
* @param color the color
* @param opa the opacity
* @note The following color formats are supported
* LV_COLOR_FORMAT_I1/2/4/8, LV_COLOR_FORMAT_A8,
* LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_RGB888,
* LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_ARGB8888
*/
void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv_opa_t opa);
/**
* Set the palette color of a canvas for index format. Valid only for `LV_COLOR_FORMAT_I1/2/4/8`
* @param obj pointer to canvas object
* @param index the palette color to set:
* - for `LV_COLOR_FORMAT_I1`: 0..1
* - for `LV_COLOR_FORMAT_I2`: 0..3
* - for `LV_COLOR_FORMAT_I4`: 0..15
* - for `LV_COLOR_FORMAT_I8`: 0..255
* @param color the color to set
*/
void lv_canvas_set_palette(lv_obj_t * obj, uint8_t index, lv_color32_t color);
/*=====================
* Getter functions
*====================*/
lv_draw_buf_t * lv_canvas_get_draw_buf(lv_obj_t * obj);
/**
* Get a pixel's color and opacity
* @param obj pointer to a canvas
* @param x X coordinate of the pixel
* @param y Y coordinate of the pixel
* @return ARGB8888 color of the pixel
*/
lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y);
/**
* Get the image of the canvas as a pointer to an `lv_image_dsc_t` variable.
* @param canvas pointer to a canvas object
* @return pointer to the image descriptor.
*/
lv_image_dsc_t * lv_canvas_get_image(lv_obj_t * canvas);
/**
* Return the pointer for the buffer.
* It's recommended to use this function instead of the buffer form the
* return value of lv_canvas_get_image() as is can be aligned
* @param canvas pointer to a canvas object
* @return pointer to the buffer
*/
const void * lv_canvas_get_buf(lv_obj_t * canvas);
/*=====================
* Other functions
*====================*/
/**
* Copy a buffer to the canvas
* @param obj pointer to a canvas object
* @param canvas_area the area of the canvas to copy
* @param dest_buf pointer to a buffer to store the copied data
* @param dest_area the area of the destination buffer to copy to. If omitted NULL, copy to the whole `dest_buf`
*/
void lv_canvas_copy_buf(lv_obj_t * obj, const lv_area_t * canvas_area, lv_draw_buf_t * dest_buf,
const lv_area_t * dest_area);
/**
* Fill the canvas with color
* @param obj pointer to a canvas
* @param color the background color
* @param opa the desired opacity
*/
void lv_canvas_fill_bg(lv_obj_t * obj, lv_color_t color, lv_opa_t opa);
/**
* Initialize a layer to use LVGL's generic draw functions (lv_draw_rect/label/...) on the canvas.
* Needs to be usd in pair with `lv_canvas_finish_layer`.
* @param canvas pointer to a canvas
* @param layer pointer to a layer variable to initialize
*/
void lv_canvas_init_layer(lv_obj_t * canvas, lv_layer_t * layer);
/**
* Wait until all the drawings are finished on layer.
* Needs to be usd in pair with `lv_canvas_init_layer`.
* @param canvas pointer to a canvas
* @param layer pointer to a layer to finalize
*/
void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer);
/**********************
* MACROS
**********************/
#define LV_CANVAS_BUF_SIZE(w, h, bpp, stride) (((((w * bpp + 7) >> 3) + stride - 1) & ~(stride - 1)) * h + LV_DRAW_BUF_ALIGN)
/**
* Just a wrapper to `LV_CANVAS_BUF_SIZE` for bindings.
*/
uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride);
#endif /*LV_USE_CANVAS*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CANVAS_H*/
@@ -0,0 +1,52 @@
/**
* @file lv_canvas_private.h
*
*/
#ifndef LV_CANVAS_PRIVATE_H
#define LV_CANVAS_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../image/lv_image_private.h"
#include "lv_canvas.h"
#if LV_USE_CANVAS != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Canvas data */
struct _lv_canvas_t {
lv_image_t img;
lv_draw_buf_t * draw_buf;
lv_draw_buf_t static_buf;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_CANVAS != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CANVAS_PRIVATE_H*/
+358
View File
@@ -0,0 +1,358 @@
/**
* @file lv_chart.h
*
*/
#ifndef LV_CHART_H
#define LV_CHART_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_CHART != 0
/*********************
* DEFINES
*********************/
/**Default value of points. Can be used to not draw a point*/
#define LV_CHART_POINT_NONE (INT32_MAX)
LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE);
/**********************
* TYPEDEFS
**********************/
/**
* Chart types
*/
typedef enum {
LV_CHART_TYPE_NONE, /**< Don't draw the series*/
LV_CHART_TYPE_LINE, /**< Connect the points with lines*/
LV_CHART_TYPE_BAR, /**< Draw columns*/
LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/
} lv_chart_type_t;
/**
* Chart update mode for `lv_chart_set_next`
*/
typedef enum {
LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/
LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/
} lv_chart_update_mode_t;
/**
* Enumeration of the axis'
*/
typedef enum {
LV_CHART_AXIS_PRIMARY_Y = 0x00,
LV_CHART_AXIS_SECONDARY_Y = 0x01,
LV_CHART_AXIS_PRIMARY_X = 0x02,
LV_CHART_AXIS_SECONDARY_X = 0x04,
LV_CHART_AXIS_LAST
} lv_chart_axis_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_chart_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a chart object
* @param parent pointer to an object, it will be the parent of the new chart
* @return pointer to the created chart
*/
lv_obj_t * lv_chart_create(lv_obj_t * parent);
/**
* Set a new type for a chart
* @param obj pointer to a chart object
* @param type new type of the chart (from 'lv_chart_type_t' enum)
*/
void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type);
/**
* Set the number of points on a data line on a chart
* @param obj pointer to a chart object
* @param cnt new number of points on the data lines
*/
void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt);
/**
* Set the minimal and maximal y values on an axis
* @param obj pointer to a chart object
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
* @param min minimum value of the y axis
* @param max maximum value of the y axis
*/
void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max);
/**
* Set update mode of the chart object. Affects
* @param obj pointer to a chart object
* @param update_mode the update mode
*/
void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode);
/**
* Set the number of horizontal and vertical division lines
* @param obj pointer to a chart object
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv);
/**
* Get the type of a chart
* @param obj pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj);
/**
* Get the data point number per data line on chart
* @param obj pointer to chart object
* @return point number on each data line
*/
uint32_t lv_chart_get_point_count(const lv_obj_t * obj);
/**
* Get the current index of the x-axis start point in the data array
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the index of the current x start point in the data array
*/
uint32_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the position of a point to the chart.
* @param obj pointer to a chart object
* @param ser pointer to series
* @param id the index.
* @param p_out store the result position here
*/
void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_point_t * p_out);
/**
* Refresh a chart if its data line has changed
* @param obj pointer to chart object
*/
void lv_chart_refresh(lv_obj_t * obj);
/*======================
* Series
*=====================*/
/**
* Allocate and add a data series to the chart
* @param obj pointer to a chart object
* @param color color of the data series
* @param axis the y axis to which the series should be attached (::LV_CHART_AXIS_PRIMARY_Y or ::LV_CHART_AXIS_SECONDARY_Y)
* @return pointer to the allocated data series or NULL on failure
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_chart_axis_t axis);
/**
* Deallocate and remove a data series from a chart
* @param obj pointer to a chart object
* @param series pointer to a data series on 'chart'
*/
void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series);
/**
* Hide/Unhide a single series of a chart.
* @param chart pointer to a chart object.
* @param series pointer to a series object
* @param hide true: hide the series
*/
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide);
/**
* Change the color of a series
* @param chart pointer to a chart object.
* @param series pointer to a series object
* @param color the new color of the series
*/
void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color);
/**
* Get the color of a series
* @param chart pointer to a chart object.
* @param series pointer to a series object
* @return the color of the series
*/
lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series);
/**
* Set the index of the x-axis start point in the data array.
* This point will be considers the first (left) point and the other points will be drawn after it.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the data array
*/
void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id);
/**
* Get the next series.
* @param chart pointer to a chart
* @param ser the previous series or NULL to get the first
* @return the next series or NULL if there is no more.
*/
lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser);
/*=====================
* Cursor
*====================*/
/**
* Add a cursor with a given color
* @param obj pointer to chart object
* @param color color of the cursor
* @param dir direction of the cursor. `LV_DIR_RIGHT/LEFT/TOP/DOWN/HOR/VER/ALL`. OR-ed values are possible
* @return pointer to the created cursor
*/
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir);
/**
* Set the coordinate of the cursor with respect to the paddings
* @param chart pointer to a chart object
* @param cursor pointer to the cursor
* @param pos the new coordinate of cursor relative to the chart
*/
void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos);
/**
* Stick the cursor to a point
* @param chart pointer to a chart object
* @param cursor pointer to the cursor
* @param ser pointer to a series
* @param point_id the point's index or `LV_CHART_POINT_NONE` to not assign to any points.
*/
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser,
uint32_t point_id);
/**
* Get the coordinate of the cursor with respect to the paddings
* @param chart pointer to a chart object
* @param cursor pointer to cursor
* @return coordinate of the cursor as lv_point_t
*/
lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor);
/*=====================
* Set/Get value(s)
*====================*/
/**
* Initialize all data points of a series with a value
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param value the new value for all points. `LV_CHART_POINT_NONE` can be used to hide the points.
*/
void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value);
/**
* Set the next point's Y value according to the update mode policy.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param value the new value of the next data
*/
void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value);
/**
* Set the next point's X and Y value according to the update mode policy.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param x_value the new X value of the next data
* @param y_value the new Y value of the next data
*/
void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, int32_t x_value, int32_t y_value);
/**
* Set an individual point's y value of a chart's series directly based on its index
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @param value value to assign to array point
*/
void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t value);
/**
* Set an individual point's x and y value of a chart's series directly based on its index
* Can be used only with `LV_CHART_TYPE_SCATTER`.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @param x_value the new X value of the next data
* @param y_value the new Y value of the next data
*/
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t x_value,
int32_t y_value);
/**
* Set an external array for the y data points to use for the chart
* NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
*/
void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]);
/**
* Set an external array for the x data points to use for the chart
* NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
*/
void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]);
/**
* Get the array of y values of a series
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the array of values with 'point_count' elements
*/
int32_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the array of x values of a series
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the array of values with 'point_count' elements
*/
int32_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the index of the currently pressed point. It's the same for every series.
* @param obj pointer to a chart object
* @return the index of the point [0 .. point count] or LV_CHART_POINT_ID_NONE if no point is being pressed
*/
uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj);
/**
* Get the overall offset from the chart's side to the center of the first point.
* In case of a bar chart it will be the center of the first column group
* @param obj pointer to a chart object
* @return the offset of the center
*/
int32_t lv_chart_get_first_point_center_offset(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CHART*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHART_H*/
@@ -0,0 +1,85 @@
/**
* @file lv_chart_private.h
*
*/
#ifndef LV_CHART_PRIVATE_H
#define LV_CHART_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_chart.h"
#if LV_USE_CHART != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Descriptor a chart series
*/
struct _lv_chart_series_t {
int32_t * x_points;
int32_t * y_points;
lv_color_t color;
uint32_t start_point;
uint32_t hidden : 1;
uint32_t x_ext_buf_assigned : 1;
uint32_t y_ext_buf_assigned : 1;
uint32_t x_axis_sec : 1;
uint32_t y_axis_sec : 1;
};
struct _lv_chart_cursor_t {
lv_point_t pos;
int32_t point_id;
lv_color_t color;
lv_chart_series_t * ser;
lv_dir_t dir;
uint32_t pos_set: 1; /**< 1: pos is set; 0: point_id is set*/
};
struct _lv_chart_t {
lv_obj_t obj;
lv_ll_t series_ll; /**< Linked list for the series (stores lv_chart_series_t)*/
lv_ll_t cursor_ll; /**< Linked list for the cursors (stores lv_chart_cursor_t)*/
int32_t ymin[2];
int32_t ymax[2];
int32_t xmin[2];
int32_t xmax[2];
int32_t pressed_point_id;
uint32_t hdiv_cnt; /**< Number of horizontal division lines*/
uint32_t vdiv_cnt; /**< Number of vertical division lines*/
uint32_t point_cnt; /**< Point number in a data line*/
lv_chart_type_t type : 3; /**< Line or column chart*/
lv_chart_update_mode_t update_mode : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_CHART != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHART_PRIVATE_H*/
@@ -0,0 +1,79 @@
/**
* @file lv_checkbox.h
*
*/
#ifndef LV_CHECKBOX_H
#define LV_CHECKBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_CHECKBOX != 0
/*********************
* DEFINES
*********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_checkbox_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a check box object
* @param parent pointer to an object, it will be the parent of the new button
* @return pointer to the created check box
*/
lv_obj_t * lv_checkbox_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param obj pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_checkbox_set_text(lv_obj_t * obj, const char * txt);
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param obj pointer to a check box
* @param txt the text of the check box.
*/
void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a check box
* @param obj pointer to check box object
* @return pointer to the text of the check box
*/
const char * lv_checkbox_get_text(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CHECKBOX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHECKBOX_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_checkbox_private.h
*
*/
#ifndef LV_CHECKBOX_PRIVATE_H
#define LV_CHECKBOX_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_checkbox.h"
#if LV_USE_CHECKBOX != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_checkbox_t {
lv_obj_t obj;
char * txt;
uint32_t static_txt : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_CHECKBOX != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHECKBOX_PRIVATE_H*/
@@ -0,0 +1,246 @@
/**
* @file lv_dropdown.h
*
*/
#ifndef LV_DROPDOWN_H
#define LV_DROPDOWN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_DROPDOWN != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_dropdown: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
#endif
#include "../label/lv_label.h"
/*********************
* DEFINES
*********************/
#define LV_DROPDOWN_POS_LAST 0xFFFF
LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST);
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(DROPDOWN, TEXT, LV_PROPERTY_TYPE_TEXT, 0),
LV_PROPERTY_ID(DROPDOWN, OPTIONS, LV_PROPERTY_TYPE_TEXT, 1),
LV_PROPERTY_ID(DROPDOWN, OPTION_COUNT, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(DROPDOWN, SELECTED, LV_PROPERTY_TYPE_INT, 3),
// LV_PROPERTY_ID(DROPDOWN, SELECTED_STR, LV_PROPERTY_TYPE_TEXT, 4),
LV_PROPERTY_ID(DROPDOWN, DIR, LV_PROPERTY_TYPE_INT, 5),
LV_PROPERTY_ID(DROPDOWN, SYMBOL, LV_PROPERTY_TYPE_TEXT, 6),
LV_PROPERTY_ID(DROPDOWN, SELECTED_HIGHLIGHT, LV_PROPERTY_TYPE_INT, 7),
LV_PROPERTY_ID(DROPDOWN, LIST, LV_PROPERTY_TYPE_OBJ, 8),
LV_PROPERTY_ID(DROPDOWN, IS_OPEN, LV_PROPERTY_TYPE_BOOL, 9),
LV_PROPERTY_DROPDOWN_END,
};
#endif
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdown_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdownlist_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a drop-down list object
* @param parent pointer to an object, it will be the parent of the new drop-down list
* @return pointer to the created drop-down list
*/
lv_obj_t * lv_dropdown_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set text of the drop-down list's button.
* If set to `NULL` the selected option's text will be displayed on the button.
* If set to a specific text then that text will be shown regardless of the selected option.
* @param obj pointer to a drop-down list object
* @param txt the text as a string (Only its pointer is saved)
*/
void lv_dropdown_set_text(lv_obj_t * obj, const char * txt);
/**
* Set the options in a drop-down list from a string.
* The options will be copied and saved in the object so the `options` can be destroyed after calling this function
* @param obj pointer to drop-down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void lv_dropdown_set_options(lv_obj_t * obj, const char * options);
/**
* Set the options in a drop-down list from a static string (global, static or dynamically allocated).
* Only the pointer of the option string will be saved.
* @param obj pointer to drop-down list object
* @param options a static string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void lv_dropdown_set_options_static(lv_obj_t * obj, const char * options);
/**
* Add an options to a drop-down list from a string. Only works for non-static options.
* @param obj pointer to drop-down list object
* @param option a string without '\n'. E.g. "Four"
* @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string
*/
void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos);
/**
* Clear all options in a drop-down list. Works with both static and dynamic options.
* @param obj pointer to drop-down list object
*/
void lv_dropdown_clear_options(lv_obj_t * obj);
/**
* Set the selected option
* @param obj pointer to drop-down list object
* @param sel_opt id of the selected option (0 ... number of option - 1);
*/
void lv_dropdown_set_selected(lv_obj_t * obj, uint32_t sel_opt);
/**
* Set the direction of the a drop-down list
* @param obj pointer to a drop-down list object
* @param dir LV_DIR_LEFT/RIGHT/TOP/BOTTOM
*/
void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir);
/**
* Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow.
* @param obj pointer to drop-down list object
* @param symbol a text like `LV_SYMBOL_DOWN`, an image (pointer or path) or NULL to not draw symbol icon
* @note angle and zoom transformation can be applied if the symbol is an image.
* E.g. when drop down is checked (opened) rotate the symbol by 180 degree
*/
void lv_dropdown_set_symbol(lv_obj_t * obj, const void * symbol);
/**
* Set whether the selected option in the list should be highlighted or not
* @param obj pointer to drop-down list object
* @param en true: highlight enabled; false: disabled
*/
void lv_dropdown_set_selected_highlight(lv_obj_t * obj, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the list of a drop-down to allow styling or other modifications
* @param obj pointer to a drop-down list object
* @return pointer to the list of the drop-down
*/
lv_obj_t * lv_dropdown_get_list(lv_obj_t * obj);
/**
* Get text of the drop-down list's button.
* @param obj pointer to a drop-down list object
* @return the text as string, `NULL` if no text
*/
const char * lv_dropdown_get_text(lv_obj_t * obj);
/**
* Get the options of a drop-down list
* @param obj pointer to drop-down list object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_dropdown_get_options(const lv_obj_t * obj);
/**
* Get the index of the selected option
* @param obj pointer to drop-down list object
* @return index of the selected option (0 ... number of option - 1);
*/
uint32_t lv_dropdown_get_selected(const lv_obj_t * obj);
/**
* Get the total number of options
* @param obj pointer to drop-down list object
* @return the total number of options in the list
*/
uint32_t lv_dropdown_get_option_count(const lv_obj_t * obj);
/**
* Get the current selected option as a string
* @param obj pointer to drop-down object
* @param buf pointer to an array to store the string
* @param buf_size size of `buf` in bytes. 0: to ignore it.
*/
void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size);
/**
* Get the index of an option.
* @param obj pointer to drop-down object
* @param option an option as string
* @return index of `option` in the list of all options. -1 if not found.
*/
int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option);
/**
* Get the symbol on the drop-down list. Typically a down caret or arrow.
* @param obj pointer to drop-down list object
* @return the symbol or NULL if not enabled
*/
const char * lv_dropdown_get_symbol(lv_obj_t * obj);
/**
* Get whether the selected option in the list should be highlighted or not
* @param obj pointer to drop-down list object
* @return true: highlight enabled; false: disabled
*/
bool lv_dropdown_get_selected_highlight(lv_obj_t * obj);
/**
* Get the direction of the drop-down list
* @param obj pointer to a drop-down list object
* @return LV_DIR_LEF/RIGHT/TOP/BOTTOM
*/
lv_dir_t lv_dropdown_get_dir(const lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Open the drop.down list
* @param dropdown_obj pointer to drop-down list object
*/
void lv_dropdown_open(lv_obj_t * dropdown_obj);
/**
* Close (Collapse) the drop-down list
* @param obj pointer to drop-down list object
*/
void lv_dropdown_close(lv_obj_t * obj);
/**
* Tells whether the list is opened or not
* @param obj pointer to a drop-down list object
* @return true if the list os opened
*/
bool lv_dropdown_is_open(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DROPDOWN*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DROPDOWN_H*/
@@ -0,0 +1,69 @@
/**
* @file lv_dropdown_private.h
*
*/
#ifndef LV_DROPDOWN_PRIVATE_H
#define LV_DROPDOWN_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_dropdown.h"
#if LV_USE_DROPDOWN != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_dropdown_t {
lv_obj_t obj;
lv_obj_t * list; /**< The dropped down list*/
const char * text; /**< Text to display on the dropdown's button*/
const void * symbol; /**< Arrow or other icon when the drop-down list is closed*/
char * options; /**< Options in a '\n' separated list*/
uint32_t option_cnt; /**< Number of options*/
uint32_t sel_opt_id; /**< Index of the currently selected option*/
uint32_t sel_opt_id_orig; /**< Store the original index on focus*/
uint32_t pr_opt_id; /**< Index of the currently pressed option*/
uint8_t dir : 4; /**< Direction in which the list should open*/
uint8_t static_txt : 1; /**< 1: Only a pointer is saved in `options`*/
uint8_t selected_highlight: 1; /**< 1: Make the selected option highlighted in the list*/
};
struct _lv_dropdown_list_t {
lv_obj_t obj;
lv_obj_t * dropdown;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_DROPDOWN != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DROPDOWN_PRIVATE_H*/
+310
View File
@@ -0,0 +1,310 @@
/**
* @file lv_image.h
*
*/
#ifndef LV_IMAGE_H
#define LV_IMAGE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_IMAGE != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
#endif
#include "../../core/lv_obj.h"
#include "../../misc/lv_fs.h"
#include "../../draw/lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_image_class;
/**
* Image size mode, when image size and object size is different
*/
typedef enum {
LV_IMAGE_ALIGN_DEFAULT = 0,
LV_IMAGE_ALIGN_TOP_LEFT,
LV_IMAGE_ALIGN_TOP_MID,
LV_IMAGE_ALIGN_TOP_RIGHT,
LV_IMAGE_ALIGN_BOTTOM_LEFT,
LV_IMAGE_ALIGN_BOTTOM_MID,
LV_IMAGE_ALIGN_BOTTOM_RIGHT,
LV_IMAGE_ALIGN_LEFT_MID,
LV_IMAGE_ALIGN_RIGHT_MID,
LV_IMAGE_ALIGN_CENTER,
LV_IMAGE_ALIGN_AUTO_TRANSFORM,
LV_IMAGE_ALIGN_STRETCH,
LV_IMAGE_ALIGN_TILE,
} lv_image_align_t;
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(IMAGE, SRC, LV_PROPERTY_TYPE_IMGSRC, 0),
LV_PROPERTY_ID(IMAGE, OFFSET_X, LV_PROPERTY_TYPE_INT, 1),
LV_PROPERTY_ID(IMAGE, OFFSET_Y, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(IMAGE, ROTATION, LV_PROPERTY_TYPE_INT, 3),
LV_PROPERTY_ID(IMAGE, PIVOT, LV_PROPERTY_TYPE_POINT, 4),
LV_PROPERTY_ID(IMAGE, SCALE, LV_PROPERTY_TYPE_INT, 5),
LV_PROPERTY_ID(IMAGE, SCALE_X, LV_PROPERTY_TYPE_INT, 6),
LV_PROPERTY_ID(IMAGE, SCALE_Y, LV_PROPERTY_TYPE_INT, 7),
LV_PROPERTY_ID(IMAGE, BLEND_MODE, LV_PROPERTY_TYPE_INT, 8),
LV_PROPERTY_ID(IMAGE, ANTIALIAS, LV_PROPERTY_TYPE_INT, 9),
LV_PROPERTY_ID(IMAGE, INNER_ALIGN, LV_PROPERTY_TYPE_INT, 10),
LV_PROPERTY_IMAGE_END,
};
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an image object
* @param parent pointer to an object, it will be the parent of the new image
* @return pointer to the created image
*/
lv_obj_t * lv_image_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the image data to display on the object
* @param obj pointer to an image object
* @param src 1) pointer to an ::lv_image_dsc_t descriptor (converted by LVGL's image converter) (e.g. &my_img) or
* 2) path to an image file (e.g. "S:/dir/img.bin")or
* 3) a SYMBOL (e.g. LV_SYMBOL_OK)
*/
void lv_image_set_src(lv_obj_t * obj, const void * src);
/**
* Set an offset for the source of an image so the image will be displayed from the new origin.
* @param obj pointer to an image
* @param x the new offset along x axis.
*/
void lv_image_set_offset_x(lv_obj_t * obj, int32_t x);
/**
* Set an offset for the source of an image.
* so the image will be displayed from the new origin.
* @param obj pointer to an image
* @param y the new offset along y axis.
*/
void lv_image_set_offset_y(lv_obj_t * obj, int32_t y);
/**
* Set the rotation angle of the image.
* The image will be rotated around the set pivot set by `lv_image_set_pivot()`
* Note that indexed and alpha only images can't be transformed.
* @param obj pointer to an image object
* @param angle rotation in degree with 0.1 degree resolution (0..3600: clock wise)
* @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT`
* rotation will be set to 0 automatically.
*
*/
void lv_image_set_rotation(lv_obj_t * obj, int32_t angle);
/**
* Set the rotation center of the image.
* The image will be rotated around this point.
* x, y can be set with value of LV_PCT, lv_image_get_pivot will return the true pixel coordinate of pivot in this case.
* @param obj pointer to an image object
* @param x rotation center x of the image
* @param y rotation center y of the image
*/
void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y);
/**
* Set the zoom factor of the image.
* Note that indexed and alpha only images can't be transformed.
* @param obj pointer to an image object
* @param zoom the zoom factor. Example values:
* - 256 or LV_ZOOM_IMAGE_NONE: no zoom
* - <256: scale down
* - >256: scale up
* - 128: half size
* - 512: double size
*/
void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom);
/**
* Set the horizontal zoom factor of the image.
* Note that indexed and alpha only images can't be transformed.
* @param obj pointer to an image object
* @param zoom the zoom factor. Example values:
* - 256 or LV_ZOOM_IMAGE_NONE: no zoom
* - <256: scale down
* - >256: scale up
* - 128: half size
* - 512: double size
*/
void lv_image_set_scale_x(lv_obj_t * obj, uint32_t zoom);
/**
* Set the vertical zoom factor of the image.
* Note that indexed and alpha only images can't be transformed.
* @param obj pointer to an image object
* @param zoom the zoom factor. Example values:
* - 256 or LV_ZOOM_IMAGE_NONE: no zoom
* - <256: scale down
* - >256: scale up
* - 128: half size
* - 512: double size
*/
void lv_image_set_scale_y(lv_obj_t * obj, uint32_t zoom);
/**
* Set the blend mode of an image.
* @param obj pointer to an image object
* @param blend_mode the new blend mode
*/
void lv_image_set_blend_mode(lv_obj_t * obj, lv_blend_mode_t blend_mode);
/**
* Enable/disable anti-aliasing for the transformations (rotate, zoom) or not.
* The quality is better with anti-aliasing looks better but slower.
* @param obj pointer to an image object
* @param antialias true: anti-aliased; false: not anti-aliased
*/
void lv_image_set_antialias(lv_obj_t * obj, bool antialias);
/**
* Set the image object size mode.
* @param obj pointer to an image object
* @param align the new align mode.
* @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT`
* rotation, scale and pivot will be overwritten and controlled internally.
*/
void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align);
/**
* Set an A8 bitmap mask for the image.
* @param obj pointer to an image object
* @param src an lv_image_dsc_t bitmap mask source.
*/
void lv_image_set_bitmap_map_src(lv_obj_t * obj, const lv_image_dsc_t * src);
/*=====================
* Getter functions
*====================*/
/**
* Get the source of the image
* @param obj pointer to an image object
* @return the image source (symbol, file name or ::lv-img_dsc_t for C arrays)
*/
const void * lv_image_get_src(lv_obj_t * obj);
/**
* Get the offset's x attribute of the image object.
* @param obj pointer to an image
* @return offset X value.
*/
int32_t lv_image_get_offset_x(lv_obj_t * obj);
/**
* Get the offset's y attribute of the image object.
* @param obj pointer to an image
* @return offset Y value.
*/
int32_t lv_image_get_offset_y(lv_obj_t * obj);
/**
* Get the rotation of the image.
* @param obj pointer to an image object
* @return rotation in 0.1 degrees (0..3600)
* @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT`
* rotation will be set to 0 automatically.
*/
int32_t lv_image_get_rotation(lv_obj_t * obj);
/**
* Get the pivot (rotation center) of the image.
* If pivot is set with LV_PCT, convert it to px before return.
* @param obj pointer to an image object
* @param pivot store the rotation center here
*/
void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot);
/**
* Get the zoom factor of the image.
* @param obj pointer to an image object
* @return zoom factor (256: no zoom)
*/
int32_t lv_image_get_scale(lv_obj_t * obj);
/**
* Get the horizontal zoom factor of the image.
* @param obj pointer to an image object
* @return zoom factor (256: no zoom)
*/
int32_t lv_image_get_scale_x(lv_obj_t * obj);
/**
* Get the vertical zoom factor of the image.
* @param obj pointer to an image object
* @return zoom factor (256: no zoom)
*/
int32_t lv_image_get_scale_y(lv_obj_t * obj);
/**
* Get the current blend mode of the image
* @param obj pointer to an image object
* @return the current blend mode
*/
lv_blend_mode_t lv_image_get_blend_mode(lv_obj_t * obj);
/**
* Get whether the transformations (rotate, zoom) are anti-aliased or not
* @param obj pointer to an image object
* @return true: anti-aliased; false: not anti-aliased
*/
bool lv_image_get_antialias(lv_obj_t * obj);
/**
* Get the size mode of the image
* @param obj pointer to an image object
* @return element of `lv_image_align_t`
*/
lv_image_align_t lv_image_get_inner_align(lv_obj_t * obj);
/**
* Get the bitmap mask source.
* @param obj pointer to an image object
* @return an lv_image_dsc_t bitmap mask source.
*/
const lv_image_dsc_t * lv_image_get_bitmap_map_src(lv_obj_t * obj);
/**********************
* MACROS
**********************/
/** Use this macro to declare an image in a C file*/
#define LV_IMAGE_DECLARE(var_name) extern const lv_image_dsc_t var_name
#endif /*LV_USE_IMAGE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMAGE_H*/
@@ -0,0 +1,66 @@
/**
* @file lv_image_private.h
*
*/
#ifndef LV_IMAGE_PRIVATE_H
#define LV_IMAGE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_image.h"
#if LV_USE_IMAGE != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Data of image
*/
struct _lv_image_t {
lv_obj_t obj;
const void * src; /**< Image source: Pointer to an array or a file or a symbol*/
const lv_image_dsc_t * bitmap_mask_src; /**< Pointer to an A8 bitmap mask */
lv_point_t offset;
int32_t w; /**< Width of the image (Handled by the library)*/
int32_t h; /**< Height of the image (Handled by the library)*/
uint32_t rotation; /**< Rotation angle of the image*/
uint32_t scale_x; /**< 256 means no zoom, 512 double size, 128 half size*/
uint32_t scale_y; /**< 256 means no zoom, 512 double size, 128 half size*/
lv_point_t pivot; /**< Rotation center of the image*/
uint32_t src_type : 2; /**< See: lv_image_src_t*/
uint32_t cf : 5; /**< Color format from `lv_color_format_t`*/
uint32_t antialias : 1; /**< Apply anti-aliasing in transformations (rotate, zoom)*/
uint32_t align: 4; /**< Image size mode when image size and object size is different. See lv_image_align_t*/
uint32_t blend_mode: 4; /**< Element of `lv_blend_mode_t`*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_IMAGE != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMAGE_PRIVATE_H*/
@@ -0,0 +1,121 @@
/**
* @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;
/**********************
* TYPEDEFS
**********************/
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*/
@@ -0,0 +1,58 @@
/**
* @file lv_imagebutton_private.h
*
*/
#ifndef LV_IMAGEBUTTON_PRIVATE_H
#define LV_IMAGEBUTTON_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_imagebutton.h"
#if LV_USE_IMAGEBUTTON != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_imagebutton_src_info_t {
const void * img_src;
lv_image_header_t header;
};
/** Data of image button */
struct _lv_imagebutton_t {
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 */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_IMAGEBUTTON != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMAGEBUTTON_PRIVATE_H*/
@@ -0,0 +1,183 @@
/**
* @file lv_keyboard.h
*
*/
#ifndef LV_KEYBOARD_H
#define LV_KEYBOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../buttonmatrix/lv_buttonmatrix.h"
#if LV_USE_KEYBOARD
/*Testing of dependencies*/
#if LV_USE_BUTTONMATRIX == 0
#error "lv_buttonmatrix is required. Enable it in lv_conf.h (LV_USE_BUTTONMATRIX 1) "
#endif
#if LV_USE_TEXTAREA == 0
#error "lv_textarea is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
/*********************
* DEFINES
*********************/
#define LV_KEYBOARD_CTRL_BUTTON_FLAGS (LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_CHECKED)
/**********************
* TYPEDEFS
**********************/
/** Current keyboard mode.*/
typedef enum {
LV_KEYBOARD_MODE_TEXT_LOWER,
LV_KEYBOARD_MODE_TEXT_UPPER,
LV_KEYBOARD_MODE_SPECIAL,
LV_KEYBOARD_MODE_NUMBER,
LV_KEYBOARD_MODE_USER_1,
LV_KEYBOARD_MODE_USER_2,
LV_KEYBOARD_MODE_USER_3,
LV_KEYBOARD_MODE_USER_4,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
LV_KEYBOARD_MODE_TEXT_ARABIC
#endif
} lv_keyboard_mode_t;
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(KEYBOARD, TEXTAREA, LV_PROPERTY_TYPE_OBJ, 0),
LV_PROPERTY_ID(KEYBOARD, MODE, LV_PROPERTY_TYPE_INT, 1),
LV_PROPERTY_ID(KEYBOARD, POPOVERS, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(KEYBOARD, SELECTED_BUTTON, LV_PROPERTY_TYPE_INT, 3),
LV_PROPERTY_KEYBOARD_END,
};
#endif
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_keyboard_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Keyboard object
* @param parent pointer to an object, it will be the parent of the new keyboard
* @return pointer to the created keyboard
*/
lv_obj_t * lv_keyboard_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @param ta pointer to a Text Area object to write there
*/
void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @param mode the mode from 'lv_keyboard_mode_t'
*/
void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
/**
* Show the button title in a popover when pressed.
* @param kb pointer to a Keyboard object
* @param en whether "popovers" mode is enabled
*/
void lv_keyboard_set_popovers(lv_obj_t * kb, bool en);
/**
* Set a new map for the keyboard
* @param kb pointer to a Keyboard object
* @param mode keyboard map to alter 'lv_keyboard_mode_t'
* @param map pointer to a string array to describe the map.
* See 'lv_buttonmatrix_set_map()' for more info.
* @param ctrl_map See 'lv_buttonmatrix_set_ctrl_map()' for more info.
*/
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * const map[],
const lv_buttonmatrix_ctrl_t ctrl_map[]);
/*=====================
* Getter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_keyboard_mode_t'
*/
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb);
/**
* Tell whether "popovers" mode is enabled or not.
* @param obj pointer to a Keyboard object
* @return true: "popovers" mode is enabled; false: disabled
*/
bool lv_keyboard_get_popovers(const lv_obj_t * obj);
/**
* Get the current map of a keyboard
* @param kb pointer to a keyboard object
* @return the current map
*/
const char * const * lv_keyboard_get_map_array(const lv_obj_t * kb);
/**
* Get the index of the lastly "activated" button by the user (pressed, released, focused etc)
* Useful in the `event_cb` to get the text of the button, check if hidden etc.
* @param obj pointer to button matrix object
* @return index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset)
*/
uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj);
/**
* Get the button's text
* @param obj pointer to button matrix object
* @param btn_id the index a button not counting new line characters.
* @return text of btn_index` button
*/
const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id);
/*=====================
* Other functions
*====================*/
/**
* Default keyboard event to add characters to the Text area and change the map.
* If a custom `event_cb` is added to the keyboard this function can be called from it to handle the
* button clicks
* @param e the triggering event
*/
void lv_keyboard_def_event_cb(lv_event_t * e);
/**********************
* MACROS
**********************/
#endif /*LV_USE_KEYBOARD*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_KEYBOARD_H*/
@@ -0,0 +1,53 @@
/**
* @file lv_keyboard_private.h
*
*/
#ifndef LV_KEYBOARD_PRIVATE_H
#define LV_KEYBOARD_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../buttonmatrix/lv_buttonmatrix_private.h"
#include "lv_keyboard.h"
#if LV_USE_KEYBOARD
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of keyboard */
struct _lv_keyboard_t {
lv_buttonmatrix_t btnm;
lv_obj_t * ta; /**< Pointer to the assigned text area */
lv_keyboard_mode_t mode; /**< Key map type */
uint8_t popovers : 1; /**< Show button titles in popovers on press */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_KEYBOARD */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_KEYBOARD_PRIVATE_H*/
+238
View File
@@ -0,0 +1,238 @@
/**
* @file lv_label.h
*
*/
#ifndef LV_LABEL_H
#define LV_LABEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_LABEL != 0
#include "../../misc/lv_types.h"
#include "../../core/lv_obj.h"
#include "../../font/lv_font.h"
#include "../../font/lv_symbol_def.h"
#include "../../misc/lv_text.h"
#include "../../draw/lv_draw.h"
/*********************
* DEFINES
*********************/
#define LV_LABEL_DOT_NUM 3
#define LV_LABEL_POS_LAST 0xFFFF
#define LV_LABEL_TEXT_SELECTION_OFF LV_DRAW_LABEL_NO_TXT_SEL
#if LV_WIDGETS_HAS_DEFAULT_VALUE
#define LV_LABEL_DEFAULT_TEXT "Text"
#else
#define LV_LABEL_DEFAULT_TEXT ""
#endif
LV_EXPORT_CONST_INT(LV_LABEL_DOT_NUM);
LV_EXPORT_CONST_INT(LV_LABEL_POS_LAST);
LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SELECTION_OFF);
/**********************
* TYPEDEFS
**********************/
/** Long mode behaviors. Used in 'lv_label_ext_t'*/
typedef enum {
LV_LABEL_LONG_WRAP, /**< Keep the object width, wrap lines longer than object width and expand the object height*/
LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/
LV_LABEL_LONG_SCROLL, /**< Keep the size and roll the text back and forth*/
LV_LABEL_LONG_SCROLL_CIRCULAR, /**< Keep the size and roll the text circularly*/
LV_LABEL_LONG_CLIP, /**< Keep the size and clip the text out of it*/
} lv_label_long_mode_t;
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(LABEL, TEXT, LV_PROPERTY_TYPE_TEXT, 0),
LV_PROPERTY_ID(LABEL, LONG_MODE, LV_PROPERTY_TYPE_INT, 1),
LV_PROPERTY_ID(LABEL, TEXT_SELECTION_START, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(LABEL, TEXT_SELECTION_END, LV_PROPERTY_TYPE_INT, 3),
LV_PROPERTY_LABEL_END,
};
#endif
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_label_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a label object
* @param parent pointer to an object, it will be the parent of the new label.
* @return pointer to the created button
*/
lv_obj_t * lv_label_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
* @param obj pointer to a label object
* @param text '\0' terminated character string. NULL to refresh with the current text.
*/
void lv_label_set_text(lv_obj_t * obj, const char * text);
/**
* Set a new formatted text for a label. Memory will be allocated to store the text by the label.
* @param obj pointer to a label object
* @param fmt `printf`-like format
*
* Example:
* @code
* lv_label_set_text_fmt(label1, "%d user", user_num);
* @endcode
*/
void lv_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3);
/**
* Set a static text. It will not be saved by the label so the 'text' variable
* has to be 'alive' while the label exists.
* @param obj pointer to a label object
* @param text pointer to a text. NULL to refresh with the current text.
*/
void lv_label_set_text_static(lv_obj_t * obj, const char * text);
/**
* Set the behavior of the label with text longer than the object size
* @param obj pointer to a label object
* @param long_mode the new mode from 'lv_label_long_mode' enum.
* In LV_LONG_WRAP/DOT/SCROLL/SCROLL_CIRC the size of the label should be set AFTER this function
*/
void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode);
/**
* Set where text selection should start
* @param obj pointer to a label object
* @param index character index from where selection should start. `LV_LABEL_TEXT_SELECTION_OFF` for no selection
*/
void lv_label_set_text_selection_start(lv_obj_t * obj, uint32_t index);
/**
* Set where text selection should end
* @param obj pointer to a label object
* @param index character index where selection should end. `LV_LABEL_TEXT_SELECTION_OFF` for no selection
*/
void lv_label_set_text_selection_end(lv_obj_t * obj, uint32_t index);
/**
* Enable the recoloring by in-line commands
* @param obj pointer to a label object
* @param en true: enable recoloring, false: disable
* @example "This is a #ff0000 red# word"
*/
void lv_label_set_recolor(lv_obj_t * obj, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a label
* @param obj pointer to a label object
* @return the text of the label
*/
char * lv_label_get_text(const lv_obj_t * obj);
/**
* Get the long mode of a label
* @param obj pointer to a label object
* @return the current long mode
*/
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * obj);
/**
* Get the relative x and y coordinates of a letter
* @param obj pointer to a label object
* @param char_id index of the character [0 ... text length - 1].
* Expressed in character index, not byte index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates if the text if aligned to the left)
*/
void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t * pos);
/**
* Get the index of letter on a relative point of a label.
* @param obj pointer to label object
* @param pos_in pointer to point with coordinates on a the label
* @param bidi whether to use bidi processed
* @return The index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter if aligned to the left)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in, bool bidi);
/**
* Check if a character is drawn under a point.
* @param obj pointer to a label object
* @param pos Point to check for character under
* @return whether a character is drawn under the point
*/
bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos);
/**
* @brief Get the selection start index.
* @param obj pointer to a label object.
* @return selection start index. `LV_LABEL_TEXT_SELECTION_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_selection_start(const lv_obj_t * obj);
/**
* @brief Get the selection end index.
* @param obj pointer to a label object.
* @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_selection_end(const lv_obj_t * obj);
/**
* @brief Get the recoloring attribute
* @param obj pointer to a label object.
* @return true: recoloring is enabled, false: recoloring is disabled
*/
bool lv_label_get_recolor(const lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Insert a text to a label. The label text cannot be static.
* @param obj pointer to a label object
* @param pos character index to insert. Expressed in character index and not byte index.
* 0: before first char. LV_LABEL_POS_LAST: after last char.
* @param txt pointer to the text to insert
*/
void lv_label_ins_text(lv_obj_t * obj, uint32_t pos, const char * txt);
/**
* Delete characters from a label. The label text cannot be static.
* @param obj pointer to a label object
* @param pos character index from where to cut. Expressed in character index and not byte index.
* 0: start in front of the first character
* @param cnt number of characters to cut
*/
void lv_label_cut_text(lv_obj_t * obj, uint32_t pos, uint32_t cnt);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LABEL*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LABEL_H*/
@@ -0,0 +1,74 @@
/**
* @file lv_label_private.h
*
*/
#ifndef LV_LABEL_PRIVATE_H
#define LV_LABEL_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../draw/lv_draw_label_private.h"
#include "../../core/lv_obj_private.h"
#include "lv_label.h"
#if LV_USE_LABEL != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_label_t {
lv_obj_t obj;
char * text;
union {
char * tmp_ptr; /**< Pointer to the allocated memory containing the character replaced by dots */
char tmp[LV_LABEL_DOT_NUM + 1]; /**< Directly store the characters if <=4 characters */
} dot;
uint32_t dot_end; /**< The real text length, used in dot mode */
#if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t hint;
#endif
#if LV_LABEL_TEXT_SELECTION
uint32_t sel_start;
uint32_t sel_end;
#endif
lv_point_t size_cache; /**< Text size cache */
lv_point_t offset; /**< Text draw position offset */
lv_label_long_mode_t long_mode : 3; /**< Determine what to do with the long texts */
uint8_t static_txt : 1; /**< Flag to indicate the text is static */
uint8_t recolor : 1; /**< Enable in-line letter re-coloring*/
uint8_t expand : 1; /**< Ignore real width (used by the library with LV_LABEL_LONG_SCROLL) */
uint8_t dot_tmp_alloc : 1; /**< 1: dot is allocated, 0: dot directly holds up to 4 chars */
uint8_t invalid_size_cache : 1; /**< 1: Recalculate size and update cache */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_LABEL != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LABEL_PRIVATE_H*/
+99
View File
@@ -0,0 +1,99 @@
/**
* @file lv_led.h
*
*/
#ifndef LV_LED_H
#define LV_LED_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_LED
/*********************
* DEFINES
*********************/
/** Brightness when the LED if OFF */
#ifndef LV_LED_BRIGHT_MIN
# define LV_LED_BRIGHT_MIN 80
#endif
/** Brightness when the LED if ON */
#ifndef LV_LED_BRIGHT_MAX
# define LV_LED_BRIGHT_MAX 255
#endif
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a led object
* @param parent pointer to an object, it will be the parent of the new led
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * parent);
/**
* Set the color of the LED
* @param led pointer to a LED object
* @param color the color of the LED
*/
void lv_led_set_color(lv_obj_t * led, lv_color_t color);
/**
* Set the brightness of a LED object
* @param led pointer to a LED object
* @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light)
*/
void lv_led_set_brightness(lv_obj_t * led, uint8_t bright);
/**
* Light on a LED
* @param led pointer to a LED object
*/
void lv_led_on(lv_obj_t * led);
/**
* Light off a LED
* @param led pointer to a LED object
*/
void lv_led_off(lv_obj_t * led);
/**
* Toggle the state of a LED
* @param led pointer to a LED object
*/
void lv_led_toggle(lv_obj_t * led);
/**
* Get the brightness of a LED object
* @param obj pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_brightness(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LED*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LED_H*/
@@ -0,0 +1,52 @@
/**
* @file lv_led_private.h
*
*/
#ifndef LV_LED_PRIVATE_H
#define LV_LED_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_led.h"
#if LV_USE_LED
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of led */
struct _lv_led_t {
lv_obj_t obj;
lv_color_t color;
uint8_t bright; /**< Current brightness of the LED (0..255)*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_LED */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LED_PRIVATE_H*/
+118
View File
@@ -0,0 +1,118 @@
/**
* @file lv_line.h
*
*/
#ifndef LV_LINE_H
#define LV_LINE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_LINE != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a line object
* @param parent pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set an array of points. The line object will connect these points.
* @param obj pointer to a line object
* @param points an array of points. Only the address is saved, so the array needs to be alive while the line exists
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * obj, const lv_point_precise_t points[], uint32_t point_num);
/**
* Set a non-const array of points. Identical to `lv_line_set_points` except the array may be retrieved by `lv_line_get_points_mutable`.
* @param obj pointer to a line object
* @param points a non-const array of points. Only the address is saved, so the array needs to be alive while the line exists.
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points_mutable(lv_obj_t * obj, lv_point_precise_t points[], uint32_t point_num);
/**
* Enable (or disable) the y coordinate inversion.
* If enabled then y will be subtracted from the height of the object,
* therefore the y = 0 coordinate will be on the bottom.
* @param obj pointer to a line object
* @param en true: enable the y inversion, false:disable the y inversion
*/
void lv_line_set_y_invert(lv_obj_t * obj, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the pointer to the array of points.
* @param obj pointer to a line object
* @return const pointer to the array of points
*/
const lv_point_precise_t * lv_line_get_points(lv_obj_t * obj);
/**
* Get the number of points in the array of points.
* @param obj pointer to a line object
* @return number of points in array of points
*/
uint32_t lv_line_get_point_count(lv_obj_t * obj);
/**
* Check the mutability of the stored point array pointer.
* @param obj pointer to a line object
* @return true: the point array pointer is mutable, false: constant
*/
bool lv_line_is_point_array_mutable(lv_obj_t * obj);
/**
* Get a pointer to the mutable array of points or NULL if it is not mutable
* @param obj pointer to a line object
* @return pointer to the array of points. NULL if not mutable.
*/
lv_point_precise_t * lv_line_get_points_mutable(lv_obj_t * obj);
/**
* Get the y inversion attribute
* @param obj pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_invert(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LINE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LINE_H*/
@@ -0,0 +1,57 @@
/**
* @file lv_line_private.h
*
*/
#ifndef LV_LINE_PRIVATE_H
#define LV_LINE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_line.h"
#if LV_USE_LINE != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of line */
struct _lv_line_t {
lv_obj_t obj;
union {
const lv_point_precise_t * constant;
lv_point_precise_t * mut;
} point_array; /**< Pointer to an array with the points of the line*/
uint32_t point_num; /**< Number of points in 'point_array'*/
uint32_t y_inv : 1; /**< 1: y == 0 will be on the bottom*/
uint32_t point_array_is_mutable : 1; /**< whether the point array is const or mutable*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_LINE != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LINE_PRIVATE_H*/
+85
View File
@@ -0,0 +1,85 @@
/**
* @file lv_list.h
*
*/
#ifndef LV_LIST_H
#define LV_LIST_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_LIST
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_text_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_list_button_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a list object
* @param parent pointer to an object, it will be the parent of the new list
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * parent);
/**
* Add text to a list
* @param list pointer to a list, it will be the parent of the new label
* @param txt text of the new label
* @return pointer to the created label
*/
lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt);
/**
* Add button to a list
* @param list pointer to a list, it will be the parent of the new button
* @param icon icon for the button, when NULL it will have no icon
* @param txt text of the new button, when NULL no text will be added
* @return pointer to the created button
*/
lv_obj_t * lv_list_add_button(lv_obj_t * list, const void * icon, const char * txt);
/**
* Get text of a given list button
* @param list pointer to a list
* @param btn pointer to the button
* @return text of btn, if btn doesn't have text "" will be returned
*/
const char * lv_list_get_button_text(lv_obj_t * list, lv_obj_t * btn);
/**
* Set text of a given list button
* @param list pointer to a list
* @param btn pointer to the button
* @param txt pointer to the text
*/
void lv_list_set_button_text(lv_obj_t * list, lv_obj_t * btn, const char * txt);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LIST*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LIST_H*/
+102
View File
@@ -0,0 +1,102 @@
/**
* @file lv_lottie.h
*
*/
#ifndef LV_LOTTIE_H
#define LV_LOTTIE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../misc/lv_types.h"
#if LV_USE_LOTTIE
/*Testing of dependencies*/
#if LV_USE_CANVAS == 0
#error "lv_lottie: lv_canvas is required. Enable it in lv_conf.h (LV_USE_CANVAS 1)"
#endif
#if LV_USE_THORVG == 0
#error "lv_lottie: ThorVG is required. Enable it in lv_conf.h (LV_USE_THORVG_INTERNAL/EXTERNAL 1)"
#endif
#include "../../draw/lv_draw_buf.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a lottie animation
* @param parent pointer to the parent widget
* @return pointer to the created Lottie animation widget
*/
lv_obj_t * lv_lottie_create(lv_obj_t * parent);
/**
* Set a buffer for the animation. It also defines the size of the animation
* @param obj pointer to a lottie widget
* @param w width of the animation and buffer
* @param h height of the animation and buffer
* @param buf a static buffer with `width x height x 4` byte size
*/
void lv_lottie_set_buffer(lv_obj_t * obj, int32_t w, int32_t h, void * buf);
/**
* Set a draw buffer for the animation. It also defines the size of the animation
* @param obj pointer to a lottie widget
* @param draw_buf an initialized draw buffer with ARGB8888 color format
*/
void lv_lottie_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf);
/**
* Set the source for the animation as an array
* @param obj pointer to a lottie widget
* @param src the lottie animation converted to an nul terminated array
* @param src_size size of the source array in bytes
*/
void lv_lottie_set_src_data(lv_obj_t * obj, const void * src, size_t src_size);
/**
* Set the source for the animation as a path.
* Lottie doesn't use LVGL's File System API.
* @param obj pointer to a lottie widget
* @param src path to a json file, e.g. "path/to/file.json"
*/
void lv_lottie_set_src_file(lv_obj_t * obj, const char * src);
/**
* Get the LVGL animation which controls the lottie animation
* @param obj pointer to a lottie widget
* @return the LVGL animation
*/
lv_anim_t * lv_lottie_get_anim(lv_obj_t * obj);
/**********************
* GLOBAL VARIABLES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_LOTTIE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LOTTIE_H*/
@@ -0,0 +1,60 @@
/**
* @file lv_lottie_private.h
*
*/
#ifndef LV_LOTTIE_PRIVATE_H
#define LV_LOTTIE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_LOTTIE
#include "lv_lottie.h"
#include "../canvas/lv_canvas_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
#if LV_USE_THORVG_EXTERNAL
#include <thorvg_capi.h>
#else
#include "../../libs/thorvg/thorvg_capi.h"
#endif
typedef struct {
lv_canvas_t canvas;
Tvg_Paint * tvg_paint;
Tvg_Canvas * tvg_canvas;
Tvg_Animation * tvg_anim;
lv_anim_t * anim;
int32_t last_rendered_time;
} lv_lottie_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_LOTTIE_H*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LOTTIE_PRIVATE_H*/
+213
View File
@@ -0,0 +1,213 @@
/**
* @file lv_menu.h
*
*/
#ifndef LV_MENU_H
#define LV_MENU_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_MENU
#if LV_USE_FLEX == 0
#error "LV_USE_FLEX needs to be enabled"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_MENU_HEADER_TOP_FIXED, /**< Header is positioned at the top */
LV_MENU_HEADER_TOP_UNFIXED, /**< Header is positioned at the top and can be scrolled out of view*/
LV_MENU_HEADER_BOTTOM_FIXED /**< Header is positioned at the bottom */
} lv_menu_mode_header_t;
typedef enum {
LV_MENU_ROOT_BACK_BUTTON_DISABLED,
LV_MENU_ROOT_BACK_BUTTON_ENABLED
} lv_menu_mode_root_back_button_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_page_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_cont_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_section_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_separator_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_cont_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_cont_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_sidebar_header_cont_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_main_header_cont_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a menu object
* @param parent pointer to an object, it will be the parent of the new menu
* @return pointer to the created menu
*/
lv_obj_t * lv_menu_create(lv_obj_t * parent);
/**
* Create a menu page object
* @param parent pointer to menu object
* @param title pointer to text for title in header (NULL to not display title)
* @return pointer to the created menu page
*/
lv_obj_t * lv_menu_page_create(lv_obj_t * parent, char const * const title);
/**
* Create a menu cont object
* @param parent pointer to an object, it will be the parent of the new menu cont object
* @return pointer to the created menu cont
*/
lv_obj_t * lv_menu_cont_create(lv_obj_t * parent);
/**
* Create a menu section object
* @param parent pointer to an object, it will be the parent of the new menu section object
* @return pointer to the created menu section
*/
lv_obj_t * lv_menu_section_create(lv_obj_t * parent);
/**
* Create a menu separator object
* @param parent pointer to an object, it will be the parent of the new menu separator object
* @return pointer to the created menu separator
*/
lv_obj_t * lv_menu_separator_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set menu page to display in main
* @param obj pointer to the menu
* @param page pointer to the menu page to set (NULL to clear main and clear menu history)
*/
void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page);
/**
* Set menu page title
* @param page pointer to the menu page
* @param title pointer to text for title in header (NULL to not display title)
*/
void lv_menu_set_page_title(lv_obj_t * page, char const * const title);
/**
* Set menu page title with a static text. It will not be saved by the label so the 'text' variable
* has to be 'alive' while the page exists.
* @param page pointer to the menu page
* @param title pointer to text for title in header (NULL to not display title)
*/
void lv_menu_set_page_title_static(lv_obj_t * page, char const * const title);
/**
* Set menu page to display in sidebar
* @param obj pointer to the menu
* @param page pointer to the menu page to set (NULL to clear sidebar)
*/
void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page);
/**
* Set the how the header should behave and its position
* @param obj pointer to a menu
* @param mode LV_MENU_HEADER_TOP_FIXED/TOP_UNFIXED/BOTTOM_FIXED
*/
void lv_menu_set_mode_header(lv_obj_t * obj, lv_menu_mode_header_t mode);
/**
* Set whether back button should appear at root
* @param obj pointer to a menu
* @param mode LV_MENU_ROOT_BACK_BUTTON_DISABLED/ENABLED
*/
void lv_menu_set_mode_root_back_button(lv_obj_t * obj, lv_menu_mode_root_back_button_t mode);
/**
* Add menu to the menu item
* @param menu pointer to the menu
* @param obj pointer to the obj
* @param page pointer to the page to load when obj is clicked
*/
void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * page);
/*=====================
* Getter functions
*====================*/
/**
* Get a pointer to menu page that is currently displayed in main
* @param obj pointer to the menu
* @return pointer to current page
*/
lv_obj_t * lv_menu_get_cur_main_page(lv_obj_t * obj);
/**
* Get a pointer to menu page that is currently displayed in sidebar
* @param obj pointer to the menu
* @return pointer to current page
*/
lv_obj_t * lv_menu_get_cur_sidebar_page(lv_obj_t * obj);
/**
* Get a pointer to main header obj
* @param obj pointer to the menu
* @return pointer to main header obj
*/
lv_obj_t * lv_menu_get_main_header(lv_obj_t * obj);
/**
* Get a pointer to main header back btn obj
* @param obj pointer to the menu
* @return pointer to main header back btn obj
*/
lv_obj_t * lv_menu_get_main_header_back_button(lv_obj_t * obj);
/**
* Get a pointer to sidebar header obj
* @param obj pointer to the menu
* @return pointer to sidebar header obj
*/
lv_obj_t * lv_menu_get_sidebar_header(lv_obj_t * obj);
/**
* Get a pointer to sidebar header obj
* @param obj pointer to the menu
* @return pointer to sidebar header back btn obj
*/
lv_obj_t * lv_menu_get_sidebar_header_back_button(lv_obj_t * obj);
/**
* Check if an obj is a root back btn
* @param menu pointer to the menu
* @param obj pointer to the back button
* @return true if it is a root back btn
*/
bool lv_menu_back_button_is_root(lv_obj_t * menu, lv_obj_t * obj);
/**
* Clear menu history
* @param obj pointer to the menu
*/
void lv_menu_clear_history(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MENU*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MENU_H*/
@@ -0,0 +1,84 @@
/**
* @file lv_menu_private.h
*
*/
#ifndef LV_MENU_PRIVATE_H
#define LV_MENU_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_menu.h"
#if LV_USE_MENU
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_menu_load_page_event_data_t {
lv_obj_t * menu;
lv_obj_t * page;
};
struct _lv_menu_history_t {
lv_obj_t * page;
};
struct _lv_menu_t {
lv_obj_t obj;
lv_obj_t * storage; /**< a pointer to obj that is the parent of all pages not displayed */
lv_obj_t * main;
lv_obj_t * main_page;
lv_obj_t * main_header;
lv_obj_t *
main_header_back_btn; /**< a pointer to obj that on click triggers back btn event handler, can be same as 'main_header' */
lv_obj_t * main_header_title;
lv_obj_t * sidebar;
lv_obj_t * sidebar_page;
lv_obj_t * sidebar_header;
lv_obj_t *
sidebar_header_back_btn; /**< a pointer to obj that on click triggers back btn event handler, can be same as 'sidebar_header' */
lv_obj_t * sidebar_header_title;
lv_obj_t * selected_tab;
lv_ll_t history_ll;
uint8_t cur_depth;
uint8_t prev_depth;
uint8_t sidebar_generated : 1;
lv_menu_mode_header_t mode_header : 2;
lv_menu_mode_root_back_button_t mode_root_back_btn : 1;
};
struct _lv_menu_page_t {
lv_obj_t obj;
char * title;
bool static_title;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_MENU */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MENU_PRIVATE_H*/
+141
View File
@@ -0,0 +1,141 @@
/**
* @file lv_msgbox.h
*
*/
#ifndef LV_MSGBOX_H
#define LV_MSGBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_MSGBOX
/*Testing of dependencies*/
#if LV_USE_BUTTONMATRIX == 0
#error "lv_mbox: lv_buttonmatrix is required. Enable it in lv_conf.h (LV_USE_BUTTONMATRIX 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
/*********************
* DEFINES
*********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_button_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_button_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_backdrop_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an empty message box
* @param parent the parent or NULL to create a modal msgbox
* @return the created message box
*/
lv_obj_t * lv_msgbox_create(lv_obj_t * parent);
/**
* Add title to the message box. It also creates a header for the title.
* @param obj pointer to a message box
* @param title the text of the tile
* @return the created title label
*/
lv_obj_t * lv_msgbox_add_title(lv_obj_t * obj, const char * title);
/**
* Add a button to the header of to the message box. It also creates a header.
* @param obj pointer to a message box
* @param icon the icon of the button
* @return the created button
*/
lv_obj_t * lv_msgbox_add_header_button(lv_obj_t * obj, const void * icon);
/**
* Add a text to the content area of message box. Multiple texts will be created below each other.
* @param obj pointer to a message box
* @param text text to add
* @return the created button
*/
lv_obj_t * lv_msgbox_add_text(lv_obj_t * obj, const char * text);
/**
* Add a button to the footer of to the message box. It also creates a footer.
* @param obj pointer to a message box
* @param text the text of the button
* @return the created button
*/
lv_obj_t * lv_msgbox_add_footer_button(lv_obj_t * obj, const char * text);
/**
* Add a close button to the message box. It also creates a header.
* @param obj pointer to a message box
* @return the created close button
*/
lv_obj_t * lv_msgbox_add_close_button(lv_obj_t * obj);
/**
* Get the header widget
* @param obj pointer to a message box
* @return the header, or NULL if not exists
*/
lv_obj_t * lv_msgbox_get_header(lv_obj_t * obj);
/**
* Get the footer widget
* @param obj pointer to a message box
* @return the footer, or NULL if not exists
*/
lv_obj_t * lv_msgbox_get_footer(lv_obj_t * obj);
/**
* Get the content widget
* @param obj pointer to a message box
* @return the content
*/
lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj);
/**
* Get the title label
* @param obj pointer to a message box
* @return the title, or NULL if it does not exist
*/
lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj);
/**
* Close a message box
* @param mbox pointer to a message box
*/
void lv_msgbox_close(lv_obj_t * mbox);
/**
* Close a message box in the next call of the message box
* @param mbox pointer to a message box
*/
void lv_msgbox_close_async(lv_obj_t * mbox);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MSGBOX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MSGBOX_H*/
@@ -0,0 +1,57 @@
/**
* @file lv_msgbox_private.h
*
*/
#ifndef LV_MSGBOX_PRIVATE_H
#define LV_MSGBOX_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_msgbox.h"
#if LV_USE_MSGBOX
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_msgbox_t {
lv_obj_t obj;
lv_obj_t * header;
lv_obj_t * content;
lv_obj_t * footer;
lv_obj_t * title;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_MSGBOX */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MSGBOX_PRIVATE_H*/
@@ -0,0 +1,81 @@
/**
* @file lv_templ.h
*
*/
/**
* TODO Remove these instructions
* Search and replace: templ -> object short name with lower case(e.g. btn, label etc)
* TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.)
*
*/
#ifndef LV_TEMPL_H
#define LV_TEMPL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TEMPL != 0
#include "../core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of template*/
typedef struct {
lv_ANCESTOR_t ancestor; /*The ancestor widget, e.g. lv_slider_t slider*/
/*New data for this type*/
} lv_templ_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_templ_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a templ object
* @param parent pointer to an object, it will be the parent of the new templ
* @return pointer to the created bar
*/
lv_obj_t * lv_templ_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/*=====================
* Getter functions
*====================*/
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_TEMPL*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TEMPL_H*/
@@ -0,0 +1,22 @@
/**
* @file lv_obj_property_names.h
* GENERATED FILE, DO NOT EDIT IT!
*/
#ifndef LV_OBJ_PROPERTY_NAMES_H
#define LV_OBJ_PROPERTY_NAMES_H
#include "../../misc/lv_types.h"
#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME
extern const lv_property_name_t lv_dropdown_property_names[9];
extern const lv_property_name_t lv_image_property_names[11];
extern const lv_property_name_t lv_keyboard_property_names[4];
extern const lv_property_name_t lv_label_property_names[4];
extern const lv_property_name_t lv_obj_property_names[73];
extern const lv_property_name_t lv_roller_property_names[3];
extern const lv_property_name_t lv_style_property_names[112];
extern const lv_property_name_t lv_textarea_property_names[15];
#endif
#endif
@@ -0,0 +1,130 @@
/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_style_properties.h
*/
#ifndef LV_STYLE_PROPERTIES_H
#define LV_STYLE_PROPERTIES_H
#include "../../core/lv_obj_property.h"
#if LV_USE_OBJ_PROPERTY
/* *INDENT-OFF* */
enum {
LV_PROPERTY_ID(STYLE, ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_ALIGN),
LV_PROPERTY_ID(STYLE, ANIM, LV_PROPERTY_TYPE_INT, LV_STYLE_ANIM),
LV_PROPERTY_ID(STYLE, ANIM_DURATION, LV_PROPERTY_TYPE_INT, LV_STYLE_ANIM_DURATION),
LV_PROPERTY_ID(STYLE, ARC_COLOR, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_COLOR),
LV_PROPERTY_ID(STYLE, ARC_IMAGE_SRC, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_IMAGE_SRC),
LV_PROPERTY_ID(STYLE, ARC_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_OPA),
LV_PROPERTY_ID(STYLE, ARC_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_ROUNDED),
LV_PROPERTY_ID(STYLE, ARC_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_ARC_WIDTH),
LV_PROPERTY_ID(STYLE, BASE_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BASE_DIR),
LV_PROPERTY_ID(STYLE, BG_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_COLOR),
LV_PROPERTY_ID(STYLE, BG_GRAD, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD),
LV_PROPERTY_ID(STYLE, BG_GRAD_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_GRAD_COLOR),
LV_PROPERTY_ID(STYLE, BG_GRAD_DIR, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_DIR),
LV_PROPERTY_ID(STYLE, BG_GRAD_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_OPA),
LV_PROPERTY_ID(STYLE, BG_GRAD_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_GRAD_STOP),
LV_PROPERTY_ID(STYLE, BG_IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_OPA),
LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BG_IMAGE_RECOLOR),
LV_PROPERTY_ID(STYLE, BG_IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_RECOLOR_OPA),
LV_PROPERTY_ID(STYLE, BG_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, LV_STYLE_BG_IMAGE_SRC),
LV_PROPERTY_ID(STYLE, BG_IMAGE_TILED, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_IMAGE_TILED),
LV_PROPERTY_ID(STYLE, BG_MAIN_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_OPA),
LV_PROPERTY_ID(STYLE, BG_MAIN_STOP, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_MAIN_STOP),
LV_PROPERTY_ID(STYLE, BG_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BG_OPA),
LV_PROPERTY_ID(STYLE, BITMAP_MASK_SRC, LV_PROPERTY_TYPE_INT, LV_STYLE_BITMAP_MASK_SRC),
LV_PROPERTY_ID(STYLE, BLEND_MODE, LV_PROPERTY_TYPE_INT, LV_STYLE_BLEND_MODE),
LV_PROPERTY_ID(STYLE, BORDER_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_BORDER_COLOR),
LV_PROPERTY_ID(STYLE, BORDER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_OPA),
LV_PROPERTY_ID(STYLE, BORDER_POST, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_POST),
LV_PROPERTY_ID(STYLE, BORDER_SIDE, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_SIDE),
LV_PROPERTY_ID(STYLE, BORDER_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_BORDER_WIDTH),
LV_PROPERTY_ID(STYLE, CLIP_CORNER, LV_PROPERTY_TYPE_INT, LV_STYLE_CLIP_CORNER),
LV_PROPERTY_ID(STYLE, COLOR_FILTER_DSC, LV_PROPERTY_TYPE_INT, LV_STYLE_COLOR_FILTER_DSC),
LV_PROPERTY_ID(STYLE, COLOR_FILTER_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_COLOR_FILTER_OPA),
LV_PROPERTY_ID(STYLE, FLEX_CROSS_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_CROSS_PLACE),
LV_PROPERTY_ID(STYLE, FLEX_FLOW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_FLOW),
LV_PROPERTY_ID(STYLE, FLEX_GROW, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_GROW),
LV_PROPERTY_ID(STYLE, FLEX_MAIN_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_MAIN_PLACE),
LV_PROPERTY_ID(STYLE, FLEX_TRACK_PLACE, LV_PROPERTY_TYPE_INT, LV_STYLE_FLEX_TRACK_PLACE),
LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_POS),
LV_PROPERTY_ID(STYLE, GRID_CELL_COLUMN_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_COLUMN_SPAN),
LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_POS, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_POS),
LV_PROPERTY_ID(STYLE, GRID_CELL_ROW_SPAN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_ROW_SPAN),
LV_PROPERTY_ID(STYLE, GRID_CELL_X_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_X_ALIGN),
LV_PROPERTY_ID(STYLE, GRID_CELL_Y_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_CELL_Y_ALIGN),
LV_PROPERTY_ID(STYLE, GRID_COLUMN_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_COLUMN_ALIGN),
LV_PROPERTY_ID(STYLE, GRID_COLUMN_DSC_ARRAY, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_COLUMN_DSC_ARRAY),
LV_PROPERTY_ID(STYLE, GRID_ROW_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_ROW_ALIGN),
LV_PROPERTY_ID(STYLE, GRID_ROW_DSC_ARRAY, LV_PROPERTY_TYPE_INT, LV_STYLE_GRID_ROW_DSC_ARRAY),
LV_PROPERTY_ID(STYLE, HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_HEIGHT),
LV_PROPERTY_ID(STYLE, IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_OPA),
LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_IMAGE_RECOLOR),
LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_RECOLOR_OPA),
LV_PROPERTY_ID(STYLE, LAST_BUILT_IN_PROP, LV_PROPERTY_TYPE_INT, LV_STYLE_LAST_BUILT_IN_PROP),
LV_PROPERTY_ID(STYLE, LAYOUT, LV_PROPERTY_TYPE_INT, LV_STYLE_LAYOUT),
LV_PROPERTY_ID(STYLE, LENGTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LENGTH),
LV_PROPERTY_ID(STYLE, LINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_LINE_COLOR),
LV_PROPERTY_ID(STYLE, LINE_DASH_GAP, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_GAP),
LV_PROPERTY_ID(STYLE, LINE_DASH_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_DASH_WIDTH),
LV_PROPERTY_ID(STYLE, LINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_OPA),
LV_PROPERTY_ID(STYLE, LINE_ROUNDED, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_ROUNDED),
LV_PROPERTY_ID(STYLE, LINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LINE_WIDTH),
LV_PROPERTY_ID(STYLE, MARGIN_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_BOTTOM),
LV_PROPERTY_ID(STYLE, MARGIN_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_LEFT),
LV_PROPERTY_ID(STYLE, MARGIN_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_RIGHT),
LV_PROPERTY_ID(STYLE, MARGIN_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_MARGIN_TOP),
LV_PROPERTY_ID(STYLE, MAX_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_HEIGHT),
LV_PROPERTY_ID(STYLE, MAX_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MAX_WIDTH),
LV_PROPERTY_ID(STYLE, MIN_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_HEIGHT),
LV_PROPERTY_ID(STYLE, MIN_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_MIN_WIDTH),
LV_PROPERTY_ID(STYLE, OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA),
LV_PROPERTY_ID(STYLE, OPA_LAYERED, LV_PROPERTY_TYPE_INT, LV_STYLE_OPA_LAYERED),
LV_PROPERTY_ID(STYLE, OUTLINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_OUTLINE_COLOR),
LV_PROPERTY_ID(STYLE, OUTLINE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_OPA),
LV_PROPERTY_ID(STYLE, OUTLINE_PAD, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_PAD),
LV_PROPERTY_ID(STYLE, OUTLINE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_OUTLINE_WIDTH),
LV_PROPERTY_ID(STYLE, PAD_BOTTOM, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_BOTTOM),
LV_PROPERTY_ID(STYLE, PAD_COLUMN, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_COLUMN),
LV_PROPERTY_ID(STYLE, PAD_LEFT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_LEFT),
LV_PROPERTY_ID(STYLE, PAD_RIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RIGHT),
LV_PROPERTY_ID(STYLE, PAD_ROW, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_ROW),
LV_PROPERTY_ID(STYLE, PAD_TOP, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_TOP),
LV_PROPERTY_ID(STYLE, PROP_INV, LV_PROPERTY_TYPE_INT, LV_STYLE_PROP_INV),
LV_PROPERTY_ID(STYLE, RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIUS),
LV_PROPERTY_ID(STYLE, ROTARY_SENSITIVITY, LV_PROPERTY_TYPE_INT, LV_STYLE_ROTARY_SENSITIVITY),
LV_PROPERTY_ID(STYLE, SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_SHADOW_COLOR),
LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_X),
LV_PROPERTY_ID(STYLE, SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OFFSET_Y),
LV_PROPERTY_ID(STYLE, SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_OPA),
LV_PROPERTY_ID(STYLE, SHADOW_SPREAD, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_SPREAD),
LV_PROPERTY_ID(STYLE, SHADOW_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_SHADOW_WIDTH),
LV_PROPERTY_ID(STYLE, TEXT_ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_ALIGN),
LV_PROPERTY_ID(STYLE, TEXT_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_COLOR),
LV_PROPERTY_ID(STYLE, TEXT_DECOR, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_DECOR),
LV_PROPERTY_ID(STYLE, TEXT_FONT, LV_PROPERTY_TYPE_FONT, LV_STYLE_TEXT_FONT),
LV_PROPERTY_ID(STYLE, TEXT_LETTER_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LETTER_SPACE),
LV_PROPERTY_ID(STYLE, TEXT_LINE_SPACE, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LINE_SPACE),
LV_PROPERTY_ID(STYLE, TEXT_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OPA),
LV_PROPERTY_ID(STYLE, TRANSFORM_HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_HEIGHT),
LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_X),
LV_PROPERTY_ID(STYLE, TRANSFORM_PIVOT_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_PIVOT_Y),
LV_PROPERTY_ID(STYLE, TRANSFORM_ROTATION, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_ROTATION),
LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_X),
LV_PROPERTY_ID(STYLE, TRANSFORM_SCALE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SCALE_Y),
LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_X),
LV_PROPERTY_ID(STYLE, TRANSFORM_SKEW_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_SKEW_Y),
LV_PROPERTY_ID(STYLE, TRANSFORM_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSFORM_WIDTH),
LV_PROPERTY_ID(STYLE, TRANSITION, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSITION),
LV_PROPERTY_ID(STYLE, TRANSLATE_X, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_X),
LV_PROPERTY_ID(STYLE, TRANSLATE_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_Y),
LV_PROPERTY_ID(STYLE, WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_WIDTH),
LV_PROPERTY_ID(STYLE, X, LV_PROPERTY_TYPE_INT, LV_STYLE_X),
LV_PROPERTY_ID(STYLE, Y, LV_PROPERTY_TYPE_INT, LV_STYLE_Y),
};
#endif
#endif
+133
View File
@@ -0,0 +1,133 @@
/**
* @file lv_roller.h
*
*/
#ifndef LV_ROLLER_H
#define LV_ROLLER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_ROLLER != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_roller: lv_label is required. Enable it in lv_conf.h (LV_USE_ROLLER 1)"
#endif
#include "../label/lv_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Roller mode. */
typedef enum {
LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options). */
LV_ROLLER_MODE_INFINITE, /**< Infinite mode (roller can be scrolled forever). */
} lv_roller_mode_t;
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(ROLLER, OPTIONS, LV_PROPERTY_TYPE_TEXT, 0),
LV_PROPERTY_ID(ROLLER, SELECTED, LV_PROPERTY_TYPE_INT, 1),
LV_PROPERTY_ID(ROLLER, VISIBLE_ROW_COUNT, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ROLLER_END,
};
#endif
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_roller_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a roller object
* @param parent pointer to an object, it will be the parent of the new roller.
* @return pointer to the created roller
*/
lv_obj_t * lv_roller_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the options on a roller
* @param obj pointer to roller object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
* @param mode `LV_ROLLER_MODE_NORMAL` or `LV_ROLLER_MODE_INFINITE`
*/
void lv_roller_set_options(lv_obj_t * obj, const char * options, lv_roller_mode_t mode);
/**
* Set the selected option
* @param obj pointer to a roller object
* @param sel_opt index of the selected option (0 ... number of option - 1);
* @param anim LV_ANIM_ON: set with animation; LV_ANOM_OFF set immediately
*/
void lv_roller_set_selected(lv_obj_t * obj, uint32_t sel_opt, lv_anim_enable_t anim);
/**
* Set the height to show the given number of rows (options)
* @param obj pointer to a roller object
* @param row_cnt number of desired visible rows
*/
void lv_roller_set_visible_row_count(lv_obj_t * obj, uint32_t row_cnt);
/*=====================
* Getter functions
*====================*/
/**
* Get the index of the selected option
* @param obj pointer to a roller object
* @return index of the selected option (0 ... number of option - 1);
*/
uint32_t lv_roller_get_selected(const lv_obj_t * obj);
/**
* Get the current selected option as a string.
* @param obj pointer to roller object
* @param buf pointer to an array to store the string
* @param buf_size size of `buf` in bytes. 0: to ignore it.
*/
void lv_roller_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size);
/**
* Get the options of a roller
* @param obj pointer to roller object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_roller_get_options(const lv_obj_t * obj);
/**
* Get the total number of options
* @param obj pointer to a roller object
* @return the total number of options
*/
uint32_t lv_roller_get_option_count(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_ROLLER*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ROLLER_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_roller_private.h
*
*/
#ifndef LV_ROLLER_PRIVATE_H
#define LV_ROLLER_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_roller.h"
#if LV_USE_ROLLER != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_roller_t {
lv_obj_t obj;
uint32_t option_cnt; /**< Number of options*/
uint32_t sel_opt_id; /**< Index of the current option*/
uint32_t sel_opt_id_ori; /**< Store the original index on focus*/
uint32_t inf_page_cnt; /**< Number of extra pages added to make the roller look infinite */
lv_roller_mode_t mode : 2;
uint32_t moved : 1;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_ROLLER != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ROLLER_PRIVATE_H*/
+258
View File
@@ -0,0 +1,258 @@
/**
* @file lv_scale.h
*
*/
#ifndef LV_SCALE_H
#define LV_SCALE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_SCALE != 0
#include "../../core/lv_obj.h"
#include "../line/lv_line.h"
#include "../image/lv_image.h"
/*********************
* DEFINES
*********************/
/**Default value of total minor ticks. */
#define LV_SCALE_TOTAL_TICK_COUNT_DEFAULT (11U)
LV_EXPORT_CONST_INT(LV_SCALE_TOTAL_TICK_COUNT_DEFAULT);
/**Default value of major tick every nth ticks. */
#define LV_SCALE_MAJOR_TICK_EVERY_DEFAULT (5U)
LV_EXPORT_CONST_INT(LV_SCALE_MAJOR_TICK_EVERY_DEFAULT);
/**Default value of scale label enabled. */
#define LV_SCALE_LABEL_ENABLED_DEFAULT (1U)
LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ENABLED_DEFAULT);
/**********************
* TYPEDEFS
**********************/
/**
* Scale mode
*/
typedef enum {
LV_SCALE_MODE_HORIZONTAL_TOP = 0x00U,
LV_SCALE_MODE_HORIZONTAL_BOTTOM = 0x01U,
LV_SCALE_MODE_VERTICAL_LEFT = 0x02U,
LV_SCALE_MODE_VERTICAL_RIGHT = 0x04U,
LV_SCALE_MODE_ROUND_INNER = 0x08U,
LV_SCALE_MODE_ROUND_OUTER = 0x10U,
LV_SCALE_MODE_LAST
} lv_scale_mode_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_scale_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an scale object
* @param parent pointer to an object, it will be the parent of the new scale
* @return pointer to the created scale
*/
lv_obj_t * lv_scale_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set scale mode. See lv_scale_mode_t
* @param obj pointer the scale object
* @param mode the new scale mode
*/
void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode);
/**
* Set scale total tick count (including minor and major ticks)
* @param obj pointer the scale object
* @param total_tick_count New total tick count
*/
void lv_scale_set_total_tick_count(lv_obj_t * obj, uint32_t total_tick_count);
/**
* Sets how often the major tick will be drawn
* @param obj pointer the scale object
* @param major_tick_every the new count for major tick drawing
*/
void lv_scale_set_major_tick_every(lv_obj_t * obj, uint32_t major_tick_every);
/**
* Sets label visibility
* @param obj pointer the scale object
* @param show_label true/false to enable tick label
*/
void lv_scale_set_label_show(lv_obj_t * obj, bool show_label);
/**
* Set the minimal and maximal values on a scale
* @param obj pointer to a scale object
* @param min minimum value of the scale
* @param max maximum value of the scale
*/
void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max);
/**
* Set properties specific to round scale
* @param obj pointer to a scale object
* @param angle_range the angular range of the scale
*/
void lv_scale_set_angle_range(lv_obj_t * obj, uint32_t angle_range);
/**
* Set properties specific to round scale
* @param obj pointer to a scale object
* @param rotation the angular offset from the 3 o'clock position (clock-wise)
*/
void lv_scale_set_rotation(lv_obj_t * obj, int32_t rotation);
/**
* Point the needle to the corresponding value through the line
* @param obj pointer to a scale object
* @param needle_line needle_line of the scale. The line points will be allocated and
* managed by the scale unless the line point array was previously set
* using `lv_line_set_points_mutable`.
* @param needle_length length of the needle
* needle_length>0 needle_length=needle_length;
* needle_length<0 needle_length=radius-|needle_length|;
* @param value needle to point to the corresponding value
*/
void lv_scale_set_line_needle_value(lv_obj_t * obj, lv_obj_t * needle_line, int32_t needle_length,
int32_t value);
/**
* Point the needle to the corresponding value through the image,
image must point to the right. E.g. -O------>
* @param obj pointer to a scale object
* @param needle_img needle_img of the scale
* @param value needle to point to the corresponding value
*/
void lv_scale_set_image_needle_value(lv_obj_t * obj, lv_obj_t * needle_img, int32_t value);
/**
* Set custom text source for major ticks labels
* @param obj pointer to a scale object
* @param txt_src pointer to an array of strings which will be display at major ticks
*/
void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[]);
/**
* Draw the scale after all the children are drawn
* @param obj pointer to a scale object
* @param en true: enable post draw
*/
void lv_scale_set_post_draw(lv_obj_t * obj, bool en);
/**
* Draw the scale ticks on top of all parts
* @param obj pointer to a scale object
* @param en true: enable draw ticks on top of all parts
*/
void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en);
/**
* Add a section to the given scale
* @param obj pointer to a scale object
* @return pointer to the new section
*/
lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj);
/**
* Set the range for the given scale section
* @param section pointer to a scale section object
* @param minor_range section new minor range
* @param major_range section new major range
*/
void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_range, int32_t major_range);
/**
* Set the style of the part for the given scale section
* @param section pointer to a scale section object
* @param part the part for the section, e.g. LV_PART_INDICATOR
* @param section_part_style Pointer to the section part style
*/
void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style);
/*=====================
* Getter functions
*====================*/
/**
* Get scale mode. See lv_scale_mode_t
* @param obj pointer the scale object
* @return Scale mode
*/
lv_scale_mode_t lv_scale_get_mode(lv_obj_t * obj);
/**
* Get scale total tick count (including minor and major ticks)
* @param obj pointer the scale object
* @return Scale total tick count
*/
int32_t lv_scale_get_total_tick_count(lv_obj_t * obj);
/**
* Gets how often the major tick will be drawn
* @param obj pointer the scale object
* @return Scale major tick every count
*/
int32_t lv_scale_get_major_tick_every(lv_obj_t * obj);
/**
* Gets label visibility
* @param obj pointer the scale object
* @return true if tick label is enabled, false otherwise
*/
bool lv_scale_get_label_show(lv_obj_t * obj);
/**
* Get angle range of a round scale
* @param obj pointer to a scale object
* @return Scale angle_range
*/
uint32_t lv_scale_get_angle_range(lv_obj_t * obj);
/**
* Get the min range for the given scale section
* @param obj pointer to a scale section object
* @return section minor range
*/
int32_t lv_scale_get_range_min_value(lv_obj_t * obj);
/**
* Get the max range for the given scale section
* @param obj pointer to a scale section object
* @return section max range
*/
int32_t lv_scale_get_range_max_value(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SCALE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SCALE_H*/
@@ -0,0 +1,82 @@
/**
* @file lv_scale_private.h
*
*/
#ifndef LV_SCALE_PRIVATE_H
#define LV_SCALE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_scale.h"
#if LV_USE_SCALE != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_scale_section_t {
lv_style_t * main_style;
lv_style_t * indicator_style;
lv_style_t * items_style;
int32_t minor_range;
int32_t major_range;
uint32_t first_tick_idx_in_section;
uint32_t last_tick_idx_in_section;
uint32_t first_tick_idx_is_major;
uint32_t last_tick_idx_is_major;
int32_t first_tick_in_section_width;
int32_t last_tick_in_section_width;
lv_point_t first_tick_in_section;
lv_point_t last_tick_in_section;
};
struct _lv_scale_t {
lv_obj_t obj;
lv_ll_t section_ll; /**< Linked list for the sections (stores lv_scale_section_t)*/
const char ** txt_src;
lv_scale_mode_t mode;
int32_t range_min;
int32_t range_max;
uint32_t total_tick_count : 15;
uint32_t major_tick_every : 15;
uint32_t label_enabled : 1;
uint32_t post_draw : 1;
uint32_t draw_ticks_on_top : 1;
/* Round scale */
uint32_t angle_range;
int32_t rotation;
/* Private properties */
int32_t custom_label_cnt;
int32_t last_tick_width;
int32_t first_tick_width;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_SCALE != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SCALE_PRIVATE_H*/
+149
View File
@@ -0,0 +1,149 @@
/**
* @file lv_slider.h
*
*/
#ifndef LV_SLIDER_H
#define LV_SLIDER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../bar/lv_bar.h"
#if LV_USE_SLIDER != 0
/*Testing of dependencies*/
#if LV_USE_BAR == 0
#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_SLIDER_MODE_NORMAL = LV_BAR_MODE_NORMAL,
LV_SLIDER_MODE_SYMMETRICAL = LV_BAR_MODE_SYMMETRICAL,
LV_SLIDER_MODE_RANGE = LV_BAR_MODE_RANGE
} lv_slider_mode_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_slider_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a slider object
* @param parent pointer to an object, it will be the parent of the new slider.
* @return pointer to the created slider
*/
lv_obj_t * lv_slider_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set a new value on the slider
* @param obj pointer to a slider object
* @param value the new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim);
/**
* Set a new value for the left knob of a slider
* @param obj pointer to a slider object
* @param value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim);
/**
* Set minimum and the maximum values of a bar
* @param obj pointer to the slider object
* @param min minimum value
* @param max maximum value
*/
void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max);
/**
* Set the mode of slider.
* @param obj pointer to a slider object
* @param mode the mode of the slider. See ::lv_slider_mode_t
*/
void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode);
/*=====================
* Getter functions
*====================*/
/**
* Get the value of the main knob of a slider
* @param obj pointer to a slider object
* @return the value of the main knob of the slider
*/
int32_t lv_slider_get_value(const lv_obj_t * obj);
/**
* Get the value of the left knob of a slider
* @param obj pointer to a slider object
* @return the value of the left knob of the slider
*/
int32_t lv_slider_get_left_value(const lv_obj_t * obj);
/**
* Get the minimum value of a slider
* @param obj pointer to a slider object
* @return the minimum value of the slider
*/
int32_t lv_slider_get_min_value(const lv_obj_t * obj);
/**
* Get the maximum value of a slider
* @param obj pointer to a slider object
* @return the maximum value of the slider
*/
int32_t lv_slider_get_max_value(const lv_obj_t * obj);
/**
* Give the slider is being dragged or not
* @param obj pointer to a slider object
* @return true: drag in progress false: not dragged
*/
bool lv_slider_is_dragged(const lv_obj_t * obj);
/**
* Get the mode of the slider.
* @param slider pointer to a slider object
* @return see ::lv_slider_mode_t
*/
lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider);
/**
* Give the slider is in symmetrical mode or not
* @param obj pointer to slider object
* @return true: in symmetrical mode false : not in
*/
bool lv_slider_is_symmetrical(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SLIDER*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SLIDER_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_slider_private.h
*
*/
#ifndef LV_SLIDER_PRIVATE_H
#define LV_SLIDER_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../bar/lv_bar_private.h"
#include "lv_slider.h"
#if LV_USE_SLIDER != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_slider_t {
lv_bar_t bar; /**< Add the ancestor's type first */
lv_area_t left_knob_area;
lv_area_t right_knob_area;
lv_point_t pressed_point;
int32_t * value_to_set; /**< Which bar value to set */
uint8_t dragging : 1; /**< 1: the slider is being dragged */
uint8_t left_knob_focus : 1; /**< 1: with encoder now the right knob can be adjusted */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_SLIDER != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SLIDER_PRIVATE_H*/
+284
View File
@@ -0,0 +1,284 @@
/**
* @file lv_span.h
*
*/
#ifndef LV_SPAN_H
#define LV_SPAN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_SPAN != 0
/*********************
* DEFINES
*********************/
#ifndef LV_SPAN_SNIPPET_STACK_SIZE
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_SPAN_OVERFLOW_CLIP,
LV_SPAN_OVERFLOW_ELLIPSIS,
LV_SPAN_OVERFLOW_LAST, /**< Fence member*/
} lv_span_overflow_t;
typedef enum {
LV_SPAN_MODE_FIXED, /**< fixed the obj size */
LV_SPAN_MODE_EXPAND, /**< Expand the object size to the text size */
LV_SPAN_MODE_BREAK, /**< Keep width, break the too long lines and expand height */
LV_SPAN_MODE_LAST /**< Fence member */
} lv_span_mode_t;
/** Coords of a span */
typedef struct _lv_span_coords_t {
lv_area_t heading;
lv_area_t middle;
lv_area_t trailing;
} lv_span_coords_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spangroup_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_span_stack_init(void);
void lv_span_stack_deinit(void);
/**
* Create a spangroup object
* @param parent pointer to an object, it will be the parent of the new spangroup
* @return pointer to the created spangroup
*/
lv_obj_t * lv_spangroup_create(lv_obj_t * parent);
/**
* Create a span string descriptor and add to spangroup.
* @param obj pointer to a spangroup object.
* @return pointer to the created span.
*/
lv_span_t * lv_spangroup_new_span(lv_obj_t * obj);
/**
* Remove the span from the spangroup and free memory.
* @param obj pointer to a spangroup object.
* @param span pointer to a span.
*/
void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span);
/*=====================
* Setter functions
*====================*/
/**
* Set a new text for a span. Memory will be allocated to store the text by the span.
* @param span pointer to a span.
* @param text pointer to a text.
*/
void lv_span_set_text(lv_span_t * span, const char * text);
/**
* Set a static text. It will not be saved by the span so the 'text' variable
* has to be 'alive' while the span exist.
* @param span pointer to a span.
* @param text pointer to a text.
*/
void lv_span_set_text_static(lv_span_t * span, const char * text);
/**
* Set the align of the spangroup.
* @param obj pointer to a spangroup object.
* @param align see lv_text_align_t for details.
*/
void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align);
/**
* Set the overflow of the spangroup.
* @param obj pointer to a spangroup object.
* @param overflow see lv_span_overflow_t for details.
*/
void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow);
/**
* Set the indent of the spangroup.
* @param obj pointer to a spangroup object.
* @param indent the first line indentation
*/
void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent);
/**
* Set the mode of the spangroup.
* @param obj pointer to a spangroup object.
* @param mode see lv_span_mode_t for details.
*/
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode);
/**
* Set maximum lines of the spangroup.
* @param obj pointer to a spangroup object.
* @param lines max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit.
*/
void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines);
/*=====================
* Getter functions
*====================*/
/**
* Get a pointer to the style of a span
* @param span pointer to the span
* @return pointer to the style. valid as long as the span is valid
*/
lv_style_t * lv_span_get_style(lv_span_t * span);
/**
* Get a pointer to the text of a span
* @param span pointer to the span
* @return pointer to the text
*/
const char * lv_span_get_text(lv_span_t * span);
/**
* Get a spangroup child by its index.
*
* @param obj The spangroup object
* @param id the index of the child.
* 0: the oldest (firstly created) child
* 1: the second oldest
* child count-1: the youngest
* -1: the youngest
* -2: the second youngest
* @return The child span at index `id`, or NULL if the ID does not exist
*/
lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id);
/**
* Get number of spans
* @param obj the spangroup object to get the child count of.
* @return the span count of the spangroup.
*/
uint32_t lv_spangroup_get_span_count(const lv_obj_t * obj);
/**
* Get the align of the spangroup.
* @param obj pointer to a spangroup object.
* @return the align value.
*/
lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj);
/**
* Get the overflow of the spangroup.
* @param obj pointer to a spangroup object.
* @return the overflow value.
*/
lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj);
/**
* Get the indent of the spangroup.
* @param obj pointer to a spangroup object.
* @return the indent value.
*/
int32_t lv_spangroup_get_indent(lv_obj_t * obj);
/**
* Get the mode of the spangroup.
* @param obj pointer to a spangroup object.
*/
lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj);
/**
* Get maximum lines of the spangroup.
* @param obj pointer to a spangroup object.
* @return the max lines value.
*/
int32_t lv_spangroup_get_max_lines(lv_obj_t * obj);
/**
* Get max line height of all span in the spangroup.
* @param obj pointer to a spangroup object.
*/
int32_t lv_spangroup_get_max_line_height(lv_obj_t * obj);
/**
* Get the text content width when all span of spangroup on a line.
* @param obj pointer to a spangroup object.
* @param max_width if text content width >= max_width, return max_width
* to reduce computation, if max_width == 0, returns the text content width.
* @return text content width or max_width.
*/
uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width);
/**
* Get the text content height with width fixed.
* @param obj pointer to a spangroup object.
* @param width the width of the span group.
*/
int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width);
/**
* Get the span's coords in the spangroup.
* @note Before calling this function, please make sure that the layout of span group has been updated.
* Like calling lv_obj_update_layout() like function.
*
* +--------+
* |Heading +--->------------------+
* | Pos | | Heading |
* +--------+---+------------------+
* | |
* | |
* | |
* | Middle +--------+|
* | |Trailing||
* | +-| Pos ||
* | | +--------+|
* +-------------------v-----------+
* | Trailing |
* +-------------------+
* @param obj pointer to a spangroup object.
* @param span pointer to a span.
* @return the span's coords in the spangroup.
*/
lv_span_coords_t lv_spangroup_get_span_coords(lv_obj_t * obj, const lv_span_t * span);
/**
* Get the span object by point.
* @param obj pointer to a spangroup object.
* @param point pointer to point containing absolute coordinates
* @return pointer to the span under the point or `NULL` if not found.
*/
lv_span_t * lv_spangroup_get_span_by_point(lv_obj_t * obj, const lv_point_t * point);
/*=====================
* Other functions
*====================*/
/**
* Update the mode of the spangroup.
* @param obj pointer to a spangroup object.
*/
void lv_spangroup_refr_mode(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPAN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SPAN_H*/
@@ -0,0 +1,68 @@
/**
* @file lv_span_private.h
*
*/
#ifndef LV_SPAN_PRIVATE_H
#define LV_SPAN_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_span.h"
#if LV_USE_SPAN != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_span_t {
char * txt; /**< a pointer to display text */
lv_obj_t * spangroup; /**< a pointer to spangroup */
lv_style_t style; /**< display text style */
uint32_t static_flag : 1; /**< the text is static flag */
lv_point_t trailing_pos;
int32_t trailing_height;
};
/** Data of label*/
struct _lv_spangroup_t {
lv_obj_t obj;
int32_t lines;
int32_t indent; /**< first line indent */
int32_t cache_w; /**< the cache automatically calculates the width */
int32_t cache_h; /**< similar cache_w */
lv_ll_t child_ll;
uint32_t mode : 2; /**< details see lv_span_mode_t */
uint32_t overflow : 1; /**< details see lv_span_overflow_t */
uint32_t refresh : 1; /**< the spangroup need refresh cache_w and cache_h */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_SPAN != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPAN_PRIVATE_H*/
@@ -0,0 +1,164 @@
/**
* @file lv_spinbox.h
*
*/
#ifndef LV_SPINBOX_H
#define LV_SPINBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../textarea/lv_textarea.h"
#if LV_USE_SPINBOX
/*Testing of dependencies*/
#if LV_USE_TEXTAREA == 0
#error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
/*********************
* DEFINES
*********************/
#define LV_SPINBOX_MAX_DIGIT_COUNT 10
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinbox_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a spinbox object
* @param parent pointer to an object, it will be the parent of the new spinbox
* @return pointer to the created spinbox
*/
lv_obj_t * lv_spinbox_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set spinbox value
* @param obj pointer to spinbox
* @param v value to be set
*/
void lv_spinbox_set_value(lv_obj_t * obj, int32_t v);
/**
* Set spinbox rollover function
* @param obj pointer to spinbox
* @param rollover true or false to enable or disable (default)
*/
void lv_spinbox_set_rollover(lv_obj_t * obj, bool rollover);
/**
* Set spinbox digit format (digit count and decimal format)
* @param obj pointer to spinbox
* @param digit_count number of digit excluding the decimal separator and the sign
* @param sep_pos number of digit before the decimal point. If 0, decimal point is not
* shown
*/
void lv_spinbox_set_digit_format(lv_obj_t * obj, uint32_t digit_count, uint32_t sep_pos);
/**
* Set spinbox step
* @param obj pointer to spinbox
* @param step steps on increment/decrement. Can be 1, 10, 100, 1000, etc the digit that will change.
*/
void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step);
/**
* Set spinbox value range
* @param obj pointer to spinbox
* @param range_min maximum value, inclusive
* @param range_max minimum value, inclusive
*/
void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max);
/**
* Set cursor position to a specific digit for edition
* @param obj pointer to spinbox
* @param pos selected position in spinbox
*/
void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint32_t pos);
/**
* Set direction of digit step when clicking an encoder button while in editing mode
* @param obj pointer to spinbox
* @param direction the direction (LV_DIR_RIGHT or LV_DIR_LEFT)
*/
void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction);
/*=====================
* Getter functions
*====================*/
/**
* Get spinbox rollover function status
* @param obj pointer to spinbox
*/
bool lv_spinbox_get_rollover(lv_obj_t * obj);
/**
* Get the spinbox numeral value (user has to convert to float according to its digit format)
* @param obj pointer to spinbox
* @return value integer value of the spinbox
*/
int32_t lv_spinbox_get_value(lv_obj_t * obj);
/**
* Get the spinbox step value (user has to convert to float according to its digit format)
* @param obj pointer to spinbox
* @return value integer step value of the spinbox
*/
int32_t lv_spinbox_get_step(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Select next lower digit for edition by dividing the step by 10
* @param obj pointer to spinbox
*/
void lv_spinbox_step_next(lv_obj_t * obj);
/**
* Select next higher digit for edition by multiplying the step by 10
* @param obj pointer to spinbox
*/
void lv_spinbox_step_prev(lv_obj_t * obj);
/**
* Increment spinbox value by one step
* @param obj pointer to spinbox
*/
void lv_spinbox_increment(lv_obj_t * obj);
/**
* Decrement spinbox value by one step
* @param obj pointer to spinbox
*/
void lv_spinbox_decrement(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPINBOX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPINBOX_H*/
@@ -0,0 +1,59 @@
/**
* @file lv_spinbox_private.h
*
*/
#ifndef LV_SPINBOX_PRIVATE_H
#define LV_SPINBOX_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../textarea/lv_textarea_private.h"
#include "lv_spinbox.h"
#if LV_USE_SPINBOX
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of spinbox */
struct _lv_spinbox_t {
lv_textarea_t ta; /**< Ext. of ancestor */
/*New data for this type*/
int32_t value;
int32_t range_max;
int32_t range_min;
int32_t step;
uint32_t digit_count : 4;
uint32_t dec_point_pos : 4; /**< if 0, there is no separator and the number is an integer */
uint32_t rollover : 1; /**< Set to true for rollover functionality */
uint32_t digit_step_dir : 2; /**< the direction the digit will step on encoder button press when editing */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_SPINBOX */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPINBOX_PRIVATE_H*/
@@ -0,0 +1,63 @@
/**
* @file lv_spinner.h
*
*/
#ifndef LV_SPINNER_H
#define LV_SPINNER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_SPINNER
/*Testing of dependencies*/
#if LV_USE_ARC == 0
#error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) "
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinner_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a spinner widget
* @param parent pointer to an object, it will be the parent of the new spinner.
* @return the created spinner
*/
lv_obj_t * lv_spinner_create(lv_obj_t * parent);
/**
* Set the animation time and arc length of the spinner
* @param obj pointer to a spinner
* @param t the animation time in milliseconds
* @param angle the angle of the arc in degrees
*/
void lv_spinner_set_anim_params(lv_obj_t * obj, uint32_t t, uint32_t angle);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPINNER*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPINNER_H*/
@@ -0,0 +1,84 @@
/**
* @file lv_switch.h
*
*/
#ifndef LV_SWITCH_H
#define LV_SWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_SWITCH != 0
#include "../../core/lv_obj.h"
/*********************
* DEFINES
*********************/
/** Switch knob extra area correction factor */
#define LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class;
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_SWITCH_ORIENTATION_AUTO,
LV_SWITCH_ORIENTATION_HORIZONTAL,
LV_SWITCH_ORIENTATION_VERTICAL
} lv_switch_orientation_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a switch object
* @param parent pointer to an object, it will be the parent of the new switch
* @return pointer to the created switch
*/
lv_obj_t * lv_switch_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the orientation of switch.
* @param obj pointer to switch object
* @param orientation switch orientation from `lv_switch_orientation_t`
*/
void lv_switch_set_orientation(lv_obj_t * obj, lv_switch_orientation_t orientation);
/*=====================
* Getter functions
*====================*/
/**
* Get the orientation of switch.
* @param obj pointer to switch object
* @return switch orientation from ::lv_switch_orientation_t
*/
lv_switch_orientation_t lv_switch_get_orientation(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SWITCH*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SWITCH_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_switch_private.h
*
*/
#ifndef LV_SWITCH_PRIVATE_H
#define LV_SWITCH_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_switch.h"
#if LV_USE_SWITCH != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_switch_t {
lv_obj_t obj;
int32_t anim_state;
lv_switch_orientation_t orientation : 3; /**< Orientation of switch*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_SWITCH != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SWITCH_PRIVATE_H*/
+214
View File
@@ -0,0 +1,214 @@
/**
* @file lv_table.h
*
*/
#ifndef LV_TABLE_H
#define LV_TABLE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../label/lv_label.h"
#if LV_USE_TABLE != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
#endif
/*********************
* DEFINES
*********************/
#define LV_TABLE_CELL_NONE 0XFFFF
LV_EXPORT_CONST_INT(LV_TABLE_CELL_NONE);
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_TABLE_CELL_CTRL_MERGE_RIGHT = 1 << 0,
LV_TABLE_CELL_CTRL_TEXT_CROP = 1 << 1,
LV_TABLE_CELL_CTRL_CUSTOM_1 = 1 << 4,
LV_TABLE_CELL_CTRL_CUSTOM_2 = 1 << 5,
LV_TABLE_CELL_CTRL_CUSTOM_3 = 1 << 6,
LV_TABLE_CELL_CTRL_CUSTOM_4 = 1 << 7,
} lv_table_cell_ctrl_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_table_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a table object
* @param parent pointer to an object, it will be the parent of the new table
* @return pointer to the created table
*/
lv_obj_t * lv_table_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the value of a cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param txt text to display in the cell. It will be copied and saved so this variable is not required after this function call.
* @note New roes/columns are added automatically if required
*/
void lv_table_set_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col, const char * txt);
/**
* Set the value of a cell. Memory will be allocated to store the text by the table.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param fmt `printf`-like format
* @note New roes/columns are added automatically if required
*/
void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, const char * fmt,
...) LV_FORMAT_ATTRIBUTE(4, 5);
/**
* Set the number of rows
* @param obj table pointer to a Table object
* @param row_cnt number of rows
*/
void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt);
/**
* Set the number of columns
* @param obj table pointer to a Table object
* @param col_cnt number of columns.
*/
void lv_table_set_column_count(lv_obj_t * obj, uint32_t col_cnt);
/**
* Set the width of a column
* @param obj table pointer to a Table object
* @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1]
* @param w width of the column
*/
void lv_table_set_column_width(lv_obj_t * obj, uint32_t col_id, int32_t w);
/**
* Add control bits to the cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param ctrl OR-ed values from ::lv_table_cell_ctrl_t
*/
void lv_table_add_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl);
/**
* Clear control bits of the cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param ctrl OR-ed values from ::lv_table_cell_ctrl_t
*/
void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl);
/**
* Add custom user data to the cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param user_data pointer to the new user_data.
* Should be allocated by `lv_malloc`,
* and it will be freed automatically when the table is deleted or
* when the cell is dropped due to lower row or column count.
*/
void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data);
/**
* Set the selected cell
* @param obj pointer to a table object
* @param row id of the cell row to select
* @param col id of the cell column to select
*/
void lv_table_set_selected_cell(lv_obj_t * obj, uint16_t row, uint16_t col);
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return text in the cell
*/
const char * lv_table_get_cell_value(lv_obj_t * obj, uint32_t row, uint32_t col);
/**
* Get the number of rows.
* @param obj table pointer to a Table object
* @return number of rows.
*/
uint32_t lv_table_get_row_count(lv_obj_t * obj);
/**
* Get the number of columns.
* @param obj table pointer to a Table object
* @return number of columns.
*/
uint32_t lv_table_get_column_count(lv_obj_t * obj);
/**
* Get the width of a column
* @param obj table pointer to a Table object
* @param col id of the column [0 .. LV_TABLE_COL_MAX -1]
* @return width of the column
*/
int32_t lv_table_get_column_width(lv_obj_t * obj, uint32_t col);
/**
* Get whether a cell has the control bits
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param ctrl OR-ed values from ::lv_table_cell_ctrl_t
* @return true: all control bits are set; false: not all control bits are set
*/
bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl);
/**
* Get the selected cell (pressed and or focused)
* @param obj pointer to a table object
* @param row pointer to variable to store the selected row (LV_TABLE_CELL_NONE: if no cell selected)
* @param col pointer to variable to store the selected column (LV_TABLE_CELL_NONE: if no cell selected)
*/
void lv_table_get_selected_cell(lv_obj_t * obj, uint32_t * row, uint32_t * col);
/**
* Get custom user data to the cell.
* @param obj pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
*/
void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABLE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TABLE_H*/
@@ -0,0 +1,64 @@
/**
* @file lv_table_private.h
*
*/
#ifndef LV_TABLE_PRIVATE_H
#define LV_TABLE_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_table.h"
#if LV_USE_TABLE != 0
#include "../../core/lv_obj_private.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Cell data */
struct _lv_table_cell_t {
lv_table_cell_ctrl_t ctrl;
void * user_data; /**< Custom user data */
char txt[1]; /**< Variable length array */
};
/** Table data */
struct _lv_table_t {
lv_obj_t obj;
uint32_t col_cnt;
uint32_t row_cnt;
lv_table_cell_t ** cell_data;
int32_t * row_h;
int32_t * col_w;
uint32_t col_act;
uint32_t row_act;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_TABLE != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TABLE_PRIVATE_H*/
@@ -0,0 +1,115 @@
/**
* @file lv_tabview.h
*
*/
#ifndef LV_TABVIEW_H
#define LV_TABVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_TABVIEW
/*********************
* DEFINES
*********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a tabview widget
* @param parent pointer to a parent widget
* @return the created tabview
*/
lv_obj_t * lv_tabview_create(lv_obj_t * parent);
/**
* Add a tab to the tabview
* @param obj pointer to a tabview widget
* @param name the name of the tab, it will be displayed on the tab bar
* @return the widget where the content of the tab can be created
*/
lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name);
/**
* Change the name of the tab
* @param obj pointer to a tabview widget
* @param idx the index of the tab to rename
* @param new_name the new name as a string
*/
void lv_tabview_rename_tab(lv_obj_t * obj, uint32_t idx, const char * new_name);
/**
* Show a tab
* @param obj pointer to a tabview widget
* @param idx the index of the tab to show
* @param anim_en LV_ANIM_ON/OFF
*/
void lv_tabview_set_active(lv_obj_t * obj, uint32_t idx, lv_anim_enable_t anim_en);
/**
* Set the position of the tab bar
* @param obj pointer to a tabview widget
* @param dir LV_DIR_TOP/BOTTOM/LEFT/RIGHT
*/
void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir);
/**
* Set the width or height of the tab bar
* @param obj pointer to tabview widget
* @param size size of the tab bar in pixels or percentage.
* will be used as width or height based on the position of the tab bar)
*/
void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size);
/**
* Get the number of tabs
* @param obj pointer to a tabview widget
* @return the number of tabs
*/
uint32_t lv_tabview_get_tab_count(lv_obj_t * obj);
/**
* Get the current tab's index
* @param obj pointer to a tabview widget
* @return the zero based index of the current tab
*/
uint32_t lv_tabview_get_tab_active(lv_obj_t * obj);
/**
* Get the widget where the container of each tab is created
* @param obj pointer to a tabview widget
* @return the main container widget
*/
lv_obj_t * lv_tabview_get_content(lv_obj_t * obj);
/**
* Get the tab bar where the buttons are created
* @param obj pointer to a tabview widget
* @return the tab bar
*/
lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TABVIEW_H*/
@@ -0,0 +1,55 @@
/**
* @file lv_tabview_private.h
*
*/
#ifndef LV_TABVIEW_PRIVATE_H
#define LV_TABVIEW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_tabview.h"
#if LV_USE_TABVIEW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_tabview_t {
lv_obj_t obj;
uint32_t tab_cur;
lv_dir_t tab_pos;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_TABVIEW */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TABVIEW_PRIVATE_H*/
@@ -0,0 +1,353 @@
/**
* @file lv_textarea.h
*
*/
#ifndef LV_TEXTAREA_H
#define LV_TEXTAREA_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../label/lv_label.h"
#if LV_USE_TEXTAREA != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_textarea: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
#endif
/*********************
* DEFINES
*********************/
#define LV_TEXTAREA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/
LV_EXPORT_CONST_INT(LV_TEXTAREA_CURSOR_LAST);
/**********************
* TYPEDEFS
**********************/
#if LV_USE_OBJ_PROPERTY
enum {
LV_PROPERTY_ID(TEXTAREA, TEXT, LV_PROPERTY_TYPE_TEXT, 0),
LV_PROPERTY_ID(TEXTAREA, PLACEHOLDER_TEXT, LV_PROPERTY_TYPE_TEXT, 1),
LV_PROPERTY_ID(TEXTAREA, CURSOR_POS, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(TEXTAREA, CURSOR_CLICK_POS, LV_PROPERTY_TYPE_INT, 3),
LV_PROPERTY_ID(TEXTAREA, PASSWORD_MODE, LV_PROPERTY_TYPE_INT, 4),
LV_PROPERTY_ID(TEXTAREA, PASSWORD_BULLET, LV_PROPERTY_TYPE_TEXT, 5),
LV_PROPERTY_ID(TEXTAREA, ONE_LINE, LV_PROPERTY_TYPE_BOOL, 6),
LV_PROPERTY_ID(TEXTAREA, ACCEPTED_CHARS, LV_PROPERTY_TYPE_TEXT, 7),
LV_PROPERTY_ID(TEXTAREA, MAX_LENGTH, LV_PROPERTY_TYPE_INT, 8),
LV_PROPERTY_ID(TEXTAREA, INSERT_REPLACE, LV_PROPERTY_TYPE_TEXT, 9),
LV_PROPERTY_ID(TEXTAREA, TEXT_SELECTION, LV_PROPERTY_TYPE_BOOL, 10),
LV_PROPERTY_ID(TEXTAREA, PASSWORD_SHOW_TIME, LV_PROPERTY_TYPE_INT, 11),
LV_PROPERTY_ID(TEXTAREA, LABEL, LV_PROPERTY_TYPE_OBJ, 12),
LV_PROPERTY_ID(TEXTAREA, TEXT_IS_SELECTED, LV_PROPERTY_TYPE_INT, 13),
LV_PROPERTY_ID(TEXTAREA, CURRENT_CHAR, LV_PROPERTY_TYPE_INT, 14),
LV_PROPERTY_TEXTAREA_END,
};
#endif
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_textarea_class;
enum {
LV_PART_TEXTAREA_PLACEHOLDER = LV_PART_CUSTOM_FIRST,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a text area object
* @param parent pointer to an object, it will be the parent of the new text area
* @return pointer to the created text area
*/
lv_obj_t * lv_textarea_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/**
* Insert a character to the current cursor position.
* To add a wide char, e.g. 'Á' use `lv_text_encoded_conv_wc('Á')`
* @param obj pointer to a text area object
* @param c a character (e.g. 'a')
*/
void lv_textarea_add_char(lv_obj_t * obj, uint32_t c);
/**
* Insert a text to the current cursor position
* @param obj pointer to a text area object
* @param txt a '\0' terminated string to insert
*/
void lv_textarea_add_text(lv_obj_t * obj, const char * txt);
/**
* Delete a the left character from the current cursor position
* @param obj pointer to a text area object
*/
void lv_textarea_delete_char(lv_obj_t * obj);
/**
* Delete the right character from the current cursor position
* @param obj pointer to a text area object
*/
void lv_textarea_delete_char_forward(lv_obj_t * obj);
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a text area
* @param obj pointer to a text area object
* @param txt pointer to the text
*/
void lv_textarea_set_text(lv_obj_t * obj, const char * txt);
/**
* Set the placeholder text of a text area
* @param obj pointer to a text area object
* @param txt pointer to the text
*/
void lv_textarea_set_placeholder_text(lv_obj_t * obj, const char * txt);
/**
* Set the cursor position
* @param obj pointer to a text area object
* @param pos the new cursor position in character index
* < 0 : index from the end of the text
* LV_TEXTAREA_CURSOR_LAST: go after the last character
*/
void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos);
/**
* Enable/Disable the positioning of the cursor by clicking the text on the text area.
* @param obj pointer to a text area object
* @param en true: enable click positions; false: disable
*/
void lv_textarea_set_cursor_click_pos(lv_obj_t * obj, bool en);
/**
* Enable/Disable password mode
* @param obj pointer to a text area object
* @param en true: enable, false: disable
*/
void lv_textarea_set_password_mode(lv_obj_t * obj, bool en);
/**
* Set the replacement characters to show in password mode
* @param obj pointer to a text area object
* @param bullet pointer to the replacement text
*/
void lv_textarea_set_password_bullet(lv_obj_t * obj, const char * bullet);
/**
* Configure the text area to one line or back to normal
* @param obj pointer to a text area object
* @param en true: one line, false: normal
*/
void lv_textarea_set_one_line(lv_obj_t * obj, bool en);
/**
* Set a list of characters. Only these characters will be accepted by the text area
* @param obj pointer to a text area object
* @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
*/
void lv_textarea_set_accepted_chars(lv_obj_t * obj, const char * list);
/**
* Set max length of a Text Area.
* @param obj pointer to a text area object
* @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it)
*/
void lv_textarea_set_max_length(lv_obj_t * obj, uint32_t num);
/**
* In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by another text.
* It can be used to add automatic formatting to the text area.
* @param obj pointer to a text area object
* @param txt pointer to a new string to insert. If `""` no text will be added.
* The variable must be live after the `event_cb` exists. (Should be `global` or `static`)
*/
void lv_textarea_set_insert_replace(lv_obj_t * obj, const char * txt);
/**
* Enable/disable selection mode.
* @param obj pointer to a text area object
* @param en true or false to enable/disable selection mode
*/
void lv_textarea_set_text_selection(lv_obj_t * obj, bool en);
/**
* Set how long show the password before changing it to '*'
* @param obj pointer to a text area object
* @param time show time in milliseconds. 0: hide immediately.
*/
void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time);
/**
* @deprecated Use the normal text_align style property instead
* Set the label's alignment.
* It sets where the label is aligned (in one line mode it can be smaller than the text area)
* and how the lines of the area align in case of multiline text area
* @param obj pointer to a text area object
* @param align the align mode from ::lv_text_align_t
*/
void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a text area. In password mode it gives the real text (not '*'s).
* @param obj pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_text(const lv_obj_t * obj);
/**
* Get the placeholder text of a text area
* @param obj pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_placeholder_text(lv_obj_t * obj);
/**
* Get the label of a text area
* @param obj pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_textarea_get_label(const lv_obj_t * obj);
/**
* Get the current cursor position in character index
* @param obj pointer to a text area object
* @return the cursor position
*/
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * obj);
/**
* Get whether the cursor click positioning is enabled or not.
* @param obj pointer to a text area object
* @return true: enable click positions; false: disable
*/
bool lv_textarea_get_cursor_click_pos(lv_obj_t * obj);
/**
* Get the password mode attribute
* @param obj pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_textarea_get_password_mode(const lv_obj_t * obj);
/**
* Get the replacement characters to show in password mode
* @param obj pointer to a text area object
* @return pointer to the replacement text
*/
const char * lv_textarea_get_password_bullet(lv_obj_t * obj);
/**
* Get the one line configuration attribute
* @param obj pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_textarea_get_one_line(const lv_obj_t * obj);
/**
* Get a list of accepted characters.
* @param obj pointer to a text area object
* @return list of accented characters.
*/
const char * lv_textarea_get_accepted_chars(lv_obj_t * obj);
/**
* Get max length of a Text Area.
* @param obj pointer to a text area object
* @return the maximal number of characters to be add
*/
uint32_t lv_textarea_get_max_length(lv_obj_t * obj);
/**
* Find whether text is selected or not.
* @param obj pointer to a text area object
* @return whether text is selected or not
*/
bool lv_textarea_text_is_selected(const lv_obj_t * obj);
/**
* Find whether selection mode is enabled.
* @param obj pointer to a text area object
* @return true: selection mode is enabled, false: disabled
*/
bool lv_textarea_get_text_selection(lv_obj_t * obj);
/**
* Set how long show the password before changing it to '*'
* @param obj pointer to a text area object
* @return show time in milliseconds. 0: hide immediately.
*/
uint32_t lv_textarea_get_password_show_time(lv_obj_t * obj);
/**
* Get a the character from the current cursor position
* @param obj pointer to a text area object
* @return a the character or 0
*/
uint32_t lv_textarea_get_current_char(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Clear the selection on the text area.
* @param obj pointer to a text area object
*/
void lv_textarea_clear_selection(lv_obj_t * obj);
/**
* Move the cursor one character right
* @param obj pointer to a text area object
*/
void lv_textarea_cursor_right(lv_obj_t * obj);
/**
* Move the cursor one character left
* @param obj pointer to a text area object
*/
void lv_textarea_cursor_left(lv_obj_t * obj);
/**
* Move the cursor one line down
* @param obj pointer to a text area object
*/
void lv_textarea_cursor_down(lv_obj_t * obj);
/**
* Move the cursor one line up
* @param obj pointer to a text area object
*/
void lv_textarea_cursor_up(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TEXTAREA_H*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TEXTAREA_H*/
@@ -0,0 +1,75 @@
/**
* @file lv_textarea_private.h
*
*/
#ifndef LV_TEXTAREA_PRIVATE_H
#define LV_TEXTAREA_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_textarea.h"
#if LV_USE_TEXTAREA != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Data of text area */
struct _lv_textarea_t {
lv_obj_t obj;
lv_obj_t * label; /**< Label of the text area */
char * placeholder_txt; /**< Place holder label. only visible if text is an empty string */
char * pwd_tmp; /**< Used to store the original text in password mode */
char * pwd_bullet; /**< Replacement characters displayed in password mode */
const char * accepted_chars; /**< Only these characters will be accepted. NULL: accept all */
uint32_t max_length; /**< The max. number of characters. 0: no limit */
uint32_t pwd_show_time; /**< Time to show characters in password mode before change them to '*' */
struct {
int32_t valid_x; /**< Used when stepping up/down to a shorter line.
*(Used by the library) */
uint32_t pos; /**< The current cursor position
*(0: before 1st letter; 1: before 2nd letter ...) */
lv_area_t area; /**< Cursor area relative to the Text Area */
uint32_t txt_byte_pos; /**< Byte index of the letter after (on) the cursor */
uint8_t show : 1; /**< Cursor is visible now or not (Handled by the library) */
uint8_t click_pos : 1; /**< 1: Enable positioning the cursor by clicking the text area */
} cursor;
#if LV_LABEL_TEXT_SELECTION
uint32_t sel_start; /**< Temporary values for text selection */
uint32_t sel_end;
uint8_t text_sel_in_prog : 1; /**< User is in process of selecting */
uint8_t text_sel_en : 1; /**< Text can be selected on this text area */
#endif
uint8_t pwd_mode : 1; /**< Replace characters with '*' */
uint8_t one_line : 1; /**< One line mode (ignore line breaks) */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_TEXTAREA != 0 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TEXTAREA_PRIVATE_H*/
@@ -0,0 +1,86 @@
/**
* @file lv_tileview.h
*
*/
#ifndef LV_TILEVIEW_H
#define LV_TILEVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_TILEVIEW
/*********************
* DEFINES
*********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_class;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_tile_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a tileview object
* @param parent pointer to an object, it will be the parent of the new tileview
* @return pointer to the created tileview
*/
lv_obj_t * lv_tileview_create(lv_obj_t * parent);
/**
* Add a tile to the tileview
* @param tv pointer to the tileview object
* @param col_id column id of the tile
* @param row_id row id of the tile
* @param dir direction to move to the next tile
* @return pointer to the added tile object
*/
lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir);
/**
* Set the active tile in the tileview.
* @param parent pointer to the tileview object
* @param tile_obj pointer to the tile object to be set as active
* @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF)
*/
void lv_tileview_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en);
/**
* Set the active tile by index in the tileview
* @param tv pointer to the tileview object
* @param col_id column id of the tile to be set as active
* @param row_id row id of the tile to be set as active
* @param anim_en animation enable flag (LV_ANIM_ON or LV_ANIM_OFF)
*/
void lv_tileview_set_tile_by_index(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en);
/**
* Get the currently active tile in the tileview
* @param obj pointer to the tileview object
* @return pointer to the currently active tile object
*/
lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_TILEVIEW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TILEVIEW_H*/
@@ -0,0 +1,58 @@
/**
* @file lv_tileview_private.h
*
*/
#ifndef LV_TILEVIEW_PRIVATE_H
#define LV_TILEVIEW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_tileview.h"
#if LV_USE_TILEVIEW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_tileview_t {
lv_obj_t obj;
lv_obj_t * tile_act;
};
struct _lv_tileview_tile_t {
lv_obj_t obj;
lv_dir_t dir;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_TILEVIEW */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TILEVIEW_PRIVATE_H*/
+74
View File
@@ -0,0 +1,74 @@
/**
* @file lv_win.h
*
*/
#ifndef LV_WIN_H
#define LV_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../core/lv_obj.h"
#if LV_USE_WIN
/*********************
* DEFINES
*********************/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_win_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a window widget
* @param parent pointer to a parent widget
* @return the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * parent);
/**
* Add a title to the window
* @param obj pointer to a window widget
* @param txt the text of the title
* @return the widget where the content of the title can be created
*/
lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt);
/**
* Add a button to the window
* @param obj pointer to a window widget
* @param icon an icon to be displayed on the button
* @param btn_w width of the button
* @return the widget where the content of the button can be created
*/
lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, int32_t btn_w);
/**
* Get the header of the window
* @param win pointer to a window widget
* @return the header of the window
*/
lv_obj_t * lv_win_get_header(lv_obj_t * win);
/**
* Get the content of the window
* @param win pointer to a window widget
* @return the content of the window
*/
lv_obj_t * lv_win_get_content(lv_obj_t * win);
/**********************
* MACROS
**********************/
#endif /*LV_USE_WIN*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WIN_H*/
@@ -0,0 +1,52 @@
/**
* @file lv_win_private.h
*
*/
#ifndef LV_WIN_PRIVATE_H
#define LV_WIN_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj_private.h"
#include "lv_win.h"
#if LV_USE_WIN
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_win_t {
lv_obj_t obj;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_WIN */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WIN_PRIVATE_H*/