arch: move public headers to include folder (#10041)

This commit is contained in:
André Costa
2026-05-03 08:26:08 +02:00
committed by GitHub
parent ac5e44d12c
commit c329a2db34
1123 changed files with 48289 additions and 48961 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lvgl.h"
#include "../include/lvgl/lvgl.h"
typedef struct _lv_demo_args lv_demo_args_t;
+2 -2
View File
@@ -14,8 +14,8 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_demos.h"
#include "../../src/draw/lv_draw.h"
#include "../../src/draw/lv_draw_triangle.h"
#include "../../include/lvgl/draw/lv_draw.h"
#include "../../include/lvgl/draw/lv_draw_triangle.h"
#if LV_USE_DEMO_WIDGETS
+1 -3
View File
@@ -10,9 +10,7 @@ if(LV_MICROPYTHON)
SRCS
${SOURCES}
INCLUDE_DIRS
${LVGL_ROOT_DIR}
${LVGL_ROOT_DIR}/src
${LVGL_ROOT_DIR}/../
${LVGL_ROOT_DIR}/include
REQUIRES
main)
else()
+33 -51
View File
@@ -61,6 +61,7 @@ endif()
# Determine if LVGL is built from a top-level directory
get_directory_property(HAS_PARENT_SCOPE PARENT_DIRECTORY)
set(LVGL_INCLUDE_DIR ${LVGL_ROOT_DIR}/include)
# Set sources used for LVGL components
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c
@@ -175,7 +176,7 @@ if (LV_BUILD_SET_CONFIG_OPTS)
execute_process(
COMMAND ${Python_EXECUTABLE} ${LVGL_ROOT_DIR}/scripts/preprocess_lv_conf_internal.py
--input ${LVGL_ROOT_DIR}/src/lv_conf_internal.h
--input ${LVGL_INCLUDE_DIR}/lvgl/config/lv_conf_internal.h
--tmp_file ${CMAKE_CURRENT_BINARY_DIR}/tmp.h
--output ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
--workfolder ${CMAKE_CURRENT_BINARY_DIR}
@@ -218,9 +219,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/dependencies.cmake)
# Set the configuration inc dir for all targets created in this CMakeLists.txt
# CMAKE_CURRENT_SOURCE_DIR is necessary because the assets include lvgl/lvgl.h ...
include_directories(${CONF_INC_DIR} ${LVGL_ROOT_DIR})
include_directories(${CONF_INC_DIR} ${LVGL_INCLUDE_DIR} ${LVGL_INCLUDE_DIR}/lvgl)
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${CONF_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LVGL_INCLUDE_DIR} ${CONF_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR})
# Propagate the compiler definitions set on LVGL to the rest of the targets
# mentioned in this file
@@ -296,16 +297,7 @@ endif()
############################## INSTALLATION ######################################
# Library and headers can be installed to system using make install
file(GLOB LVGL_PUBLIC_HEADERS
"${LVGL_ROOT_DIR}/lvgl.h"
"${CONF_INC_DIR}/*.h"
"${LVGL_ROOT_DIR}/lv_version.h")
if (CONFIG_LV_USE_PRIVATE_API)
list(APPEND LVGL_PUBLIC_HEADERS "${LVGL_ROOT_DIR}/lvgl_private.h")
endif()
# Install directory defaults
if("${LIB_INSTALL_DIR}" STREQUAL "")
set(LIB_INSTALL_DIR "lib")
endif()
@@ -313,19 +305,16 @@ if("${RUNTIME_INSTALL_DIR}" STREQUAL "")
set(RUNTIME_INSTALL_DIR "bin")
endif()
if("${INC_INSTALL_DIR}" STREQUAL "")
set(INC_INSTALL_DIR "include/lvgl")
set(INC_INSTALL_DIR "include")
endif()
#Install public headers
# Install public headers
install(
DIRECTORY "${LVGL_ROOT_DIR}/src"
DESTINATION "${INC_INSTALL_DIR}"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*_private.h" EXCLUDE)
DIRECTORY "${LVGL_ROOT_DIR}/include/lvgl"
DESTINATION "${INC_INSTALL_DIR}")
if (CONFIG_LV_USE_PRIVATE_API)
# Install private headers - only if required
# Install private headers only if required
if(CONFIG_LV_USE_PRIVATE_API)
install(
DIRECTORY "${LVGL_ROOT_DIR}/src"
DESTINATION "${INC_INSTALL_DIR}"
@@ -333,43 +322,36 @@ if (CONFIG_LV_USE_PRIVATE_API)
PATTERN "*_private.h")
endif()
if (LV_BUILD_USE_KCONFIG)
# When KConfig is used, copy the expanded conf header
# and rename it to lv_conf.h
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h
DESTINATION ${INC_INSTALL_DIR}
RENAME lv_conf.h)
# When KConfig is used, copy the expanded conf header and rename it to lv_conf.h
if(LV_BUILD_USE_KCONFIG)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lv_conf_expanded.h"
DESTINATION "${INC_INSTALL_DIR}"
RENAME lv_conf.h)
endif()
# Configure and install generated files
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc" @ONLY)
configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/lv_version.h" @ONLY)
install(
FILES ${LVGL_PUBLIC_HEADERS}
DESTINATION "${INC_INSTALL_DIR}/")
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
DESTINATION "share/pkgconfig/")
# Install library
set_target_properties(
lvgl
PROPERTIES OUTPUT_NAME lvgl
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
set_target_properties(lvgl
PROPERTIES
OUTPUT_NAME lvgl
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
install(
TARGETS lvgl
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
# TODO: if LVGL is linked with something else eg Freetype, Pkgconfig file must contain -lfreetype2
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc @ONLY)
configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" ${CMAKE_CURRENT_BINARY_DIR}/lv_version.h @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
DESTINATION "share/pkgconfig/")
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}")
# Install library thorvg
if(CONFIG_LV_USE_THORVG_INTERNAL)
@@ -396,7 +378,7 @@ if(CONFIG_LV_BUILD_DEMOS)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos"
DESTINATION "${INC_INSTALL_DIR}"
DESTINATION "${INC_INSTALL_DIR}/lvgl"
FILES_MATCHING
PATTERN "*.h")
@@ -422,7 +404,7 @@ if(CONFIG_LV_BUILD_EXAMPLES)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples"
DESTINATION "${INC_INSTALL_DIR}"
DESTINATION "${INC_INSTALL_DIR}/lvgl"
FILES_MATCHING
PATTERN "*.h")
+72
View File
@@ -0,0 +1,72 @@
/**
* @file lv_3dmath.h
*
*/
#ifndef LV_3DMATH_H
#define LV_3DMATH_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
/*********************
* DEFINES
*********************/
#if LV_USE_GLTF
/**********************
* TYPEDEFS
**********************/
typedef struct {
float x;
float y;
float z;
} lv_3dpoint_t;
typedef struct {
float x;
float y;
float z;
float w;
} lv_quaternion_t;
typedef struct {
lv_3dpoint_t origin;
lv_3dpoint_t direction;
} lv_3dplane_t;
typedef lv_3dplane_t lv_3dray_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Get a plane that faces upward, centered at a given height
* @param elevation elevation of the ground plane, in world units. this is usually zero
* @return ground plane
*/
lv_3dplane_t lv_get_ground_plane(float elevation);
/**********************
* MACROS
**********************/
#endif /*LV_USE_GLTF*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_3DMATH_H*/
+92
View File
@@ -0,0 +1,92 @@
/**
* @file lv_gltf_environment.h
*
*/
#ifndef LV_GLTF_ENVIRONMENT_H
#define LV_GLTF_ENVIRONMENT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_GLTF
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
#define LV_GLTF_DEFAULT_CUBE_MAP_RESOLUTION 128
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an IBL sampler for processing environment images
* @return pointer to the created sampler, or NULL on failure
* @note Can be safely deleted after environments are created
*/
lv_gltf_ibl_sampler_t * lv_gltf_ibl_sampler_create(void);
/**
* Set the resolution for each cubemap face
* @param pointer to a sampler
* @param resolution of each cube map face in pixels (recommended: 64-512 for embedded)
*/
void lv_gltf_ibl_sampler_set_cube_map_pixel_resolution(lv_gltf_ibl_sampler_t * sampler, uint32_t resolution);
/**
* Delete an IBL sampler
* @param sampler pointer to the sampler to delete
*/
void lv_gltf_ibl_sampler_delete(lv_gltf_ibl_sampler_t * sampler);
/**
* Create an environment from an HDR or JPEG panoramic image for IBL rendering
* @param sampler IBL sampler defining output resolution (can be deleted after this call)
* @param file_path path to equirectangular environment image, or NULL to use default embedded image
* @return pointer to the created environment, or NULL on failure
*
* @note The source image will be downsampled to the sampler's texture_size
* @note The environment can be shared across multiple glTF objects
*/
lv_gltf_environment_t * lv_gltf_environment_create(lv_gltf_ibl_sampler_t * sampler, const char * file_path);
/**
* Set the rotation angle of the environment map
* @param env pointer to the environment
* @param angle rotation angle in degrees
*/
void lv_gltf_environment_set_angle(lv_gltf_environment_t * env, float angle);
/**
* Delete an environment
* @param environment pointer to the environment to delete
*/
void lv_gltf_environment_delete(lv_gltf_environment_t * environment);
/**********************
* MACROS
**********************/
#endif /*LV_USE_GLTF*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GLTF_ENVIRONMENT_H*/
+179
View File
@@ -0,0 +1,179 @@
#ifndef LV_GLTF_MODEL_H
#define LV_GLTF_MODEL_H
#include "../config/lv_conf_internal.h"
#if LV_USE_GLTF
#include "../core/lv_event.h"
#include "../lv_types.h"
#include "lv_gltf_model_node.h"
#include "lv_gltf_model_loader.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Load a glTF model from a file
* @param file_path path to the glTF file to load
* @param loader pointer to the glTF model loader instance, or NULL to create a new one
* @return pointer to the loaded glTF model, or NULL on failure
* @note If loader is NULL, an internal loader will be created and managed automatically
*/
lv_gltf_model_t * lv_gltf_data_load_from_file(const char * file_path,
lv_gltf_model_loader_t * loader);
/**
* Load a glTF model from a byte array
* @param data pointer to the glTF data buffer
* @param data_size size of the data buffer in bytes
* @param loader pointer to the glTF model loader instance, or NULL to create a new one
* @return pointer to the loaded glTF model, or NULL on failure
* @note If loader is NULL, an internal loader will be created and managed automatically
*/
lv_gltf_model_t * lv_gltf_data_load_from_bytes(const uint8_t * data, size_t data_size,
lv_gltf_model_loader_t * loader);
/**
* Delete a glTF model
* @param model the gltf model to delete
*/
void lv_gltf_model_delete(lv_gltf_model_t * model);
/**
* @brief Get the number of images in the glTF model
*
* Images in glTF are used as sources for textures and can be stored either as external files
* or embedded as base64-encoded model within the glTF file.
*
* @param model Pointer to the glTF model data structure
* @return Number of images in the model
*/
size_t lv_gltf_model_get_image_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of textures in the glTF model
*
* Textures define how images are sampled and applied to materials. Each texture references
* an image and may specify sampling parameters like filtering and wrapping modes.
*
* @param model Pointer to the glTF model data structure
* @return Number of textures in the model
*/
size_t lv_gltf_model_get_texture_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of materials in the glTF model
*
* Materials define the visual appearance of mesh primitives, including properties like
* base color, metallic/roughness values, normal maps, and other surface characteristics.
*
* @param model Pointer to the glTF model data structure
* @return Number of materials in the model
*/
size_t lv_gltf_model_get_material_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of cameras in the glTF model
*
* Cameras define viewpoints within the 3D scene and can be either perspective or
* orthographic. They are typically attached to nodes in the scene graph.
*
* @param model Pointer to the glTF model data structure
* @return Number of cameras in the model
*/
size_t lv_gltf_model_get_camera_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of meshes in the glTF model
*
* Meshes contain the geometric model for 3D objects, including vertex positions, normals,
* texture coordinates, and indices. Each mesh can have multiple primitives with different materials.
*
* @param model Pointer to the glTF model data structure
* @return Number of meshes in the model
*/
size_t lv_gltf_model_get_mesh_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of scenes in the glTF model
*
* Scenes define the root nodes of the scene graph. A glTF file can contain multiple scenes,
* though typically only one is designated as the default scene to be displayed.
*
* @param model Pointer to the glTF model data structure
* @return Number of scenes in the model
*/
size_t lv_gltf_model_get_scene_count(const lv_gltf_model_t * model);
/**
* @brief Get the number of animations in the glTF model
*
* Animations define keyframe-based motion for nodes in the scene, including transformations
* like translation, rotation, and scaling over time.
*
* @param model Pointer to the glTF model data structure
* @return Number of animations in the model
*/
size_t lv_gltf_model_get_animation_count(const lv_gltf_model_t * model);
/**
* @brief Select and start playing an animation
*
* @param model Pointer to the glTF model structure
* @param index Animation number to start playing
* @return LV_RESULT_OK if the animation was started else LV_RESULT_INVALID
*/
lv_result_t lv_gltf_model_play_animation(lv_gltf_model_t * model, size_t index);
/**
* @brief Pause the current animation
*
* @param model Pointer to the glTF model structure
*/
void lv_gltf_model_pause_animation(lv_gltf_model_t * model);
/**
* @brief Check if an animation is currently being played
*
* @param model Pointer to the glTF model structure
*/
bool lv_gltf_model_is_animation_paused(lv_gltf_model_t * model);
/**
* @brief Get the current selected animation. To see if it's playing see `lv_gltf_model_is_animation_paused`
*
* @param model Pointer to the glTF model structure
*/
size_t lv_gltf_model_get_animation(lv_gltf_model_t * model);
/**
* Set the animation speed ratio
*
* The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL
* Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation
* Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation
*
* @param model pointer to a glTF model
* @param value speed-up ratio of the animation
*/
void lv_gltf_model_set_animation_speed(lv_gltf_model_t * model, uint32_t value);
/**
* Get the animation speed ratio
*
* The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL
*
* @param model pointer to a glTF model
*/
uint32_t lv_gltf_model_get_animation_speed(const lv_gltf_model_t * model);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_USE_GLTF*/
#endif /*LV_GLTF_MODEL_H*/
+75
View File
@@ -0,0 +1,75 @@
/**
* @file lv_gltf_model_loader.h
*
*/
#ifndef LV_GLTF_MODEL_LOADER_H
#define LV_GLTF_MODEL_LOADER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_GLTF
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct _lv_gltf_model_loader_t lv_gltf_model_loader_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a new glTF model loader instance
* @return pointer to the newly created glTF model loader instance
*/
lv_gltf_model_loader_t * lv_gltf_model_loader_create(void);
/**
* Store a texture ID associated with a texture hash in the loader
* @param loader pointer to the glTF model loader instance
* @param texture_hash hash value identifying the texture
* @param texture_id the texture ID to associate with the hash
*/
void lv_gltf_model_loader_store_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash, uint32_t texture_id);
/**
* Retrieve a texture ID by its hash from the loader
* @param loader pointer to the glTF model loader instance
* @param texture_hash hash value of the texture to retrieve
* @return the texture ID associated with the hash, or 0 if not found
*/
uint32_t lv_gltf_model_loader_get_texture(lv_gltf_model_loader_t * loader, uint32_t texture_hash);
/**
* Delete a glTF model loader instance and free its resources
* @param loader pointer to the glTF model loader instance to delete
*/
void lv_gltf_model_loader_delete(lv_gltf_model_loader_t * loader);
/**********************
* MACROS
**********************/
#endif /*LV_USE_GLTF*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GLTF_MODEL_LOADER_H*/
+273
View File
@@ -0,0 +1,273 @@
/**
* @file lv_gltf_model_node.h
*
*/
#ifndef LV_GLTF_MODEL_NODE_H
#define LV_GLTF_MODEL_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_GLTF
#include "../lv_types.h"
#include "lv_3dmath.h"
#include "../core/lv_event.h"
/*********************
* DEFINES
*********************/
#define LV_GLTF_ANIM_SPEED_TENTH 100
#define LV_GLTF_ANIM_SPEED_QUARTER 250
#define LV_GLTF_ANIM_SPEED_HALF 500
#define LV_GLTF_ANIM_SPEED_NORMAL 1000
#define LV_GLTF_ANIM_SPEED_2X 2000
#define LV_GLTF_ANIM_SPEED_3X 3000
#define LV_GLTF_ANIM_SPEED_4X 4000
#define LV_GLTF_DEFAULT_CAMERA 0
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Get a glTF model node by its index
*
* @param data Pointer to the glTF model structure
* @param index The index of the node to retrieve
* @return Pointer to the glTF model node, or NULL if not found
*/
lv_gltf_model_node_t * lv_gltf_model_node_get_by_index(lv_gltf_model_t * data, size_t index);
/**
* @brief Get a glTF model node by its numeric path
*
* @param data Pointer to the glTF model structure
* @param num_path The numeric path string of the node to retrieve (eg. ".0")
* @return Pointer to the glTF model node, or NULL if not found
*/
lv_gltf_model_node_t * lv_gltf_model_node_get_by_numeric_path(lv_gltf_model_t * data, const char * num_path);
/**
* @brief Get a glTF model node by its path
*
* @param data Pointer to the glTF model structure
* @param path The path string of the node to retrieve
* @return Pointer to the glTF model node, or NULL if not found
*/
lv_gltf_model_node_t * lv_gltf_model_node_get_by_path(lv_gltf_model_t * data, const char * path);
/**
* @brief Get the path of a glTF model node
*
* @param node Pointer to the glTF model node structure
* @return The path string of the node, or NULL if node is invalid
*/
const char * lv_gltf_model_node_get_path(lv_gltf_model_node_t * node);
/**
* @brief Get the IP (internal pointer/identifier) of a glTF model node
*
* @param node Pointer to the glTF model node structure
* @return The IP string of the node, or NULL if node is invalid
*/
const char * lv_gltf_model_node_get_ip(lv_gltf_model_node_t * node);
/**
* @brief Add an event callback to a glTF model node
*
* @param node Pointer to the glTF model node structure
* @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data.
* @param filter_list Event code filter for the callback
* @param user_data User data to pass to the callback
* @return Pointer to the event descriptor, or NULL if allocation failed
*/
lv_event_dsc_t * lv_gltf_model_node_add_event_cb(lv_gltf_model_node_t * node, lv_event_cb_t cb,
lv_event_code_t filter_list,
void * user_data);
/**
* @brief Add an event callback to a glTF model node with world position computation enabled. Use this only when world position is needed, as computing it is an expensive operation.
*
* @param node Pointer to the glTF model node structure
* @param cb The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data.
* @param filter_list Event code filter for the callback
* @param user_data User data to pass to the callback
* @return Pointer to the event descriptor, or NULL if allocation failed
*/
lv_event_dsc_t * lv_gltf_model_node_add_event_cb_with_world_position(lv_gltf_model_node_t * node, lv_event_cb_t cb,
lv_event_code_t filter_list,
void * user_data);
/**
* @brief Get the number of nodes in the glTF model
*
* Nodes form the scene graph hierarchy and can contain transformations, meshes, cameras,
* or other nodes as children. They define the spatial relationships between objects in the scene.
*
* @param model Pointer to the glTF model data structure
* @return Number of nodes in the model
*/
size_t lv_gltf_model_get_node_count(const lv_gltf_model_t * model);
/**
* @brief Set the X position of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param x The X position value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_position_x(lv_gltf_model_node_t * node, float x);
/**
* @brief Set the Y position of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param y The Y position value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_position_y(lv_gltf_model_node_t * node, float y);
/**
* @brief Set the Z position of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param z The Z position value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_position_z(lv_gltf_model_node_t * node, float z);
/**
* @brief Set the X component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param x The X rotation component value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_rotation_x(lv_gltf_model_node_t * node, float x);
/**
* @brief Set the Y component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param y The Y rotation component value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_rotation_y(lv_gltf_model_node_t * node, float y);
/**
* @brief Set the Z component of a glTF model node's rotation quaternion. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param z The Z rotation component value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_rotation_z(lv_gltf_model_node_t * node, float z);
/**
* @brief Set the X scale of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param x The X scale value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_scale_x(lv_gltf_model_node_t * node, float x);
/**
* @brief Set the Y scale of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param y The Y scale value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_scale_y(lv_gltf_model_node_t * node, float y);
/**
* @brief Set the Z scale of a glTF model node. The operation is queued and applied on the next rendering phase.
*
* @param node Pointer to the glTF model node structure
* @param z The Z scale value
* @return LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if node is null or no more memory to queue the operation
*/
lv_result_t lv_gltf_model_node_set_scale_z(lv_gltf_model_node_t * node, float z);
/**
* @brief Get the local position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
*
* Local position is relative to the node's parent.
*
* This function is only valid when called from an event callback registered.
* See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()`
*
* @param e Pointer to the event structure from the callback
* @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z)
* @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null
*/
lv_result_t lv_gltf_model_node_get_local_position(lv_event_t * e, lv_3dpoint_t * result);
/**
* @brief Get the world position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback
* registered with world position enabled.
*
* World position is the absolute position in global scene coordinates.
*
* This function requires the event callback to be registered with lv_gltf_model_node_add_event_cb_with_world_position()
* as it involves complex matrix calculations that are computed on-demand.
*
* @param e Pointer to the event structure from the callback
* @param result Pointer to lv_3dpoint_t structure to store the position (x, y, z)
* @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback, world position not enabled, or if parameters are null
*/
lv_result_t lv_gltf_model_node_get_world_position(lv_event_t * e, lv_3dpoint_t * result);
/**
* @brief Get the scale of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
*
* Returns the scale factors for each axis.
*
* This function is only valid when called from an event callback registered.
* See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()`
*
* @param e Pointer to the event structure from the callback
* @param result Pointer to lv_3dpoint_t structure to store the scale (x, y, z)
* @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null
*/
lv_result_t lv_gltf_model_node_get_scale(lv_event_t * e, lv_3dpoint_t * result);
/**
* @brief Get the Euler rotation of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
*
* Returns rotation as Euler angles in radians (x, y, z).
*
* This function is only valid when called from an event callback registered.
* See `lv_gltf_model_node_add_event_cb()` and `lv_gltf_model_node_add_event_cb_with_world_position()`
*
* @param e Pointer to the event structure from the callback
* @param result Pointer to lv_3dpoint_t structure to store the rotation in radians (x, y, z)
* @return LV_RESULT_OK if successful, LV_RESULT_INVALID if called outside event callback or if parameters are null
*/
lv_result_t lv_gltf_model_node_get_euler_rotation(lv_event_t * e, lv_3dpoint_t * result);
/**********************
* MACROS
**********************/
#endif /*LV_USE_GLTF*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GLTF_MODEL_NODE_H*/
+332
View File
@@ -0,0 +1,332 @@
/**
* @file lv_api_map_v8.h
*
*/
#ifndef LV_API_MAP_V8_H
#define LV_API_MAP_V8_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "../draw/lv_image_dsc.h"
#include "../display/lv_display.h"
#include "../core/lv_anim_timeline.h"
#include "../widgets/lv_buttonmatrix.h"
/*********************
* DEFINES
*********************/
#define LV_DISP_ROTATION_0 LV_DISPLAY_ROTATION_0
#define LV_DISP_ROTATION_90 LV_DISPLAY_ROTATION_90
#define LV_DISP_ROTATION_180 LV_DISPLAY_ROTATION_180
#define LV_DISP_ROTATION_270 LV_DISPLAY_ROTATION_270
#define LV_DISP_RENDER_MODE_PARTIAL LV_DISPLAY_RENDER_MODE_PARTIAL
#define LV_DISP_RENDER_MODE_DIRECT LV_DISPLAY_RENDER_MODE_DIRECT
#define LV_DISP_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL
#if LV_USE_BUTTONMATRIX
#define LV_BTNMATRIX_BTN_NONE LV_BUTTONMATRIX_BUTTON_NONE
#define LV_BTNMATRIX_CTRL_HIDDEN LV_BUTTONMATRIX_CTRL_HIDDEN
#define LV_BTNMATRIX_CTRL_NO_REPEAT LV_BUTTONMATRIX_CTRL_NO_REPEAT
#define LV_BTNMATRIX_CTRL_DISABLED LV_BUTTONMATRIX_CTRL_DISABLED
#define LV_BTNMATRIX_CTRL_CHECKABLE LV_BUTTONMATRIX_CTRL_CHECKABLE
#define LV_BTNMATRIX_CTRL_CHECKED LV_BUTTONMATRIX_CTRL_CHECKED
#define LV_BTNMATRIX_CTRL_CLICK_TRIG LV_BUTTONMATRIX_CTRL_CLICK_TRIG
#define LV_BTNMATRIX_CTRL_POPOVER LV_BUTTONMATRIX_CTRL_POPOVER
#define LV_BTNMATRIX_CTRL_CUSTOM_1 LV_BUTTONMATRIX_CTRL_CUSTOM_1
#define LV_BTNMATRIX_CTRL_CUSTOM_2 LV_BUTTONMATRIX_CTRL_CUSTOM_2
#endif /* LV_USE_BUTTONMATRIX */
/**********************
* TYPEDEFS
**********************/
typedef int32_t lv_coord_t;
typedef lv_result_t lv_res_t;
typedef lv_image_dsc_t lv_img_dsc_t;
typedef lv_display_t lv_disp_t;
typedef lv_display_rotation_t lv_disp_rotation_t;
typedef lv_display_render_mode_t lv_disp_render_t;
typedef lv_anim_completed_cb_t lv_anim_ready_cb_t;
typedef lv_screen_load_anim_t lv_scr_load_anim_t;
#if LV_USE_BUTTONMATRIX
typedef lv_buttonmatrix_ctrl_t lv_btnmatrix_ctrl_t;
#endif /* LV_USE_BUTTONMATRIX */
#if LV_USE_IMAGEBUTTON
#define LV_IMGBTN_STATE_RELEASED LV_IMAGEBUTTON_STATE_RELEASED
#define LV_IMGBTN_STATE_PRESSED LV_IMAGEBUTTON_STATE_PRESSED
#define LV_IMGBTN_STATE_DISABLED LV_IMAGEBUTTON_STATE_DISABLED
#define LV_IMGBTN_STATE_CHECKED_RELEASED LV_IMAGEBUTTON_STATE_CHECKED_RELEASED
#define LV_IMGBTN_STATE_CHECKED_PRESSED LV_IMAGEBUTTON_STATE_CHECKED_PRESSED
#define LV_IMGBTN_STATE_CHECKED_DISABLED LV_IMAGEBUTTON_STATE_CHECKED_DISABLED
#endif /* LV_USE_IMAGEBUTTON */
/**********************
* GLOBAL PROTOTYPES
**********************/
static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void)
{
return lv_timer_handler();
}
/**
* Move the object to the foreground.
* It will look like if it was created as the last child of its parent.
* It also means it can cover any of the siblings.
* @param obj pointer to an object
*/
static inline void lv_obj_move_foreground(lv_obj_t * obj)
{
lv_obj_t * parent = lv_obj_get_parent(obj);
if(!parent) {
LV_LOG_WARN("parent is NULL");
return;
}
lv_obj_move_to_index(obj, lv_obj_get_child_count(parent) - 1);
}
/**
* Move the object to the background.
* It will look like if it was created as the first child of its parent.
* It also means any of the siblings can cover the object.
* @param obj pointer to an object
*/
static inline void lv_obj_move_background(lv_obj_t * obj)
{
lv_obj_move_to_index(obj, 0);
}
/**********************
* MACROS
**********************/
#define LV_RES_OK LV_RESULT_OK
#define LV_RES_INV LV_RESULT_INVALID
#define LV_INDEV_STATE_PR LV_INDEV_STATE_PRESSED
#define LV_INDEV_STATE_REL LV_INDEV_STATE_RELEASED
#define lv_obj_del lv_obj_delete
#define lv_obj_del_async lv_obj_delete_async
#define lv_obj_clear_flag lv_obj_remove_flag
#define lv_obj_clear_state lv_obj_remove_state
#define lv_indev_set_disp lv_indev_set_display
#define lv_indev_get_act lv_indev_active
#define lv_scr_act lv_screen_active
#define lv_disp_remove lv_display_delete
#define lv_disp_set_default lv_display_set_default
#define lv_disp_get_default lv_display_get_default
#define lv_disp_get_next lv_display_get_next
#define lv_disp_set_rotation lv_display_set_rotation
#define lv_disp_get_hor_res lv_display_get_horizontal_resolution
#define lv_disp_get_ver_res lv_display_get_vertical_resolution
#define lv_disp_get_physical_hor_res lv_display_get_physical_horizontal_resolution
#define lv_disp_get_physical_ver_res lv_display_get_physical_vertical_resolution
#define lv_disp_get_offset_x lv_display_get_offset_x
#define lv_disp_get_offset_y lv_display_get_offset_y
#define lv_disp_get_rotation lv_display_get_rotation
#define lv_disp_get_dpi lv_display_get_dpi
#define lv_disp_get_antialiasing lv_display_get_antialiasing
#define lv_disp_flush_ready lv_display_flush_ready
#define lv_disp_flush_is_last lv_display_flush_is_last
#define lv_disp_get_scr_act lv_display_get_screen_active
#define lv_disp_get_scr_prev lv_display_get_screen_prev
#define lv_disp_load_scr lv_screen_load
#define lv_scr_load lv_screen_load
#define lv_scr_load_anim lv_screen_load_anim
#define lv_disp_get_layer_top lv_display_get_layer_top
#define lv_disp_get_layer_sys lv_display_get_layer_sys
#define lv_disp_send_event lv_display_send_event
#define lv_disp_set_theme lv_display_set_theme
#define lv_disp_get_theme lv_display_get_theme
#define lv_disp_get_inactive_time lv_display_get_inactive_time
#define lv_disp_trig_activity lv_display_trigger_activity
#define lv_disp_enable_invalidation lv_display_enable_invalidation
#define lv_disp_is_invalidation_enabled lv_display_is_invalidation_enabled
#define lv_disp_refr_timer lv_display_refr_timer
#define lv_disp_get_refr_timer lv_display_get_refr_timer
#define lv_timer_del lv_timer_delete
#define lv_anim_del lv_anim_delete
#define lv_anim_del_all lv_anim_delete_all
#define lv_anim_set_ready_cb lv_anim_set_completed_cb
#define lv_group_del lv_group_delete
#if LV_USE_TEXTAREA
#define lv_txt_get_size lv_text_get_size
#define lv_txt_get_width lv_text_get_width
#endif /* LV_USE_TEXTAREA */
#if LV_USE_IMAGE
#define lv_img_create lv_image_create
#define lv_img_set_src lv_image_set_src
#define lv_img_set_offset_x lv_image_set_offset_x
#define lv_img_set_offset_y lv_image_set_offset_y
#define lv_img_set_angle lv_image_set_rotation
#define lv_img_set_pivot lv_image_set_pivot
#define lv_img_set_zoom lv_image_set_scale
#define lv_img_set_antialias lv_image_set_antialias
#define lv_img_get_src lv_image_get_src
#define lv_img_get_offset_x lv_image_get_offset_x
#define lv_img_get_offset_y lv_image_get_offset_y
#define lv_img_get_angle lv_image_get_rotation
#define lv_img_get_pivot lv_image_get_pivot
#define lv_img_get_zoom lv_image_get_scale
#define lv_img_get_antialias lv_image_get_antialias
#endif /* LV_USE_IMAGE */
#if LV_USE_IMAGEBUTTON
#define lv_imgbtn_create lv_imagebutton_create
#define lv_imgbtn_set_src lv_imagebutton_set_src
#define lv_imgbtn_set_state lv_imagebutton_set_state
#define lv_imgbtn_get_src_left lv_imagebutton_get_src_left
#define lv_imgbtn_get_src_middle lv_imagebutton_get_src_middle
#define lv_imgbtn_get_src_right lv_imagebutton_get_src_right
#endif /* LV_USE_IMAGEBUTTON */
#if LV_USE_LIST
#define lv_list_set_btn_text lv_list_set_button_text
#define lv_list_get_btn_text lv_list_get_button_text
#define lv_list_add_btn lv_list_add_button
#endif /* LV_USE_LIST */
#if LV_USE_BUTTON
#define lv_btn_create lv_button_create
#endif /* LV_USE_BUTTON */
#if LV_USE_BUTTONMATRIX
#define lv_btnmatrix_create lv_buttonmatrix_create
#define lv_btnmatrix_set_map lv_buttonmatrix_set_map
#define lv_btnmatrix_set_ctrl_map lv_buttonmatrix_set_ctrl_map
#define lv_btnmatrix_set_selected_btn lv_buttonmatrix_set_selected_button
#define lv_btnmatrix_set_btn_ctrl lv_buttonmatrix_set_button_ctrl
#define lv_btnmatrix_clear_btn_ctrl lv_buttonmatrix_clear_button_ctrl
#define lv_btnmatrix_set_btn_ctrl_all lv_buttonmatrix_set_button_ctrl_all
#define lv_btnmatrix_clear_btn_ctrl_all lv_buttonmatrix_clear_button_ctrl_all
#define lv_btnmatrix_set_btn_width lv_buttonmatrix_set_button_width
#define lv_btnmatrix_set_one_checked lv_buttonmatrix_set_one_checked
#define lv_btnmatrix_get_map lv_buttonmatrix_get_map
#define lv_btnmatrix_get_selected_btn lv_buttonmatrix_get_selected_button
#define lv_btnmatrix_get_btn_text lv_buttonmatrix_get_button_text
#define lv_btnmatrix_has_button_ctrl lv_buttonmatrix_has_button_ctrl
#define lv_btnmatrix_get_one_checked lv_buttonmatrix_get_one_checked
#endif /* LV_USE_BUTTONMATRIX */
#if LV_USE_TABVIEW
#define lv_tabview_get_tab_btns lv_tabview_get_tab_bar
#define lv_tabview_get_tab_act lv_tabview_get_tab_active
#define lv_tabview_set_act lv_tabview_set_active
#endif /* LV_USE_TABVIEW */
#if LV_USE_TILEVIEW
#define lv_tileview_get_tile_act lv_tileview_get_tile_active
#define lv_obj_set_tile_id lv_tileview_set_tile_by_index
#define lv_obj_set_tile lv_tileview_set_tile
#endif /* LV_USE_TILEVIEW */
#if LV_USE_ROLLER
#define lv_roller_set_visible_row_cnt lv_roller_set_visible_row_count
#define lv_roller_get_option_cnt lv_roller_get_option_count
#endif /* LV_USE_ROLLER */
#if LV_USE_TABLE
#define lv_table_set_col_cnt lv_table_set_column_count
#define lv_table_set_row_cnt lv_table_set_row_count
#define lv_table_get_col_cnt lv_table_get_column_count
#define lv_table_get_row_cnt lv_table_get_row_count
#define lv_table_set_col_width lv_table_set_column_width
#define lv_table_get_col_width lv_table_get_column_width
#endif /* LV_USE_TABLE */
#if LV_USE_DROPDOWN
#define lv_dropdown_get_option_cnt lv_dropdown_get_option_count
#endif /* LV_USE_DROPDOWN */
#define lv_obj_get_child_cnt lv_obj_get_child_count
#define lv_obj_get_disp lv_obj_get_display
#define lv_obj_delete_anim_ready_cb lv_obj_delete_anim_completed_cb
#define LV_STYLE_ANIM_TIME LV_STYLE_ANIM_DURATION
#define LV_STYLE_IMG_OPA LV_STYLE_IMAGE_OPA
#define LV_STYLE_IMG_RECOLOR LV_STYLE_IMAGE_RECOLOR
#define LV_STYLE_IMG_RECOLOR_OPA LV_STYLE_IMAGE_RECOLOR_OPA
#define LV_STYLE_SHADOW_OFS_X LV_STYLE_SHADOW_OFFSET_X
#define LV_STYLE_SHADOW_OFS_Y LV_STYLE_SHADOW_OFFSET_Y
#define LV_STYLE_TRANSFORM_ANGLE LV_STYLE_TRANSFORM_ROTATION
#define lv_obj_get_style_anim_time lv_obj_get_style_anim_duration
#define lv_obj_get_style_img_opa lv_obj_get_style_image_opa
#define lv_obj_get_style_img_recolor lv_obj_get_style_image_recolor
#define lv_obj_get_style_img_recolor_filtered lv_obj_get_style_image_recolor_filtered
#define lv_obj_get_style_img_recolor_opa lv_obj_get_style_image_recolor_opa
#define lv_obj_get_style_shadow_ofs_x lv_obj_get_style_shadow_offset_x
#define lv_obj_get_style_shadow_ofs_y lv_obj_get_style_shadow_offset_y
#define lv_obj_get_style_transform_angle lv_obj_get_style_transform_rotation
#define lv_obj_get_style_bg_img_src lv_obj_get_style_bg_image_src
#define lv_obj_get_style_bg_img_recolor lv_obj_get_style_bg_image_recolor
#define lv_obj_get_style_bg_img_recolor_opa lv_obj_get_style_bg_image_recolor_opa
#define lv_obj_set_style_anim_time lv_obj_set_style_anim_duration
#define lv_obj_set_style_img_opa lv_obj_set_style_image_opa
#define lv_obj_set_style_img_recolor lv_obj_set_style_image_recolor
#define lv_obj_set_style_img_recolor_opa lv_obj_set_style_image_recolor_opa
#define lv_obj_set_style_shadow_ofs_x lv_obj_set_style_shadow_offset_x
#define lv_obj_set_style_shadow_ofs_y lv_obj_set_style_shadow_offset_y
#define lv_obj_set_style_transform_zoom lv_obj_set_style_transform_scale
#define lv_obj_set_style_transform_angle lv_obj_set_style_transform_rotation
#define lv_obj_set_style_bg_img_src lv_obj_set_style_bg_image_src
#define lv_obj_set_style_bg_img_recolor lv_obj_set_style_bg_image_recolor
#define lv_obj_set_style_bg_img_recolor_opa lv_obj_set_style_bg_image_recolor_opa
#define lv_style_set_anim_time lv_style_set_anim_duration
#define lv_style_set_img_opa lv_style_set_image_opa
#define lv_style_set_img_recolor lv_style_set_image_recolor
#define lv_style_set_img_recolor_opa lv_style_set_image_recolor_opa
#define lv_style_set_shadow_ofs_x lv_style_set_shadow_offset_x
#define lv_style_set_shadow_ofs_y lv_style_set_shadow_offset_y
#define lv_style_set_transform_angle lv_style_set_transform_rotation
#define lv_style_set_transform_zoom lv_style_set_transform_scale
#define lv_style_set_bg_img_src lv_style_set_bg_image_src
#define lv_style_set_bg_img_recolor lv_style_set_bg_image_recolor
#define lv_style_set_bg_img_recolor_opa lv_style_set_bg_image_recolor_opa
#if LV_USE_KEYBOARD
#define lv_keyboard_get_selected_btn lv_keyboard_get_selected_button
#define lv_keyboard_get_btn_text lv_keyboard_get_button_text
#endif /* LV_USE_KEYBOARD */
#define LV_ZOOM_NONE LV_SCALE_NONE
#define lv_image_decoder_built_in_open lv_bin_decoder_open
#define lv_image_decoder_built_in_close lv_bin_decoder_close
/**********************
* MACROS
**********************/
/** Use this macro to declare an image in a C file*/
#define LV_IMG_DECLARE(var_name) extern const lv_image_dsc_t var_name;
/**********************
* DEPRECATED FUNCTIONS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_API_MAP_V8_H*/
+67
View File
@@ -0,0 +1,67 @@
/**
* @file lv_api_map_v9_0.h
*
*/
#ifndef LV_API_MAP_V9_0_H
#define LV_API_MAP_V9_0_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#define lv_image_set_align lv_image_set_inner_align
#define lv_image_get_align lv_image_get_inner_align
#ifndef LV_DRAW_LAYER_SIMPLE_BUF_SIZE
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE
#endif
#define lv_button_bind_checked lv_obj_bind_checked
#define LV_DRAW_BUF_DEFINE LV_DRAW_BUF_DEFINE_STATIC
#define _lv_utils_bsearch lv_utils_bsearch
#define lv_draw_buf_align_user lv_draw_buf_align_ex
#define lv_draw_buf_create_user lv_draw_buf_create_ex
#define lv_draw_buf_width_to_stride_user lv_draw_buf_width_to_stride_ex
#define lv_draw_buf_dup_user lv_draw_buf_dup_ex
#define lv_draw_buf_invalidate_cache_user(handlers, drawbuf, area) lv_draw_buf_invalidate_cache(drawbuf, area)
#define lv_draw_buf_flush_cache_user(handlers, drawbuf, area) lv_draw_buf_flush_cache(drawbuf, area)
#define lv_draw_buf_destroy_user(handlers, drawbuf) lv_draw_buf_destroy(drawbuf)
/**********************
* MACROS
**********************/
/**********************
* DEPRECATED FUNCTIONS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_API_MAP_V9_0_H*/
+130
View File
@@ -0,0 +1,130 @@
/**
* @file lv_api_map_v9_1.h
*
*/
#ifndef LV_API_MAP_V9_1_H
#define LV_API_MAP_V9_1_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
/**********************
* MACROS
**********************/
#define _LV_EVENT_LAST LV_EVENT_LAST
#define _lv_event_code_t lv_event_code_t
#define _lv_event_mark_deleted lv_event_mark_deleted
#define lv_obj_add_event lv_obj_add_event_cb
#define _LV_STYLE_LAST_BUILT_IN_PROP LV_STYLE_LAST_BUILT_IN_PROP
#define _LV_FLEX_REVERSE LV_FLEX_REVERSE
#define _LV_FLEX_WRAP LV_FLEX_WRAP
#define _LV_FLEX_COLUMN LV_FLEX_COLUMN
#define _lv_area_is_equal lv_area_is_equal
#define _lv_area_is_in lv_area_is_in
#define _lv_area_intersect lv_area_intersect
#define _lv_area_is_point_on lv_area_is_point_on
#define _lv_area_join lv_area_join
#define _lv_image_buf_get_transformed_area lv_image_buf_get_transformed_area
#define _lv_ll_init lv_ll_init
#define _lv_ll_ins_head lv_ll_ins_head
#define _lv_ll_ins_prev lv_ll_ins_prev
#define _lv_ll_ins_tail lv_ll_ins_tail
#define _lv_ll_get_head lv_ll_get_head
#define _lv_ll_get_tail lv_ll_get_tail
#define _lv_ll_get_next lv_ll_get_next
#define _lv_ll_get_prev lv_ll_get_prev
#define _lv_ll_get_len lv_ll_get_len
#define _lv_ll_move_before lv_ll_move_before
#define _lv_ll_is_empty lv_ll_is_empty
#define _lv_ll_clear lv_ll_clear
#define _lv_ll_remove lv_ll_remove
#define _lv_ll_chg_list lv_ll_chg_list
#define _LV_LL_READ LV_LL_READ
#define _LV_LL_READ_BACK LV_LL_READ_BACK
#define _lv_obj_scroll_by_raw lv_obj_scroll_by_raw
#define _lv_obj_get_ext_draw_size lv_obj_get_ext_draw_size
#define _lv_indev_scroll_handler lv_indev_scroll_handler
#define _lv_display_refr_timer lv_disp_refr_timer
#define _lv_disp_refr_timer lv_disp_refr_timer
#define _lv_disp_get_refr_timer lv_disp_get_refr_timer
#define lv_obj_get_child_by_id lv_obj_find_by_id
#define lv_obj_update_flag lv_obj_set_flag
#define _lv_inv_area lv_inv_area
#define lv_chart_set_all_value lv_chart_set_all_values
#define lv_calendar_set_showed_date lv_calendar_set_month_shown
#define lv_chart_set_range lv_chart_set_axis_range
#define lv_chart_set_value_by_id lv_chart_set_series_value_by_id
#define lv_chart_get_x_array lv_chart_get_series_x_array
#define lv_chart_get_y_array lv_chart_get_series_y_array
#define lv_chart_set_ext_x_array lv_chart_set_series_ext_x_array
#define lv_chart_set_ext_y_array lv_chart_set_series_ext_y_array
#if defined(LV_FS_DEFAULT_DRIVE_LETTER)
#warning LV_FS_DEFAULT_DRIVE_LETTER is deprecated. Rename to LV_FS_DEFAULT_DRIVER_LETTER
#if LV_FS_DEFAULT_DRIVER_LETTER == '\0'
#undef LV_FS_DEFAULT_DRIVER_LETTER
#define LV_FS_DEFAULT_DRIVER_LETTER LV_FS_DEFAULT_DRIVE_LETTER
#endif
#endif /* defined(LV_FS_DEFAULT_DRIVE_LETTER) */
#define LV_LABEL_LONG_WRAP LV_LABEL_LONG_MODE_WRAP
#define LV_LABEL_LONG_DOT LV_LABEL_LONG_MODE_DOTS
#define LV_LABEL_LONG_SCROLL LV_LABEL_LONG_MODE_SCROLL
#define LV_LABEL_LONG_SCROLL_CIRCULAR LV_LABEL_LONG_MODE_SCROLL_CIRCULAR
#define LV_LABEL_LONG_CLIP LV_LABEL_LONG_MODE_CLIP
#define lv_anim_set_time lv_anim_set_duration
#define lv_anim_set_playback_time lv_anim_set_reverse_duration
#define lv_anim_set_playback_delay lv_anim_set_reverse_delay
#define lv_anim_set_playback_duration lv_anim_set_reverse_duration
#define lv_gradient_init_stops lv_grad_init_stops
#define lv_gradient_stop_t lv_grad_stop_t
#define lv_spangroup_new_span lv_spangroup_add_span
#define lv_spangroup_refr_mode lv_spangroup_refresh
#define lv_slider_set_left_value lv_slider_set_start_value
#define lv_calendar_header_arrow_create lv_calendar_add_header_arrow
#define lv_calendar_header_dropdown_create lv_calendar_add_header_dropdown
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_API_MAP_V9_1_H */
+58
View File
@@ -0,0 +1,58 @@
/**
* @file lv_api_map_v9_2.h
*
*/
#ifndef LV_API_MAP_V9_2_H
#define LV_API_MAP_V9_2_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#define LV_SCR_LOAD_ANIM_NONE LV_SCREEN_LOAD_ANIM_NONE
#define LV_SCR_LOAD_ANIM_OVER_LEFT LV_SCREEN_LOAD_ANIM_OVER_LEFT
#define LV_SCR_LOAD_ANIM_OVER_RIGHT LV_SCREEN_LOAD_ANIM_OVER_RIGHT
#define LV_SCR_LOAD_ANIM_OVER_TOP LV_SCREEN_LOAD_ANIM_OVER_TOP
#define LV_SCR_LOAD_ANIM_OVER_BOTTOM LV_SCREEN_LOAD_ANIM_OVER_BOTTOM
#define LV_SCR_LOAD_ANIM_MOVE_LEFT LV_SCREEN_LOAD_ANIM_MOVE_LEFT
#define LV_SCR_LOAD_ANIM_MOVE_RIGHT LV_SCREEN_LOAD_ANIM_MOVE_RIGHT
#define LV_SCR_LOAD_ANIM_MOVE_TOP LV_SCREEN_LOAD_ANIM_MOVE_TOP
#define LV_SCR_LOAD_ANIM_MOVE_BOTTOM LV_SCREEN_LOAD_ANIM_MOVE_BOTTOM
#define LV_SCR_LOAD_ANIM_FADE_IN LV_SCREEN_LOAD_ANIM_FADE_IN
#define LV_SCR_LOAD_ANIM_FADE_ON LV_SCREEN_LOAD_ANIM_FADE_ON
#define LV_SCR_LOAD_ANIM_FADE_OUT LV_SCREEN_LOAD_ANIM_FADE_OUT
#define LV_SCR_LOAD_ANIM_OUT_LEFT LV_SCREEN_LOAD_ANIM_OUT_LEFT
#define LV_SCR_LOAD_ANIM_OUT_RIGHT LV_SCREEN_LOAD_ANIM_OUT_RIGHT
#define LV_SCR_LOAD_ANIM_OUT_TOP LV_SCREEN_LOAD_ANIM_OUT_TOP
#define LV_SCR_LOAD_ANIM_OUT_BOTTOM LV_SCREEN_LOAD_ANIM_OUT_BOTTOM
#define lv_ft81x_spi_operation lv_ft81x_spi_operation_t
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_API_MAP_V9_2_H */
+98
View File
@@ -0,0 +1,98 @@
/**
* @file lv_api_map_v9_3.h
*
*/
#ifndef LV_API_MAP_V9_3_H
#define LV_API_MAP_V9_3_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#define lv_draw_buf_malloc_cb lv_draw_buf_malloc_cb_t
#define lv_draw_buf_free_cb lv_draw_buf_free_cb_t
#define lv_draw_buf_copy_cb lv_draw_buf_copy_cb_t
#define lv_draw_buf_align_cb lv_draw_buf_align_cb_t
#define lv_draw_buf_cache_operation_cb lv_draw_buf_cache_operation_cb_t
#define lv_draw_buf_width_to_stride_cb lv_draw_buf_width_to_stride_cb_t
#define lv_glfw_window_t lv_opengles_window_t
#define lv_glfw_texture_t lv_opengles_window_texture_t
#define lv_glfw_window_create lv_opengles_glfw_window_create
#define lv_glfw_window_create_ex lv_opengles_glfw_window_create_ex
#define lv_glfw_window_set_title lv_opengles_glfw_window_set_title
#define lv_glfw_window_delete lv_opengles_window_delete
#define lv_glfw_window_set_flip lv_opengles_glfw_window_set_flip
#define lv_glfw_window_add_texture lv_opengles_window_add_texture
#define lv_glfw_texture_remove lv_opengles_window_texture_remove
#define lv_glfw_texture_set_x lv_opengles_window_texture_set_x
#define lv_glfw_texture_set_y lv_opengles_window_texture_set_y
#define lv_glfw_texture_set_opa lv_opengles_window_texture_set_opa
#define lv_glfw_texture_get_mouse_indev lv_opengles_window_texture_get_mouse_indev
#define lv_glfw_window_get_glfw_window lv_opengles_glfw_window_get_glfw_window
#define lv_vector_dsc_create lv_draw_vector_dsc_create
#define lv_vector_dsc_delete lv_draw_vector_dsc_delete
#define lv_vector_dsc_set_transform lv_draw_vector_dsc_set_transform
#define lv_vector_dsc_set_blend_mode lv_draw_vector_dsc_set_blend_mode
#define lv_vector_dsc_set_fill_color32 lv_draw_vector_dsc_set_fill_color32
#define lv_vector_dsc_set_fill_color lv_draw_vector_dsc_set_fill_color
#define lv_vector_dsc_set_fill_opa lv_draw_vector_dsc_set_fill_opa
#define lv_vector_dsc_set_fill_rule lv_draw_vector_dsc_set_fill_rule
#define lv_vector_dsc_set_fill_units lv_draw_vector_dsc_set_fill_units
#define lv_vector_dsc_set_fill_image lv_draw_vector_dsc_set_fill_image
#define lv_vector_dsc_set_fill_linear_gradient lv_draw_vector_dsc_set_fill_linear_gradient
#define lv_vector_dsc_set_fill_radial_gradient lv_draw_vector_dsc_set_fill_radial_gradient
#define lv_vector_dsc_set_fill_gradient_spread lv_draw_vector_dsc_set_fill_gradient_spread
#define lv_vector_dsc_set_fill_gradient_color_stops lv_draw_vector_dsc_set_fill_gradient_color_stops
#define lv_vector_dsc_set_fill_transform lv_draw_vector_dsc_set_fill_transform
#define lv_vector_dsc_set_stroke_color32 lv_draw_vector_dsc_set_stroke_color32
#define lv_vector_dsc_set_stroke_color lv_draw_vector_dsc_set_stroke_color
#define lv_vector_dsc_set_stroke_opa lv_draw_vector_dsc_set_stroke_opa
#define lv_vector_dsc_set_stroke_width lv_draw_vector_dsc_set_stroke_width
#define lv_vector_dsc_set_stroke_dash lv_draw_vector_dsc_set_stroke_dash
#define lv_vector_dsc_set_stroke_cap lv_draw_vector_dsc_set_stroke_cap
#define lv_vector_dsc_set_stroke_join lv_draw_vector_dsc_set_stroke_join
#define lv_vector_dsc_set_stroke_miter_limit lv_draw_vector_dsc_set_stroke_miter_limit
#define lv_vector_dsc_set_stroke_linear_gradient lv_draw_vector_dsc_set_stroke_linear_gradient
#define lv_vector_dsc_set_stroke_radial_gradient lv_draw_vector_dsc_set_stroke_radial_gradient
#define lv_vector_dsc_set_stroke_gradient_spread lv_draw_vector_dsc_set_stroke_gradient_spread
#define lv_vector_dsc_set_stroke_gradient_color_stops lv_draw_vector_dsc_set_stroke_gradient_color_stops
#define lv_vector_dsc_set_stroke_transform lv_draw_vector_dsc_set_stroke_transform
#define lv_vector_dsc_identity lv_draw_vector_dsc_identity
#define lv_vector_dsc_scale lv_draw_vector_dsc_scale
#define lv_vector_dsc_rotate lv_draw_vector_dsc_rotate
#define lv_vector_dsc_translate lv_draw_vector_dsc_translate
#define lv_vector_dsc_skew lv_draw_vector_dsc_skew
#define lv_vector_dsc_add_path lv_draw_vector_dsc_add_path
#define lv_vector_dsc_clear_area lv_draw_vector_dsc_clear_area
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_API_MAP_V9_3_H */
+41
View File
@@ -0,0 +1,41 @@
/**
* @file lv_api_map_v9_4.h
*
*/
#ifndef LV_API_MAP_V9_4_H
#define LV_API_MAP_V9_4_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#define lv_tabview_rename_tab lv_tabview_set_tab_text
#define lv_wayland_timer_handler lv_timer_handler
#define lv_wayland_display_close_f_t lv_wayland_display_close_cb_t
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_API_MAP_V9_4_H */
@@ -1,10 +1,10 @@
/**
* @file lv_draw_rect_private.h
* @file lv_api_map_v9_5.h
*
*/
#ifndef LV_DRAW_RECT_PRIVATE_H
#define LV_DRAW_RECT_PRIVATE_H
#ifndef LV_API_MAP_V9_5_H
#define LV_API_MAP_V9_5_H
#ifdef __cplusplus
extern "C" {
@@ -14,8 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_draw_rect.h"
/*********************
* DEFINES
*********************/
@@ -32,8 +30,10 @@ extern "C" {
* MACROS
**********************/
#define lv_display_delete_event lv_display_remove_event
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_RECT_PRIVATE_H*/
#endif /* LV_API_MAP_V9_5_H */
File diff suppressed because it is too large Load Diff
+325
View File
@@ -0,0 +1,325 @@
/** * @file lv_conf_kconfig.h * Configs that need special handling when LVGL is used with Kconfig */
#ifndef LV_CONF_KCONFIG_H
#define LV_CONF_KCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LV_CONF_KCONFIG_EXTERNAL_INCLUDE
# include LV_CONF_KCONFIG_EXTERNAL_INCLUDE
#else
# ifdef ESP_PLATFORM
# include "sdkconfig.h"
# include "esp_attr.h"
# endif
# ifdef __NuttX__
# include <nuttx/config.h>
/*
* Make sure version number in Kconfig file is correctly set.
* Mismatch can happen when user manually copy lvgl/Kconfig file to their project, like what NuttX does.
*/
# include "../lv_version.h"
# if CONFIG_LVGL_VERSION_MAJOR != LVGL_VERSION_MAJOR || CONFIG_LVGL_VERSION_MINOR != LVGL_VERSION_MINOR \
|| CONFIG_LVGL_VERSION_PATCH != LVGL_VERSION_PATCH
# warning "Version mismatch between Kconfig and lvgl/lv_version.h"
# endif
# elif defined(__RTTHREAD__)
# define LV_CONF_INCLUDE_SIMPLE
# include <lv_rt_thread_conf.h>
# endif
#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/
/*******************
* LV_USE_STDLIB_MALLOC
*******************/
#ifdef CONFIG_LV_USE_BUILTIN_MALLOC
# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN
#elif defined(CONFIG_LV_USE_CLIB_MALLOC)
# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
#elif defined(CONFIG_LV_USE_MICROPYTHON_MALLOC)
# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_MICROPYTHON
#elif defined(CONFIG_LV_USE_RTTHREAD_MALLOC)
# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_RTTHREAD
#elif defined (CONFIG_LV_USE_CUSTOM_MALLOC)
# define CONFIG_LV_USE_STDLIB_MALLOC LV_STDLIB_CUSTOM
#endif
/*******************
* LV_USE_STDLIB_STRING
*******************/
#ifdef CONFIG_LV_USE_BUILTIN_STRING
# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#elif defined(CONFIG_LV_USE_CLIB_STRING)
# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CLIB
#elif defined(CONFIG_LV_USE_MICROPYTHON_STRING)
# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_MICROPYTHON
#elif defined(CONFIG_LV_USE_RTTHREAD_STRING)
# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_RTTHREAD
#elif defined (CONFIG_LV_USE_CUSTOM_STRING)
# define CONFIG_LV_USE_STDLIB_STRING LV_STDLIB_CUSTOM
#endif
/*******************
* LV_USE_STDLIB_SPRINTF
*******************/
#ifdef CONFIG_LV_USE_BUILTIN_SPRINTF
# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#elif defined(CONFIG_LV_USE_CLIB_SPRINTF)
# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
#elif defined(CONFIG_LV_USE_MICROPYTHON_SPRINTF)
# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_MICROPYTHON
#elif defined(CONFIG_LV_USE_RTTHREAD_SPRINTF)
# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD
#elif defined (CONFIG_LV_USE_CUSTOM_SPRINTF)
# define CONFIG_LV_USE_STDLIB_SPRINTF LV_STDLIB_CUSTOM
#endif
/*******************
* LV_USE_OS
*******************/
#ifdef CONFIG_LV_OS_NONE
# define CONFIG_LV_USE_OS LV_OS_NONE
#elif defined(CONFIG_LV_OS_PTHREAD)
# define CONFIG_LV_USE_OS LV_OS_PTHREAD
#elif defined(CONFIG_LV_OS_FREERTOS)
# define CONFIG_LV_USE_OS LV_OS_FREERTOS
#elif defined(CONFIG_LV_OS_CMSIS_RTOS2)
# define CONFIG_LV_USE_OS LV_OS_CMSIS_RTOS2
#elif defined (CONFIG_LV_OS_RTTHREAD)
# define CONFIG_LV_USE_OS LV_OS_RTTHREAD
#elif defined (CONFIG_LV_OS_WINDOWS)
# define CONFIG_LV_USE_OS LV_OS_WINDOWS
#elif defined (CONFIG_LV_OS_MQX)
# define CONFIG_LV_USE_OS LV_OS_MQX
#elif defined (CONFIG_LV_OS_SDL2)
# define CONFIG_LV_USE_OS LV_OS_SDL2
#elif defined (CONFIG_LV_OS_CUSTOM)
# define CONFIG_LV_USE_OS LV_OS_CUSTOM
#endif
/*******************
* LV_NANOVG_BACKEND
*******************/
#ifdef CONFIG_LV_NANOVG_BACKEND_GL2
# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL2
#elif defined(CONFIG_LV_NANOVG_BACKEND_GL3)
# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GL3
#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES2)
# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2
#elif defined(CONFIG_LV_NANOVG_BACKEND_GLES3)
# define CONFIG_LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES3
#endif
/*******************
* LV_MEM_SIZE
*******************/
#ifdef CONFIG_LV_MEM_SIZE_KILOBYTES
# if(CONFIG_LV_MEM_SIZE_KILOBYTES < 2)
# error "LV_MEM_SIZE >= 2kB is required"
# endif
# define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_KILOBYTES * 1024U)
#endif
#ifdef CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES
# define CONFIG_LV_MEM_POOL_EXPAND_SIZE (CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES * 1024U)
#endif
/*------------------
* MONITOR POSITION
*-----------------*/
#ifdef CONFIG_LV_PERF_MONITOR_ALIGN_TOP_LEFT
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_LEFT
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_MID)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_MID
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_TOP_RIGHT)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_RIGHT
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_MID)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_MID
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_LEFT_MID)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_LEFT_MID
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_RIGHT_MID)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_RIGHT_MID
#elif defined(CONFIG_LV_PERF_MONITOR_ALIGN_CENTER)
# define CONFIG_LV_USE_PERF_MONITOR_POS LV_ALIGN_CENTER
#endif
#ifdef CONFIG_LV_MEM_MONITOR_ALIGN_TOP_LEFT
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_LEFT
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_MID)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_MID
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_TOP_RIGHT)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_TOP_RIGHT
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_MID)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_MID
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_LEFT_MID)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_LEFT_MID
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_RIGHT_MID)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_RIGHT_MID
#elif defined(CONFIG_LV_MEM_MONITOR_ALIGN_CENTER)
# define CONFIG_LV_USE_MEM_MONITOR_POS LV_ALIGN_CENTER
#endif
/********************
* FONT SELECTION
*******************/
/**
* NOTE: In Kconfig instead of `LV_DEFAULT_FONT`
* `CONFIG_LV_FONT_DEFAULT_<font_name>` is defined
* hence the large selection with if-s
*/
/*------------------
* DEFAULT FONT
*-----------------*/
#ifdef CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_8
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_10
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_14
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_16
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_18
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_20
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_22
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_24
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_26
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_30
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_32
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_34
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_36
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_38
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_40
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_42
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_44
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_46
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_48
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12_SUBPX)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_12_subpx
#elif defined(CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED)
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28_compressed
#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW)
# define CONFIG_LV_FONT_DEFAULT &lv_font_dejavu_16_persian_hebrew
#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK)
# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_14_cjk
#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK)
# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_16_cjk
#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_8)
# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_8
#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_16)
# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_16
#endif
/*------------------
* TEXT ENCODING
*-----------------*/
#ifdef CONFIG_LV_TXT_ENC_UTF8
# define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8
#elif defined(CONFIG_LV_TXT_ENC_ASCII)
# define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII
#endif
/*------------------
* BIDI DIRECTION
*-----------------*/
#ifdef CONFIG_LV_BASE_DIR_LTR
# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_LTR
#elif defined(CONFIG_LV_BASE_DIR_RTL)
# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_RTL
#elif defined(CONFIG_LV_BASE_DIR_AUTO)
# define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
#endif
/*------------------
* SDL
*-----------------*/
#ifdef CONFIG_LV_SDL_RENDER_MODE_PARTIAL
# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#elif defined(CONFIG_LV_SDL_RENDER_MODE_DIRECT)
# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT
#elif defined(CONFIG_LV_SDL_RENDER_MODE_FULL)
# define CONFIG_LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL
#endif
/*------------------
* WAYLAND
*-----------------*/
#ifdef CONFIG_LV_WAYLAND_RENDER_MODE_PARTIAL
# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_DIRECT)
# define CONFIG_LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT
#elif defined(CONFIG_LV_WAYLAND_RENDER_MODE_FULL)
# define CONFIG_LV_WAYLAND_RENDER_MODE_FULL LV_DISPLAY_RENDER_MODE_FULL
#endif
/*------------------
* LINUX FBDEV
*-----------------*/
#ifdef CONFIG_LV_LINUX_FBDEV_RENDER_MODE_PARTIAL
# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_DIRECT)
# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT
#elif defined(CONFIG_LV_LINUX_FBDEV_RENDER_MODE_FULL)
# define CONFIG_LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_FULL
#endif
#ifdef CONFIG_LV_USE_CALENDAR
# ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY
# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR, CONFIG_LV_SUNDAY_STR }
# else
# define CONFIG_LV_CALENDAR_DEFAULT_DAY_NAMES { CONFIG_LV_SUNDAY_STR, CONFIG_LV_MONDAY_STR , CONFIG_LV_TUESDAY_STR, CONFIG_LV_WEDNESDAY_STR, CONFIG_LV_THURSDAY_STR, CONFIG_LV_FRIDAY_STR, CONFIG_LV_SATURDAY_STR }
# endif
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CONF_KCONFIG_H*/
File diff suppressed because it is too large Load Diff
+180
View File
@@ -0,0 +1,180 @@
/**
* @file lv_anim_timeline.h
*
*/
#ifndef LV_ANIM_TIMELINE_H
#define LV_ANIM_TIMELINE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_anim.h"
/*********************
* DEFINES
*********************/
#define LV_ANIM_TIMELINE_PROGRESS_MAX 0xFFFF
/**********************
* TYPEDEFS
**********************/
/*Data of anim_timeline_dsc*/
typedef struct _lv_anim_timeline_dsc_t {
lv_anim_t anim;
uint32_t start_time;
uint8_t is_started : 1;
uint8_t is_completed : 1;
} lv_anim_timeline_dsc_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an animation timeline.
* @return pointer to the animation timeline.
*/
lv_anim_timeline_t * lv_anim_timeline_create(void);
/**
* Delete animation timeline.
* @param at pointer to the animation timeline.
*/
void lv_anim_timeline_delete(lv_anim_timeline_t * at);
/**
* Add animation to the animation timeline.
* @param at pointer to the animation timeline.
* @param start_time the time the animation started on the timeline, note that start_time will override the value of delay.
* @param a pointer to an animation.
*/
void lv_anim_timeline_add(lv_anim_timeline_t * at, uint32_t start_time, const lv_anim_t * a);
/**
* Start the animation timeline.
* @param at pointer to the animation timeline.
* @return total time spent in animation timeline.
*/
uint32_t lv_anim_timeline_start(lv_anim_timeline_t * at);
/**
* Pause the animation timeline.
* @param at pointer to the animation timeline.
*/
void lv_anim_timeline_pause(lv_anim_timeline_t * at);
/**
* Set the playback direction of the animation timeline.
* @param at pointer to the animation timeline.
* @param reverse whether to play in reverse.
*/
void lv_anim_timeline_set_reverse(lv_anim_timeline_t * at, bool reverse);
/**
* Set the time to wait before starting the animation.
* Applies only when playing from the very start, or reverse from the very end.
* @param at pointer to an animation timeline
* @param delay the delay time in milliseconds
*/
void lv_anim_timeline_set_delay(lv_anim_timeline_t * at, uint32_t delay);
/**
* Make the animation timeline repeat itself.
* @param at pointer to the animation timeline.
* @param cnt repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: to disable repetition.
*/
void lv_anim_timeline_set_repeat_count(lv_anim_timeline_t * at, uint32_t cnt);
/**
* Set a delay before repeating the animation timeline.
* @param at pointer to the animation timeline.
* @param delay delay in milliseconds before repeating the animation timeline.
*/
void lv_anim_timeline_set_repeat_delay(lv_anim_timeline_t * at, uint32_t delay);
/**
* Set the progress of the animation timeline.
* @param at pointer to the animation timeline.
* @param progress set value 0~65535 to map 0~100% animation progress.
*/
void lv_anim_timeline_set_progress(lv_anim_timeline_t * at, uint16_t progress);
/**
* Set the user_data of a an animation timeline
* @param at pointer to the animation timeline.
* @param user_data pointer to any data. Only the pointer will be saved.
*/
void lv_anim_timeline_set_user_data(lv_anim_timeline_t * at, void * user_data);
/**
* Get the time used to play the animation timeline.
* @param at pointer to the animation timeline.
* @return total time spent in animation timeline.
*/
uint32_t lv_anim_timeline_get_playtime(lv_anim_timeline_t * at);
/**
* Get whether the animation timeline is played in reverse.
* @param at pointer to the animation timeline.
* @return return true if it is reverse playback.
*/
bool lv_anim_timeline_get_reverse(lv_anim_timeline_t * at);
/**
* Get the wait time when playing from the very start, or reverse from the very end.
* @param at pointer to an animation timeline
* @return the remaining time in milliseconds
*/
uint32_t lv_anim_timeline_get_delay(lv_anim_timeline_t * at);
/**
* Get the progress of the animation timeline.
* @param at pointer to the animation timeline.
* @return return value 0~65535 to map 0~100% animation progress.
*/
uint16_t lv_anim_timeline_get_progress(lv_anim_timeline_t * at);
/**
* Get repeat count of the animation timeline.
* @param at pointer to the animation timeline.
*/
uint32_t lv_anim_timeline_get_repeat_count(lv_anim_timeline_t * at);
/**
* Get repeat delay of the animation timeline.
* @param at pointer to the animation timeline.
*/
uint32_t lv_anim_timeline_get_repeat_delay(lv_anim_timeline_t * at);
/**
* Get the user_data of a an animation timeline
* @param at pointer to the animation timeline.
*/
void * lv_anim_timeline_get_user_data(lv_anim_timeline_t * at);
/**
* Merge (add) all animations of a timeline to another
* @param dest merge animation into this timeline
* @param src merge the animations of this timeline
* @param delay add the animations with this extra delay
*/
void lv_anim_timeline_merge(lv_anim_timeline_t * dest, const lv_anim_timeline_t * src, int32_t delay);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ANIM_TIMELINE_H*/
+254
View File
@@ -0,0 +1,254 @@
/**
* @file lv_area.h
*
*/
#ifndef LV_AREA_H
#define LV_AREA_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../lv_types.h"
#include "../misc/lv_math.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Represents a point on the screen.
*/
typedef struct {
int32_t x;
int32_t y;
} lv_point_t;
typedef struct {
lv_value_precise_t x;
lv_value_precise_t y;
} lv_point_precise_t;
/** Represents an area of the screen.*/
typedef struct {
int32_t x1;
int32_t y1;
int32_t x2;
int32_t y2;
} lv_area_t;
/** Alignments*/
typedef enum {
LV_ALIGN_DEFAULT = 0,
LV_ALIGN_TOP_LEFT,
LV_ALIGN_TOP_MID,
LV_ALIGN_TOP_RIGHT,
LV_ALIGN_BOTTOM_LEFT,
LV_ALIGN_BOTTOM_MID,
LV_ALIGN_BOTTOM_RIGHT,
LV_ALIGN_LEFT_MID,
LV_ALIGN_RIGHT_MID,
LV_ALIGN_CENTER,
LV_ALIGN_OUT_TOP_LEFT,
LV_ALIGN_OUT_TOP_MID,
LV_ALIGN_OUT_TOP_RIGHT,
LV_ALIGN_OUT_BOTTOM_LEFT,
LV_ALIGN_OUT_BOTTOM_MID,
LV_ALIGN_OUT_BOTTOM_RIGHT,
LV_ALIGN_OUT_LEFT_TOP,
LV_ALIGN_OUT_LEFT_MID,
LV_ALIGN_OUT_LEFT_BOTTOM,
LV_ALIGN_OUT_RIGHT_TOP,
LV_ALIGN_OUT_RIGHT_MID,
LV_ALIGN_OUT_RIGHT_BOTTOM,
} lv_align_t;
typedef enum {
LV_DIR_NONE = 0x00,
LV_DIR_LEFT = (1 << 0),
LV_DIR_RIGHT = (1 << 1),
LV_DIR_TOP = (1 << 2),
LV_DIR_BOTTOM = (1 << 3),
LV_DIR_HOR = LV_DIR_LEFT | LV_DIR_RIGHT,
LV_DIR_VER = LV_DIR_TOP | LV_DIR_BOTTOM,
LV_DIR_ALL = LV_DIR_HOR | LV_DIR_VER,
} lv_dir_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize an area
* @param area_p pointer to an area
* @param x1 left coordinate of the area
* @param y1 top coordinate of the area
* @param x2 right coordinate of the area
* @param y2 bottom coordinate of the area
*/
void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
/**
* Copy an area
* @param dest pointer to the destination area
* @param src pointer to the source area
*/
inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src)
{
dest->x1 = src->x1;
dest->y1 = src->y1;
dest->x2 = src->x2;
dest->y2 = src->y2;
}
/**
* Get the width of an area
* @param area_p pointer to an area
* @return the width of the area (if x1 == x2 -> width = 1)
*/
int32_t lv_area_get_width(const lv_area_t * area_p);
/**
* Get the height of an area
* @param area_p pointer to an area
* @return the height of the area (if y1 == y2 -> height = 1)
*/
int32_t lv_area_get_height(const lv_area_t * area_p);
/**
* Set the width of an area
* @param area_p pointer to an area
* @param w the new width of the area (w == 1 makes x1 == x2)
*/
void lv_area_set_width(lv_area_t * area_p, int32_t w);
/**
* Set the height of an area
* @param area_p pointer to an area
* @param h the new height of the area (h == 1 makes y1 == y2)
*/
void lv_area_set_height(lv_area_t * area_p, int32_t h);
/**
* Return with area of an area (x * y)
* @param area_p pointer to an area
* @return size of area
*/
uint32_t lv_area_get_size(const lv_area_t * area_p);
void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra);
void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs);
/**
* Align an area to another
* @param base an area where the other will be aligned
* @param to_align the area to align
* @param align `LV_ALIGN_...`
* @param ofs_x X offset
* @param ofs_y Y offset
*/
void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y);
/**
* Transform a point
* @param point pointer to a point
* @param angle angle with 0.1 resolutions (123 means 12.3°)
* @param scale_x horizontal zoom, 256 means 100%
* @param scale_y vertical zoom, 256 means 100%
* @param pivot pointer to the pivot point of the transformation
* @param zoom_first true: zoom first and rotate after that; else: opposite order
*/
void lv_point_transform(lv_point_t * point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot,
bool zoom_first);
/**
* Transform an array of points
* @param points pointer to an array of points
* @param count number of points in the array
* @param angle angle with 0.1 resolutions (123 means 12.3°)
* @param scale_x horizontal zoom, 256 means 100%
* @param scale_y vertical zoom, 256 means 100%
* @param pivot pointer to the pivot point of the transformation
* @param zoom_first true: zoom first and rotate after that; else: opposite order
*/
void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, int32_t scale_x, int32_t scale_y,
const lv_point_t * pivot,
bool zoom_first);
lv_point_t lv_point_from_precise(const lv_point_precise_t * p);
lv_point_precise_t lv_point_to_precise(const lv_point_t * p);
void lv_point_set(lv_point_t * p, int32_t x, int32_t y);
void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y);
void lv_point_swap(lv_point_t * p1, lv_point_t * p2);
void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2);
/**********************
* MACROS
**********************/
#define LV_COORD_TYPE_SHIFT (29U)
#define LV_COORD_TYPE_MASK (3 << LV_COORD_TYPE_SHIFT)
#define LV_COORD_TYPE(x) ((x) & LV_COORD_TYPE_MASK) /*Extract type specifiers*/
#define LV_COORD_PLAIN(x) ((x) & ~LV_COORD_TYPE_MASK) /*Remove type specifiers*/
#define LV_COORD_TYPE_PX (0 << LV_COORD_TYPE_SHIFT)
#define LV_COORD_TYPE_SPEC (1 << LV_COORD_TYPE_SHIFT)
#define LV_COORD_TYPE_PX_NEG (3 << LV_COORD_TYPE_SHIFT)
#define LV_COORD_IS_PX(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_PX || LV_COORD_TYPE(x) == LV_COORD_TYPE_PX_NEG)
#define LV_COORD_IS_SPEC(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_SPEC)
#define LV_COORD_SET_SPEC(x) ((x) | LV_COORD_TYPE_SPEC)
/** Max coordinate value */
#define LV_COORD_MAX ((1 << LV_COORD_TYPE_SHIFT) - 1)
#define LV_COORD_MIN (-LV_COORD_MAX)
/*Special coordinates*/
#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(LV_COORD_MAX)
#define LV_PCT_STORED_MAX (LV_COORD_MAX - 1)
#if LV_PCT_STORED_MAX % 2 != 0
#error LV_PCT_STORED_MAX should be an even number
#endif
#define LV_PCT_POS_MAX (LV_PCT_STORED_MAX / 2)
#define LV_PCT(x) (LV_COORD_SET_SPEC(((x) < 0 ? (LV_PCT_POS_MAX - LV_MAX((x), -LV_PCT_POS_MAX)) : LV_MIN((x), LV_PCT_POS_MAX))))
#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && LV_COORD_PLAIN(x) <= LV_PCT_STORED_MAX))
#define LV_COORD_GET_PCT(x) (LV_COORD_PLAIN(x) > LV_PCT_POS_MAX ? LV_PCT_POS_MAX - LV_COORD_PLAIN(x) : LV_COORD_PLAIN(x))
LV_EXPORT_CONST_INT(LV_COORD_MAX);
LV_EXPORT_CONST_INT(LV_COORD_MIN);
LV_EXPORT_CONST_INT(LV_SIZE_CONTENT);
/**
* Convert a percentage value to `int32_t`.
* Percentage values are stored in special range
* @param x the percentage (0..1000)
* @return a coordinate that stores the percentage
*/
int32_t lv_pct(int32_t x);
int32_t lv_pct_to_px(int32_t v, int32_t base);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
+274
View File
@@ -0,0 +1,274 @@
/**
* @file lv_event.h
*
*/
#ifndef LV_EVENT_H
#define LV_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "../config/lv_conf_internal.h"
#include "../misc/lv_array.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef void (*lv_event_cb_t)(lv_event_t * e);
/**
* Type of event being sent to Widget
*/
typedef enum {
LV_EVENT_ALL = 0,
/** Input device events*/
LV_EVENT_PRESSED, /**< Widget has been pressed */
LV_EVENT_PRESSING, /**< Widget is being pressed (sent continuously while pressing)*/
LV_EVENT_PRESS_LOST, /**< Widget is still being pressed but slid cursor/finger off Widget */
LV_EVENT_SHORT_CLICKED, /**< Widget was pressed for a short period of time, then released. Not sent if scrolled. */
LV_EVENT_SINGLE_CLICKED, /**< Sent for first short click within a small distance and short time */
LV_EVENT_DOUBLE_CLICKED, /**< Sent for second short click within small distance and short time */
LV_EVENT_TRIPLE_CLICKED, /**< Sent for third short click within small distance and short time */
LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not sent if scrolled. */
LV_EVENT_LONG_PRESSED_REPEAT, /**< Sent after `long_press_time` in every `long_press_repeat_time` ms. Not sent if scrolled. */
LV_EVENT_CLICKED, /**< Sent on release if not scrolled (regardless to long press)*/
LV_EVENT_RELEASED, /**< Sent in every cases when Widget has been released */
LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified */
LV_EVENT_SCROLL_THROW_BEGIN,
LV_EVENT_SCROLL_END, /**< Scrolling ends */
LV_EVENT_SCROLL, /**< Scrolling */
LV_EVENT_GESTURE, /**< A gesture is detected. Get gesture with `lv_indev_get_gesture_dir(lv_indev_active());` */
LV_EVENT_KEY, /**< A key is sent to Widget. Get key with `lv_indev_get_key(lv_indev_active());`*/
LV_EVENT_ROTARY, /**< An encoder or wheel was rotated. Get rotation count with `lv_event_get_rotary_diff(e);`*/
LV_EVENT_FOCUSED, /**< Widget received focus */
LV_EVENT_DEFOCUSED, /**< Widget's focus has been lost */
LV_EVENT_LEAVE, /**< Widget's focus has been lost but is still selected */
LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing */
LV_EVENT_INDEV_RESET, /**< Indev has been reset */
LV_EVENT_HOVER_OVER, /**< Indev hover over object */
LV_EVENT_HOVER_LEAVE, /**< Indev hover leave object */
/** Drawing events */
LV_EVENT_COVER_CHECK, /**< Check if Widget fully covers an area. The event parameter is `lv_cover_check_info_t *`. */
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get required extra draw area around Widget (e.g. for shadow). The event parameter is `int32_t *` to store the size. */
LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase */
LV_EVENT_DRAW_MAIN, /**< Perform the main drawing */
LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase */
LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/
LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/
LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/
LV_EVENT_DRAW_TASK_ADDED, /**< Adding a draw task. The `LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS` flag needs to be set */
/** Special events */
LV_EVENT_VALUE_CHANGED, /**< Widget's value has changed (i.e. slider moved)*/
LV_EVENT_INSERT, /**< Text has been inserted into Widget. The event data is `char *` being inserted. */
LV_EVENT_REFRESH, /**< Notify Widget to refresh something on it (for user)*/
LV_EVENT_READY, /**< A process has finished */
LV_EVENT_CANCEL, /**< A process has been cancelled */
LV_EVENT_STATE_CHANGED, /**< The state of the widget changed*/
/** Other events */
LV_EVENT_CREATE, /**< Object is being created */
LV_EVENT_DELETE, /**< Object is being deleted */
LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */
LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents */
LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents */
LV_EVENT_SCREEN_UNLOAD_START, /**< A screen unload started, fired immediately when scr_load is called */
LV_EVENT_SCREEN_LOAD_START, /**< A screen load started, fired when the screen change delay is expired */
LV_EVENT_SCREEN_LOADED, /**< A screen was loaded */
LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded */
LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed */
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed */
LV_EVENT_LAYOUT_CHANGED, /**< A child's position position has changed due to a layout recalculation */
LV_EVENT_GET_SELF_SIZE, /**< Get internal size of a widget */
/** Events of optional LVGL components */
LV_EVENT_INVALIDATE_AREA, /**< An area is invalidated (marked for redraw). `lv_event_get_param(e)`
* returns a pointer to an `lv_area_t` object with the coordinates of the
* area to be invalidated. The area can be freely modified if needed to
* adapt it a special requirement of the display. Usually needed with
* monochrome displays to invalidate `N x 8` rows or columns in one pass. */
LV_EVENT_RESOLUTION_CHANGED, /**< Sent when the resolution changes due to `lv_display_set_resolution()` or `lv_display_set_rotation()`. */
LV_EVENT_COLOR_FORMAT_CHANGED,/**< Sent as a result of any call to `lv_display_set_color_format()`. */
LV_EVENT_REFR_REQUEST, /**< Sent when something happened that requires redraw. */
LV_EVENT_REFR_START, /**< Sent before a refreshing cycle starts. Sent even if there is nothing to redraw. */
LV_EVENT_REFR_READY, /**< Sent when refreshing has been completed (after rendering and calling flush callback). Sent even if no redraw happened. */
LV_EVENT_RENDER_START, /**< Sent just before rendering begins. */
LV_EVENT_RENDER_READY, /**< Sent after rendering has been completed. */
LV_EVENT_FLUSH_START, /**< Sent before flush callback is called. */
LV_EVENT_FLUSH_FINISH, /**< Sent after flush callback call has returned. */
LV_EVENT_FLUSH_WAIT_START, /**< Sent before flush wait callback is called. */
LV_EVENT_FLUSH_WAIT_FINISH, /**< Sent after flush wait callback call has returned. */
LV_EVENT_SYNC_START, /**< Sent before sync callback is called. */
LV_EVENT_SYNC_FINISH, /**< Sent after sync callback call has returned. */
LV_EVENT_SYNC_WAIT_START, /**< Sent before sync wait callback is called. */
LV_EVENT_SYNC_WAIT_FINISH, /**< Sent after sync wait callback call has returned. */
LV_EVENT_UPDATE_LAYOUT_COMPLETED, /**< Sent after layout update completes*/
LV_EVENT_VSYNC,
LV_EVENT_VSYNC_REQUEST,
#if LV_USE_TRANSLATION
LV_EVENT_TRANSLATION_LANGUAGE_CHANGED, /**< Sent when the translation language changed. */
#endif /*LV_USE_TRANSLATION*/
LV_EVENT_LAST, /** Number of default events */
LV_EVENT_PREPROCESS = 0x8000, /** This is a flag that can be set with an event so it's processed
before the class default event processing */
LV_EVENT_MARKED_DELETING = 0x10000,
} lv_event_code_t;
typedef struct {
lv_array_t array;
uint8_t is_traversing: 1; /**< True: the list is being nested traversed */
uint8_t has_marked_deleting: 1; /**< True: the list has marked deleting objects
when some of events are marked as deleting */
} lv_event_list_t;
/**
* @brief Event callback.
* Events are used to notify the user of some action being taken on Widget.
* For details, see ::lv_event_t.
*/
lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preprocess);
lv_event_dsc_t * lv_event_add(lv_event_list_t * list, lv_event_cb_t cb, lv_event_code_t filter, void * user_data);
bool lv_event_remove_dsc(lv_event_list_t * list, lv_event_dsc_t * dsc);
uint32_t lv_event_get_count(lv_event_list_t * list);
lv_event_dsc_t * lv_event_get_dsc(lv_event_list_t * list, uint32_t index);
lv_event_cb_t lv_event_dsc_get_cb(lv_event_dsc_t * dsc);
void * lv_event_dsc_get_user_data(lv_event_dsc_t * dsc);
bool lv_event_remove(lv_event_list_t * list, uint32_t index);
void lv_event_remove_all(lv_event_list_t * list);
/**
* Get Widget originally targeted by the event. It's the same even if event was bubbled.
* @param e pointer to the event descriptor
* @return the target of the event_code
*/
void * lv_event_get_target(lv_event_t * e);
/**
* Get current target of the event. It's the Widget for which the event handler being called.
* If the event is not bubbled it's the same as "normal" target.
* @param e pointer to the event descriptor
* @return pointer to the current target of the event_code
*/
void * lv_event_get_current_target(lv_event_t * e);
/**
* Get event code of an event.
* @param e pointer to the event descriptor
* @return the event code. (E.g. `LV_EVENT_CLICKED`, `LV_EVENT_FOCUSED`, etc)
*/
lv_event_code_t lv_event_get_code(lv_event_t * e);
/**
* Get parameter passed when event was sent.
* @param e pointer to the event descriptor
* @return pointer to the parameter
*/
void * lv_event_get_param(lv_event_t * e);
/**
* Get user_data passed when event was registered on Widget.
* @param e pointer to the event descriptor
* @return pointer to the user_data
*/
void * lv_event_get_user_data(lv_event_t * e);
/**
* Stop event from bubbling.
* This is only valid when called in the middle of an event processing chain.
* @param e pointer to the event descriptor
*/
void lv_event_stop_bubbling(lv_event_t * e);
/**
* Stop event from trickling down to children.
* This is only valid when called in the middle of an event processing chain.
* @param e pointer to the event descriptor
*/
void lv_event_stop_trickling(lv_event_t * e);
/**
* Stop processing this event.
* This is only valid when called in the middle of an event processing chain.
* @param e pointer to the event descriptor
*/
void lv_event_stop_processing(lv_event_t * e);
/**
* Helper function typically used in LV_EVENT_DELETE
* to free the event's user_data
* @param e pointer to an event descriptor
*/
void lv_event_free_user_data_cb(lv_event_t * e);
/**
* Register a new, custom event ID.
* It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events
* @return the new event id
*
* Example:
* @code
* uint32_t LV_EVENT_MINE = 0;
* ...
* e = lv_event_register_id();
* ...
* lv_obj_send_event(obj, LV_EVENT_MINE, &some_data);
* @endcode
*/
uint32_t lv_event_register_id(void);
/**
* Get the name of an event code.
* @param code the event code
* @return the name of the event code as a string
*/
const char * lv_event_code_get_name(lv_event_code_t code);
#if LV_USE_EXT_DATA
/**
* Set external data and its destructor for an event descriptor.
* This allows associating custom data with an event callback that will be automatically cleaned up
* when the event descriptor is removed or destroyed.
* @param dsc pointer to an event descriptor (from lv_obj_add_event_cb)
* @param data pointer to the external data to associate with the event descriptor
* @param free_cb function pointer to a destructor that will be called to clean up the external data.
* The destructor will receive the data pointer as its parameter.
*/
void lv_event_desc_set_external_data(lv_event_dsc_t * dsc, void * data, void (* free_cb)(void * data));
#endif
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_EVENT_H */
@@ -1,10 +1,10 @@
/**
* @file lv_draw_triangle_private.h
* @file lv_ext_data.h
*
*/
#ifndef LV_DRAW_TRIANGLE_PRIVATE_H
#define LV_DRAW_TRIANGLE_PRIVATE_H
#ifndef LV_EXT_DATA_H
#define LV_EXT_DATA_H
#ifdef __cplusplus
extern "C" {
@@ -13,8 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_draw_triangle.h"
#include "../config/lv_conf_internal.h"
#if LV_USE_EXT_DATA
/*********************
* DEFINES
@@ -23,10 +23,10 @@ extern "C" {
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
void * data;
void (* free_cb)(void * data);
} lv_ext_data_t;
/**********************
* GLOBAL PROTOTYPES
@@ -36,8 +36,10 @@ extern "C" {
* MACROS
**********************/
#endif /*LV_USE_EXT_DATA*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_TRIANGLE_PRIVATE_H*/
#endif /* LV_EXT_DATA_H */
+276
View File
@@ -0,0 +1,276 @@
/**
* @file lv_group.h
*
*/
#ifndef LV_GROUP_H
#define LV_GROUP_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/** Predefined keys to control which Widget has focus via lv_group_send(group, c) */
typedef enum {
LV_KEY_UP = 17, /*0x11*/
LV_KEY_DOWN = 18, /*0x12*/
LV_KEY_RIGHT = 19, /*0x13*/
LV_KEY_LEFT = 20, /*0x14*/
LV_KEY_ESC = 27, /*0x1B*/
LV_KEY_DEL = 127, /*0x7F*/
LV_KEY_BACKSPACE = 8, /*0x08*/
LV_KEY_ENTER = 10, /*0x0A, '\n'*/
LV_KEY_NEXT = 9, /*0x09, '\t'*/
LV_KEY_PREV = 11, /*0x0B, '*/
LV_KEY_HOME = 2, /*0x02, STX*/
LV_KEY_END = 3, /*0x03, ETX*/
} lv_key_t;
/**********************
* TYPEDEFS
**********************/
typedef void (*lv_group_focus_cb_t)(lv_group_t *);
typedef void (*lv_group_edge_cb_t)(lv_group_t *, bool);
typedef enum {
LV_GROUP_REFOCUS_POLICY_NEXT = 0,
LV_GROUP_REFOCUS_POLICY_PREV = 1
} lv_group_refocus_policy_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create new Widget group.
* @return pointer to the new Widget group
*/
lv_group_t * lv_group_create(void);
/**
* Delete group object.
* @param group pointer to a group
*/
void lv_group_delete(lv_group_t * group);
/**
* Set default group. New Widgets will be added to this group if it's enabled in
* their class with `add_to_def_group = true`.
* @param group pointer to a group (can be `NULL`)
*/
void lv_group_set_default(lv_group_t * group);
/**
* Get default group.
* @return pointer to the default group
*/
lv_group_t * lv_group_get_default(void);
/**
* Add an Widget to group.
* @param group pointer to a group
* @param obj pointer to a Widget to add
*/
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
/**
* Swap 2 Widgets in group. Widgets must be in the same group.
* @param obj1 pointer to a Widget
* @param obj2 pointer to another Widget
*/
void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2);
/**
* Remove a Widget from its group.
* @param obj pointer to Widget to remove
*/
void lv_group_remove_obj(lv_obj_t * obj);
/**
* Remove all Widgets from a group.
* @param group pointer to a group
*/
void lv_group_remove_all_objs(lv_group_t * group);
/**
* Focus on a Widget (defocus the current).
* @param obj pointer to Widget to focus on
*/
void lv_group_focus_obj(lv_obj_t * obj);
/**
* Focus on next Widget in a group (defocus the current).
* @param group pointer to a group
*/
void lv_group_focus_next(lv_group_t * group);
/**
* Focus on previous Widget in a group (defocus the current).
* @param group pointer to a group
*/
void lv_group_focus_prev(lv_group_t * group);
/**
* Do not allow changing focus from current Widget.
* @param group pointer to a group
* @param en true: freeze, false: release freezing (normal mode)
*/
void lv_group_focus_freeze(lv_group_t * group, bool en);
/**
* Send a control character to Widget that has focus in a group.
* @param group pointer to a group
* @param c a character (use LV_KEY_.. to navigate)
* @return result of Widget with focus in group.
*/
lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c);
/**
* Set a function for a group which will be called when a new Widget has focus.
* @param group pointer to a group
* @param focus_cb the call back function or NULL if unused
*/
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
/**
* Set a function for a group which will be called when a focus edge is reached
* @param group pointer to a group
* @param edge_cb the call back function or NULL if unused
*/
void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb);
/**
* Set whether the next or previous Widget in a group gets focus when Widget that has
* focus is deleted.
* @param group pointer to a group
* @param policy new refocus policy enum
*/
void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy);
/**
* Manually set the current mode (edit or navigate).
* @param group pointer to group
* @param edit true: edit mode; false: navigate mode
*/
void lv_group_set_editing(lv_group_t * group, bool edit);
/**
* Set whether moving focus to next/previous Widget will allow wrapping from
* first->last or last->first Widget.
* @param group pointer to group
* @param en true: wrapping enabled; false: wrapping disabled
*/
void lv_group_set_wrap(lv_group_t * group, bool en);
/**
* Get Widget that has focus, or NULL if there isn't one.
* @param group pointer to a group
* @return pointer to Widget with focus
*/
lv_obj_t * lv_group_get_focused(const lv_group_t * group);
/**
* Get focus callback function of a group.
* @param group pointer to a group
* @return the call back function or NULL if not set
*/
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group);
/**
* Get edge callback function of a group.
* @param group pointer to a group
* @return the call back function or NULL if not set
*/
lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group);
/**
* Get current mode (edit or navigate).
* @param group pointer to group
* @return true: edit mode; false: navigate mode
*/
bool lv_group_get_editing(const lv_group_t * group);
/**
* Get whether moving focus to next/previous Widget will allow wrapping from
* first->last or last->first Widget.
* @param group pointer to group
*/
bool lv_group_get_wrap(lv_group_t * group);
/**
* Get number of Widgets in group.
* @param group pointer to a group
* @return number of Widgets in the group
*/
uint32_t lv_group_get_obj_count(lv_group_t * group);
/**
* Get nth Widget within group.
* @param group pointer to a group
* @param index index of Widget within the group
* @return pointer to Widget
*/
lv_obj_t * lv_group_get_obj_by_index(lv_group_t * group, uint32_t index);
/**
* Get the number of groups.
* @return number of groups
*/
uint32_t lv_group_get_count(void);
/**
* Get a group by its index.
* @param index index of the group
* @return pointer to the group
*/
lv_group_t * lv_group_by_index(uint32_t index);
#if LV_USE_EXT_DATA
/**
* @brief Attaches external user data and destructor callback to a group
*
* Associates custom user data with an LVGL group and specifies a destructor function
* that will be automatically invoked when the group is deleted to properly clean up
* the associated resources.
*
* @param group Pointer to a group
* @param data User-defined data pointer to associate with a group
* @param free_cb Callback function for cleaning up ext_data when group is deleted.
* Receives ext_data as parameter. NULL means no cleanup required.
*/
void lv_group_set_external_data(lv_group_t * group, void * data, void (* free_cb)(void * data));
#endif
/**
* Set user data to the group
* @param group pointer to a group
* @param user_data pointer to user data
*/
void lv_group_set_user_data(lv_group_t * group, void * user_data);
/**
* Get a pointer to the user data of the group
* @param indev pointer to a group
* @return pointer to the user data or NULL if group is NULL
*/
void * lv_group_get_user_data(const lv_group_t * group);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GROUP_H*/
+55
View File
@@ -0,0 +1,55 @@
/**
* @file lv_init.h
*
*/
#ifndef LV_INIT_H
#define LV_INIT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize LVGL library.
* Should be called before any other LVGL related function.
*/
void lv_init(void);
/**
* Deinit the 'lv' library
*/
void lv_deinit(void);
/**
* Returns whether the 'lv' library is currently initialized
*/
bool lv_is_initialized(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_INIT_H*/
+144
View File
@@ -0,0 +1,144 @@
/**
* @file lv_matrix.h
*
*/
#ifndef LV_MATRIX_H
#define LV_MATRIX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_MATRIX
#include "../lv_types.h"
#include "lv_area.h"
/*********************
* DEFINES
*********************/
#if !LV_USE_FLOAT
#error "LV_USE_FLOAT is required for lv_matrix"
#endif
/**********************
* TYPEDEFS
**********************/
struct _lv_matrix_t {
float m[3][3];
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Set matrix to identity matrix
* @param matrix pointer to a matrix
*/
void lv_matrix_identity(lv_matrix_t * matrix);
/**
* Translate the matrix to new position
* @param matrix pointer to a matrix
* @param tx the amount of translate in x direction
* @param tx the amount of translate in y direction
*/
void lv_matrix_translate(lv_matrix_t * matrix, float tx, float ty);
/**
* Change the scale factor of the matrix
* @param matrix pointer to a matrix
* @param scale_x the scale factor for the X direction
* @param scale_y the scale factor for the Y direction
*/
void lv_matrix_scale(lv_matrix_t * matrix, float scale_x, float scale_y);
/**
* Rotate the matrix with origin
* @param matrix pointer to a matrix
* @param degree angle to rotate
*/
void lv_matrix_rotate(lv_matrix_t * matrix, float degree);
/**
* Change the skew factor of the matrix
* @param matrix pointer to a matrix
* @param skew_x the skew factor for x direction
* @param skew_y the skew factor for y direction
*/
void lv_matrix_skew(lv_matrix_t * matrix, float skew_x, float skew_y);
/**
* Multiply two matrix and store the result to the first one
* @param matrix pointer to a matrix
* @param matrix2 pointer to another matrix
*/
void lv_matrix_multiply(lv_matrix_t * matrix, const lv_matrix_t * mul);
/**
* Invert the matrix
* @param matrix pointer to a matrix
* @param m pointer to another matrix (optional)
* @return true: the matrix is invertible, false: the matrix is singular and cannot be inverted
*/
bool lv_matrix_inverse(lv_matrix_t * matrix, const lv_matrix_t * m);
/**
* Transform a point by a matrix
* @param matrix pointer to a matrix
* @param point pointer to a point
* @return the transformed point
*/
lv_point_precise_t lv_matrix_transform_precise_point(const lv_matrix_t * matrix, const lv_point_precise_t * point);
/**
* Transform an area by a matrix
* @param matrix pointer to a matrix
* @param area pointer to an area
* @return the transformed area
*/
lv_area_t lv_matrix_transform_area(const lv_matrix_t * matrix, const lv_area_t * area);
/**
* Check if the matrix is identity
* @param matrix pointer to a matrix
* @return true: the matrix is identity , false: the matrix is not identity
*/
bool lv_matrix_is_identity(const lv_matrix_t * matrix);
/**
* Check if the matrix is identity or translation matrix
* @param matrix pointer to a matrix
* @return true: the matrix is identity or translation matrix, false: the matrix is not identity or translation matrix
*/
bool lv_matrix_is_identity_or_translation(const lv_matrix_t * matrix);
/**
* Transpose a matrix.
* @param src pointer to the source matrix. If NULL, the function returns.
* @param dst pointer to the destination matrix. If NULL, the function returns.
* Note: src and dst may point to the same matrix for in-place transposition.
*/
void lv_matrix_transpose(const lv_matrix_t * src, lv_matrix_t * dst);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MATRIX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MATRIX_H*/
+495
View File
@@ -0,0 +1,495 @@
/**
* @file lv_obj.h
*
*/
#ifndef LV_OBJ_H
#define LV_OBJ_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../lv_types.h"
#include "lv_style.h"
#include "lv_area.h"
#include "../draw/lv_color.h"
#include "../debugging/lv_assert.h"
#include "lv_obj_tree.h"
#include "lv_obj_pos.h"
#include "lv_obj_scroll.h"
#include "lv_obj_style.h"
#include "lv_obj_draw.h"
#include "lv_obj_class.h"
#include "lv_obj_event.h"
#include "lv_obj_property.h"
#include "lv_group.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* On/Off features controlling the object's behavior.
* OR-ed values are possible
*
* Note: update obj flags corresponding properties below
* whenever add/remove flags or change bit definition of flags.
*/
typedef enum {
LV_OBJ_FLAG_HIDDEN = (1u << 0), /**< Make the object hidden. (Like it wasn't there at all)*/
LV_OBJ_FLAG_CLICKABLE = (1u << 1), /**< Make the object clickable by the input devices*/
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1u << 2), /**< Add focused state to the object when clicked*/
LV_OBJ_FLAG_CHECKABLE = (1u << 3), /**< Toggle checked state when the object is clicked*/
LV_OBJ_FLAG_SCROLLABLE = (1u << 4), /**< Make the object scrollable*/
LV_OBJ_FLAG_SCROLL_ELASTIC = (1u << 5), /**< Allow scrolling inside but with slower speed*/
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1u << 6), /**< Make the object scroll further when "thrown"*/
LV_OBJ_FLAG_SCROLL_ONE = (1u << 7), /**< Allow scrolling only one snappable children*/
LV_OBJ_FLAG_SCROLL_CHAIN_HOR = (1u << 8), /**< Allow propagating the horizontal scroll to a parent*/
LV_OBJ_FLAG_SCROLL_CHAIN_VER = (1u << 9), /**< Allow propagating the vertical scroll to a parent*/
LV_OBJ_FLAG_SCROLL_CHAIN = (LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER),
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1u << 10), /**< Automatically scroll object to make it visible when focused*/
LV_OBJ_FLAG_SCROLL_WITH_ARROW = (1u << 11), /**< Allow scrolling the focused object with arrow keys*/
LV_OBJ_FLAG_SNAPPABLE = (1u << 12), /**< If scroll snap is enabled on the parent it can snap to this object*/
LV_OBJ_FLAG_PRESS_LOCK = (1u << 13), /**< Keep the object pressed even if the press slid from the object*/
LV_OBJ_FLAG_EVENT_BUBBLE = (1u << 14), /**< Propagate the events to the parent too*/
LV_OBJ_FLAG_GESTURE_BUBBLE = (1u << 15), /**< Propagate the gestures to the parent*/
LV_OBJ_FLAG_ADV_HITTEST = (1u << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
LV_OBJ_FLAG_IGNORE_LAYOUT = (1u << 17), /**< Make the object not positioned by the layouts*/
LV_OBJ_FLAG_FLOATING = (1u << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/
LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS = (1u << 19), /**< Send `LV_EVENT_DRAW_TASK_ADDED` events*/
LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1u << 20),/**< Do not clip the children to the parent's ext draw size*/
LV_OBJ_FLAG_EVENT_TRICKLE = (1u << 21), /**< Propagate the events to the children too*/
LV_OBJ_FLAG_STATE_TRICKLE = (1u << 22), /**< Propagate the states to the children too*/
LV_OBJ_FLAG_LAYOUT_1 = (1u << 23), /**< Custom flag, free to use by layouts*/
LV_OBJ_FLAG_LAYOUT_2 = (1u << 24), /**< Custom flag, free to use by layouts*/
#if LV_USE_FLEX
LV_OBJ_FLAG_FLEX_IN_NEW_TRACK = LV_OBJ_FLAG_LAYOUT_1, /**< Start a new flex track on this item*/
#endif
LV_OBJ_FLAG_WIDGET_1 = (1u << 25), /**< Custom flag, free to use by widget*/
LV_OBJ_FLAG_WIDGET_2 = (1u << 26), /**< Custom flag, free to use by widget*/
LV_OBJ_FLAG_USER_1 = (1u << 27), /**< Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_2 = (1u << 28), /**< Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_3 = (1u << 29), /**< Custom flag, free to use by user*/
LV_OBJ_FLAG_USER_4 = (1u << 30), /**< Custom flag, free to use by user*/
} lv_obj_flag_t;
#if LV_USE_OBJ_PROPERTY
enum _lv_signed_prop_id_t {
/*OBJ flag properties */
LV_PROPERTY_ID(OBJ, FLAG_START, LV_PROPERTY_TYPE_INT, 0),
LV_PROPERTY_ID(OBJ, FLAG_HIDDEN, LV_PROPERTY_TYPE_INT, 0),
LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1),
LV_PROPERTY_ID(OBJ, FLAG_CLICK_FOCUSABLE, LV_PROPERTY_TYPE_INT, 2),
LV_PROPERTY_ID(OBJ, FLAG_CHECKABLE, LV_PROPERTY_TYPE_INT, 3),
LV_PROPERTY_ID(OBJ, FLAG_SCROLLABLE, LV_PROPERTY_TYPE_INT, 4),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ELASTIC, LV_PROPERTY_TYPE_INT, 5),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_MOMENTUM, LV_PROPERTY_TYPE_INT, 6),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ONE, LV_PROPERTY_TYPE_INT, 7),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_HOR, LV_PROPERTY_TYPE_INT, 8),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_CHAIN_VER, LV_PROPERTY_TYPE_INT, 9),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_ON_FOCUS, LV_PROPERTY_TYPE_INT, 10),
LV_PROPERTY_ID(OBJ, FLAG_SCROLL_WITH_ARROW, LV_PROPERTY_TYPE_INT, 11),
LV_PROPERTY_ID(OBJ, FLAG_SNAPPABLE, LV_PROPERTY_TYPE_INT, 12),
LV_PROPERTY_ID(OBJ, FLAG_PRESS_LOCK, LV_PROPERTY_TYPE_INT, 13),
LV_PROPERTY_ID(OBJ, FLAG_EVENT_BUBBLE, LV_PROPERTY_TYPE_INT, 14),
LV_PROPERTY_ID(OBJ, FLAG_GESTURE_BUBBLE, LV_PROPERTY_TYPE_INT, 15),
LV_PROPERTY_ID(OBJ, FLAG_ADV_HITTEST, LV_PROPERTY_TYPE_INT, 16),
LV_PROPERTY_ID(OBJ, FLAG_IGNORE_LAYOUT, LV_PROPERTY_TYPE_INT, 17),
LV_PROPERTY_ID(OBJ, FLAG_FLOATING, LV_PROPERTY_TYPE_INT, 18),
LV_PROPERTY_ID(OBJ, FLAG_SEND_DRAW_TASK_EVENTS, LV_PROPERTY_TYPE_INT, 19),
LV_PROPERTY_ID(OBJ, FLAG_OVERFLOW_VISIBLE, LV_PROPERTY_TYPE_INT, 20),
LV_PROPERTY_ID(OBJ, FLAG_EVENT_TRICKLE, LV_PROPERTY_TYPE_INT, 21),
LV_PROPERTY_ID(OBJ, FLAG_STATE_TRICKLE, LV_PROPERTY_TYPE_INT, 22),
LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_1, LV_PROPERTY_TYPE_INT, 23),
LV_PROPERTY_ID(OBJ, FLAG_LAYOUT_2, LV_PROPERTY_TYPE_INT, 24),
LV_PROPERTY_ID(OBJ, FLAG_FLEX_IN_NEW_TRACK, LV_PROPERTY_TYPE_INT, 23), /*Mapped to FLAG_LAYOUT_1*/
LV_PROPERTY_ID(OBJ, FLAG_WIDGET_1, LV_PROPERTY_TYPE_INT, 25),
LV_PROPERTY_ID(OBJ, FLAG_WIDGET_2, LV_PROPERTY_TYPE_INT, 26),
LV_PROPERTY_ID(OBJ, FLAG_USER_1, LV_PROPERTY_TYPE_INT, 27),
LV_PROPERTY_ID(OBJ, FLAG_USER_2, LV_PROPERTY_TYPE_INT, 28),
LV_PROPERTY_ID(OBJ, FLAG_USER_3, LV_PROPERTY_TYPE_INT, 29),
LV_PROPERTY_ID(OBJ, FLAG_USER_4, LV_PROPERTY_TYPE_INT, 30),
LV_PROPERTY_ID(OBJ, FLAG_END, LV_PROPERTY_TYPE_INT, 30),
LV_PROPERTY_ID(OBJ, STATE_START, LV_PROPERTY_TYPE_INT, 31),
LV_PROPERTY_ID(OBJ, STATE_ALT, LV_PROPERTY_TYPE_INT, 31),
/*1 reserved*/
LV_PROPERTY_ID(OBJ, STATE_CHECKED, LV_PROPERTY_TYPE_INT, 33),
LV_PROPERTY_ID(OBJ, STATE_FOCUSED, LV_PROPERTY_TYPE_INT, 34),
LV_PROPERTY_ID(OBJ, STATE_FOCUS_KEY, LV_PROPERTY_TYPE_INT, 35),
LV_PROPERTY_ID(OBJ, STATE_EDITED, LV_PROPERTY_TYPE_INT, 36),
LV_PROPERTY_ID(OBJ, STATE_HOVERED, LV_PROPERTY_TYPE_INT, 37),
LV_PROPERTY_ID(OBJ, STATE_PRESSED, LV_PROPERTY_TYPE_INT, 38),
LV_PROPERTY_ID(OBJ, STATE_SCROLLED, LV_PROPERTY_TYPE_INT, 39),
LV_PROPERTY_ID(OBJ, STATE_DISABLED, LV_PROPERTY_TYPE_INT, 40),
/*2 reserved*/
LV_PROPERTY_ID(OBJ, STATE_USER_1, LV_PROPERTY_TYPE_INT, 43),
LV_PROPERTY_ID(OBJ, STATE_USER_2, LV_PROPERTY_TYPE_INT, 44),
LV_PROPERTY_ID(OBJ, STATE_USER_3, LV_PROPERTY_TYPE_INT, 45),
LV_PROPERTY_ID(OBJ, STATE_USER_4, LV_PROPERTY_TYPE_INT, 46),
LV_PROPERTY_ID(OBJ, STATE_ANY, LV_PROPERTY_TYPE_INT, 47),
LV_PROPERTY_ID(OBJ, STATE_END, LV_PROPERTY_TYPE_INT, 47),
/*OBJ normal properties*/
LV_PROPERTY_ID(OBJ, PARENT, LV_PROPERTY_TYPE_OBJ, 48),
LV_PROPERTY_ID(OBJ, X, LV_PROPERTY_TYPE_INT, 49),
LV_PROPERTY_ID(OBJ, Y, LV_PROPERTY_TYPE_INT, 50),
LV_PROPERTY_ID(OBJ, W, LV_PROPERTY_TYPE_INT, 51),
LV_PROPERTY_ID(OBJ, H, LV_PROPERTY_TYPE_INT, 52),
LV_PROPERTY_ID(OBJ, CONTENT_WIDTH, LV_PROPERTY_TYPE_INT, 53),
LV_PROPERTY_ID(OBJ, CONTENT_HEIGHT, LV_PROPERTY_TYPE_INT, 54),
LV_PROPERTY_ID(OBJ, LAYOUT, LV_PROPERTY_TYPE_INT, 55),
LV_PROPERTY_ID(OBJ, ALIGN, LV_PROPERTY_TYPE_INT, 56),
LV_PROPERTY_ID(OBJ, SCROLLBAR_MODE, LV_PROPERTY_TYPE_INT, 57),
LV_PROPERTY_ID(OBJ, SCROLL_DIR, LV_PROPERTY_TYPE_INT, 58),
LV_PROPERTY_ID(OBJ, SCROLL_SNAP_X, LV_PROPERTY_TYPE_INT, 59),
LV_PROPERTY_ID(OBJ, SCROLL_SNAP_Y, LV_PROPERTY_TYPE_INT, 60),
LV_PROPERTY_ID(OBJ, SCROLL_X, LV_PROPERTY_TYPE_INT, 61),
LV_PROPERTY_ID(OBJ, SCROLL_Y, LV_PROPERTY_TYPE_INT, 62),
LV_PROPERTY_ID(OBJ, SCROLL_TOP, LV_PROPERTY_TYPE_INT, 63),
LV_PROPERTY_ID(OBJ, SCROLL_BOTTOM, LV_PROPERTY_TYPE_INT, 64),
LV_PROPERTY_ID(OBJ, SCROLL_LEFT, LV_PROPERTY_TYPE_INT, 65),
LV_PROPERTY_ID(OBJ, SCROLL_RIGHT, LV_PROPERTY_TYPE_INT, 66),
LV_PROPERTY_ID(OBJ, SCROLL_END, LV_PROPERTY_TYPE_POINT, 67),
LV_PROPERTY_ID(OBJ, EXT_DRAW_SIZE, LV_PROPERTY_TYPE_INT, 68),
LV_PROPERTY_ID(OBJ, EVENT_COUNT, LV_PROPERTY_TYPE_INT, 69),
LV_PROPERTY_ID(OBJ, SCREEN, LV_PROPERTY_TYPE_OBJ, 70),
LV_PROPERTY_ID(OBJ, DISPLAY, LV_PROPERTY_TYPE_POINTER, 71),
LV_PROPERTY_ID(OBJ, CHILD_COUNT, LV_PROPERTY_TYPE_INT, 72),
LV_PROPERTY_ID(OBJ, INDEX, LV_PROPERTY_TYPE_INT, 73),
LV_PROPERTY_OBJ_END,
};
#endif
/**
* Make the base object's class publicly available.
*/
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a base object (a rectangle)
* @param parent pointer to a parent object. If NULL then a screen will be created.
* @return pointer to the new object
*/
lv_obj_t * lv_obj_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set one or more flags
* @param obj pointer to an object
* @param f OR-ed values from `lv_obj_flag_t` to set.
*/
void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f);
/**
* Remove one or more flags
* @param obj pointer to an object
* @param f OR-ed values from `lv_obj_flag_t` to clear.
*/
void lv_obj_remove_flag(lv_obj_t * obj, lv_obj_flag_t f);
/**
* Set add or remove one or more flags.
* @param obj pointer to an object
* @param f OR-ed values from `lv_obj_flag_t` to update.
* @param v true: add the flags; false: remove the flags
*/
void lv_obj_set_flag(lv_obj_t * obj, lv_obj_flag_t f, bool v);
/**
* Add one or more states to the object. The other state bits will remain unchanged.
* If specified in the styles, transition animation will be started from the previous state to the current.
* @param obj pointer to an object
* @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
*/
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state);
/**
* Remove one or more states to the object. The other state bits will remain unchanged.
* If specified in the styles, transition animation will be started from the previous state to the current.
* @param obj pointer to an object
* @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
*/
void lv_obj_remove_state(lv_obj_t * obj, lv_state_t state);
/**
* Add or remove one or more states to the object. The other state bits will remain unchanged.
* @param obj pointer to an object
* @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
* @param v true: add the states; false: remove the states
*/
void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v);
/**
* Set the user_data field of the object
* @param obj pointer to an object
* @param user_data pointer to the new user_data.
*/
void lv_obj_set_user_data(lv_obj_t * obj, void * user_data);
/** Allow only one RADIO_BUTTON sibling to be checked
* @param obj pointer to a widget
* @param en enable or disable radio button behavior
*/
void lv_obj_set_radio_button(lv_obj_t * obj, bool en);
/*=======================
* Getter functions
*======================*/
/**
* Check if a given flag or all the given flags are set on an object.
* @param obj pointer to an object
* @param f the flag(s) to check (OR-ed values can be used)
* @return true: all flags are set; false: not all flags are set
*/
bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f);
/**
* Check if a given flag or any of the flags are set on an object.
* @param obj pointer to an object
* @param f the flag(s) to check (OR-ed values can be used)
* @return true: at least one flag is set; false: none of the flags are set
*/
bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f);
/**
* Get the state of an object
* @param obj pointer to an object
* @return the state (OR-ed values from `lv_state_t`)
*/
lv_state_t lv_obj_get_state(const lv_obj_t * obj);
/**
* Check if the object is in a given state or not.
* @param obj pointer to an object
* @param state a state or combination of states to check
* @return true: `obj` is in `state`; false: `obj` is not in `state`
*/
bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state);
/** Get whether the object is a radio button
* @param obj pointer to a widget
* @return true if radio button behavior is enabled
*/
bool lv_obj_is_radio_button(const lv_obj_t * obj);
/**
* Get the group of the object
* @param obj pointer to an object
* @return the pointer to group of the object
*/
lv_group_t * lv_obj_get_group(const lv_obj_t * obj);
/**
* Get the user_data field of the object
* @param obj pointer to an object
* @return the pointer to the user_data of the object
*/
void * lv_obj_get_user_data(lv_obj_t * obj);
/*=======================
* Other functions
*======================*/
/**
* Check the type of obj.
* @param obj pointer to an object
* @param class_p a class to check (e.g. `lv_slider_class`)
* @return true: `class_p` is the `obj` class.
*/
bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p);
/**
* Check if any object has a given class (type).
* It checks the ancestor classes too.
* @param obj pointer to an object
* @param class_p a class to check (e.g. `lv_slider_class`)
* @return true: `obj` has the given class
*/
bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p);
/**
* Get the class (type) of the object
* @param obj pointer to an object
* @return the class (type) of the object
*/
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj);
/**
* Check if any object is still "alive".
* @param obj pointer to an object
* @return true: valid
*/
bool lv_obj_is_valid(const lv_obj_t * obj);
/**
* Utility to set an object reference to NULL when it gets deleted.
* The reference should be in a location that will not become invalid
* during the object's lifetime, i.e. static or allocated.
* @param obj_ptr a pointer to a pointer to an object
*/
void lv_obj_null_on_delete(lv_obj_t ** obj_ptr);
/**
* Add an event handler to a widget that will load a screen on a trigger.
* @param obj pointer to widget which should load the screen
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param screen the screen to load (must be a valid widget)
* @param anim_type element of `lv_screen_load_anim_t` the screen load animation
* @param duration duration of the animation in milliseconds
* @param delay delay before the screen load in milliseconds
*/
void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_obj_t * screen,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay);
/**
* Add an event handler to a widget that will create a screen on a trigger.
* The created screen will be deleted when it's unloaded
* @param obj pointer to widget which should load the screen
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param screen_create_cb a callback to create the screen, e.g. `lv_obj_t * myscreen_create(void)`
* @param anim_type element of `lv_screen_load_anim_t` the screen load animation
* @param duration duration of the animation in milliseconds
* @param delay delay before the screen load in milliseconds
*/
void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb,
lv_screen_load_anim_t anim_type, uint32_t duration, uint32_t delay);
/**
* Play a timeline animation on a trigger
* @param obj pointer to widget which should trigger playing the animation
* @param trigger an event code, e.g. `LV_EVENT_CLICKED`
* @param at pointer to an animation timeline
* @param delay wait time before starting the animation
* @param reverse true: play in reverse
*/
void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay,
bool reverse);
#if LV_USE_OBJ_ID
/**
* Set an id for an object.
* @param obj pointer to an object
* @param id the id of the object
*/
void lv_obj_set_id(lv_obj_t * obj, void * id);
/**
* Get the id of an object.
* @param obj pointer to an object
* @return the id of the object
*/
void * lv_obj_get_id(const lv_obj_t * obj);
/**
* DEPRECATED IDs are used only to print the widget trees.
* To find a widget use `lv_obj_find_by_name`
*
* Get the child object by its id.
* It will check children and grandchildren recursively.
* Function `lv_obj_id_compare` is used to matched obj id with given id.
*
* @param obj pointer to an object
* @param id the id of the child object
* @return pointer to the child object or NULL if not found
*/
lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id);
/**
* Assign id to object if not previously assigned.
* This function gets called automatically when LV_OBJ_ID_AUTO_ASSIGN is enabled.
*
* Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method to generate object ID.
* Otherwise, these functions including `lv_obj_[set|assign|free|stringify]_id` and
* `lv_obj_id_compare`should be implemented externally.
*
* @param class_p the class this obj belongs to. Note obj->class_p is the class currently being constructed.
* @param obj pointer to an object
*/
void lv_obj_assign_id(const lv_obj_class_t * class_p, lv_obj_t * obj);
/**
* Free resources allocated by `lv_obj_assign_id` or `lv_obj_set_id`.
* This function is also called automatically when object is deleted.
* @param obj pointer to an object
*/
void lv_obj_free_id(lv_obj_t * obj);
/**
* Compare two obj id, return 0 if they are equal.
*
* Set `LV_USE_OBJ_ID_BUILTIN` to use the builtin method for compare.
* Otherwise, it must be implemented externally.
*
* @param id1: the first id
* @param id2: the second id
* @return 0 if they are equal, non-zero otherwise.
*/
int lv_obj_id_compare(const void * id1, const void * id2);
/**
* Format an object's id into a string.
* @param obj pointer to an object
* @param buf buffer to write the string into
* @param len length of the buffer
*/
const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len);
#if LV_USE_OBJ_ID_BUILTIN
/**
* Free resources used by builtin ID generator.
*/
void lv_objid_builtin_destroy(void);
#endif
#endif /*LV_USE_OBJ_ID*/
/**********************
* MACROS
**********************/
#if LV_USE_ASSERT_OBJ
# define LV_ASSERT_OBJ(obj_p, obj_class) \
do { \
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \
} while(0)
# else
# define LV_ASSERT_OBJ(obj_p, obj_class) LV_ASSERT_NULL(obj_p)
#endif
#if LV_USE_LOG && LV_LOG_TRACE_OBJ_CREATE
# define LV_TRACE_OBJ_CREATE(...) LV_LOG_TRACE(__VA_ARGS__)
#else
# define LV_TRACE_OBJ_CREATE(...)
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_H*/
+89
View File
@@ -0,0 +1,89 @@
/**
* @file lv_obj_class.h
*
*/
#ifndef LV_OBJ_CLASS_H
#define LV_OBJ_CLASS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "lv_area.h"
#include "lv_obj_property.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
LV_OBJ_CLASS_EDITABLE_TRUE,
LV_OBJ_CLASS_EDITABLE_FALSE,
} lv_obj_class_editable_t;
typedef enum {
LV_OBJ_CLASS_GROUP_DEF_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
LV_OBJ_CLASS_GROUP_DEF_TRUE,
LV_OBJ_CLASS_GROUP_DEF_FALSE,
} lv_obj_class_group_def_t;
typedef enum {
LV_OBJ_CLASS_THEME_INHERITABLE_FALSE, /**< Do not inherit theme from base class. */
LV_OBJ_CLASS_THEME_INHERITABLE_TRUE,
} lv_obj_class_theme_inheritable_t;
typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an object form a class descriptor
* @param class_p pointer to a class
* @param parent pointer to an object where the new object should be created
* @return pointer to the created object
*/
lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * parent);
void lv_obj_class_init_obj(lv_obj_t * obj);
bool lv_obj_is_editable(lv_obj_t * obj);
bool lv_obj_is_group_def(lv_obj_t * obj);
#if LV_USE_EXT_DATA
/**
* @brief Associates an array of external data pointers with an LVGL object
*
* Associates custom user data with an LVGL object and specifies a destructor function
* that will be automatically invoked when the object is deleted to properly clean up
* the associated resources.
*
* @param obj Target LVGL object
* @param data User-defined data pointer to associate with a object
* @param free_cb Cleanup function called for each non-NULL data pointer during
* object deletion. Receives single data pointer as parameter.
* NULL means no automatic cleanup.
*/
void lv_obj_set_external_data(lv_obj_t * obj, void * data, void (* free_cb)(void * data));
#endif
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_CLASS_H*/
+142
View File
@@ -0,0 +1,142 @@
/**
* @file lv_obj_draw.h
*
*/
#ifndef LV_OBJ_DRAW_H
#define LV_OBJ_DRAW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "../draw/lv_draw_rect.h"
#include "../draw/lv_draw_label.h"
#include "../draw/lv_draw_image.h"
#include "../draw/lv_draw_line.h"
#include "../draw/lv_draw_arc.h"
#include "../draw/lv_draw_triangle.h"
#include "../draw/lv_draw_blur.h"
#include "lv_obj_style.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Store the type of layer required to render a widget.*/
typedef enum {
/**No layer is needed. */
LV_LAYER_TYPE_NONE,
/**Simple layer means that the layer can be rendered in chunks.
* For example with opa_layered = 140 it's possible to render only 10 lines
* from the layer. When it's ready go to the next 10 lines.
* It avoids large memory allocations for the layer buffer.
* The buffer size for a chunk can be set by `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` in lv_conf.h.*/
LV_LAYER_TYPE_SIMPLE,
/**The widget is transformed and cannot be rendered in chunks.
* It's because - due to the transformations - pixel outside of
* a given area will also contribute to the final image.
* In this case there is no limitation on the buffer size.
* LVGL will allocate as large buffer as needed to render the transformed area.*/
LV_LAYER_TYPE_TRANSFORM,
} lv_layer_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize a rectangle draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
* Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
* @note Only the relevant fields will be set.
* E.g. if `border width == 0` the other border properties won't be evaluated.
*/
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc);
/**
* Initialize a label draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc);
/**
* Initialize an image draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc);
/**
* Initialize a line draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc);
/**
* Initialize an arc draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc);
/**
* Initialize a blur draw descriptor from an object's styles in its current state.
* draw_dsc->radius will only be calculated if it's 0 initially. Radius can be set before calling this function
* to avoid getting it twice.
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_blur_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_blur_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_blur_dsc_t * draw_dsc);
/**
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
* @param obj pointer to an object
* @param part part of the object
* @return the extra size required around the object
*/
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part);
/**
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
* The result will be saved in `obj`.
* @param obj pointer to an object
*/
void lv_obj_refresh_ext_draw_size(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_DRAW_H*/
+213
View File
@@ -0,0 +1,213 @@
/**
* @file lv_obj_event.h
*
*/
#ifndef LV_OBJ_EVENT_H
#define LV_OBJ_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_event.h"
#include "../lv_types.h"
#include "../indev/lv_indev.h"
#include "lv_obj_style.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Cover check results.*/
typedef enum {
LV_COVER_RES_COVER = 0,
LV_COVER_RES_NOT_COVER = 1,
LV_COVER_RES_MASKED = 2,
} lv_cover_res_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Send an event to the object
* @param obj pointer to an object
* @param event_code the type of the event from `lv_event_t`
* @param param arbitrary data depending on the widget type and the event. (Usually `NULL`)
* @return LV_RESULT_OK: `obj` was not deleted in the event; LV_RESULT_INVALID: `obj` was deleted in the event_code
*/
lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param);
/**
* Used by the widgets internally to call the ancestor widget types's event handler
* @param class_p pointer to the class of the widget (NOT the ancestor class)
* @param e pointer to the event descriptor
* @return LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code
*/
lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e);
/**
* Get the current target of the event. It's the object which event handler being called.
* If the event is not bubbled it's the same as "original" target.
* @param e pointer to the event descriptor
* @return the target of the event_code
*/
lv_obj_t * lv_event_get_current_target_obj(lv_event_t * e);
/**
* Get the object originally targeted by the event. It's the same even if the event is bubbled.
* @param e pointer to the event descriptor
* @return pointer to the original target of the event_code
*/
lv_obj_t * lv_event_get_target_obj(lv_event_t * e);
/**
* Add an event handler function for an object.
* Used by the user to react on event which happens with the object.
* An object can have multiple event handler. They will be called in the same order as they were added.
* @param obj pointer to an object
* @param filter an event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be used to receive all the events.
* @param event_cb the new event function
* @param user_data custom data will be available in `event_cb`
* @return handler to the event. It can be used in `lv_obj_remove_event_dsc`.
*/
lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
uint32_t lv_obj_get_event_count(lv_obj_t * obj);
lv_event_dsc_t * lv_obj_get_event_dsc(lv_obj_t * obj, uint32_t index);
bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index);
bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc);
/**
* Remove an event_cb from an object
* @param obj pointer to a obj
* @param event_cb the event_cb of the event to remove
* @return the count of the event removed
*/
uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
/**
* Remove an event_cb with user_data
* @param obj pointer to a obj
* @param event_cb the event_cb of the event to remove
* @param user_data user_data
* @return the count of the event removed
*/
uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data);
/**
* Get the input device passed as parameter to indev related events.
* @param e pointer to an event
* @return the indev that triggered the event or NULL if called on a not indev related event
*/
lv_indev_t * lv_event_get_indev(lv_event_t * e);
/**
* Get the draw context which should be the first parameter of the draw functions.
* Namely: `LV_EVENT_DRAW_MAIN/POST`, `LV_EVENT_DRAW_MAIN/POST_BEGIN`, `LV_EVENT_DRAW_MAIN/POST_END`
* @param e pointer to an event
* @return pointer to a draw context or NULL if called on an unrelated event
*/
lv_layer_t * lv_event_get_layer(lv_event_t * e);
/**
* Get the old area of the object before its size was changed. Can be used in `LV_EVENT_SIZE_CHANGED`
* @param e pointer to an event
* @return the old absolute area of the object or NULL if called on an unrelated event
*/
const lv_area_t * lv_event_get_old_size(lv_event_t * e);
/**
* Get the key passed as parameter to an event. Can be used in `LV_EVENT_KEY`
* @param e pointer to an event
* @return the triggering key or NULL if called on an unrelated event
*/
uint32_t lv_event_get_key(lv_event_t * e);
/**
* Get the signed rotary encoder diff. passed as parameter to an event. Can be used in `LV_EVENT_ROTARY`
* @param e pointer to an event
* @return the triggering key or NULL if called on an unrelated event
*/
int32_t lv_event_get_rotary_diff(lv_event_t * e);
/**
* Get the animation descriptor of a scrolling. Can be used in `LV_EVENT_SCROLL_BEGIN`
* @param e pointer to an event
* @return the animation that will scroll the object. (can be modified as required)
*/
lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e);
/**
* Set the new extra draw size. Can be used in `LV_EVENT_REFR_EXT_DRAW_SIZE`
* @param e pointer to an event
* @param size The new extra draw size
*/
void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size);
/**
* Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`).
* Can be used in `LV_EVENT_GET_SELF_SIZE`
* @param e pointer to an event
* @return pointer to `lv_point_t` or NULL if called on an unrelated event
*/
lv_point_t * lv_event_get_self_size_info(lv_event_t * e);
/**
* Get a pointer to an `lv_hit_test_info_t` variable in which the hit test result should be saved. Can be used in `LV_EVENT_HIT_TEST`
* @param e pointer to an event
* @return pointer to `lv_hit_test_info_t` or NULL if called on an unrelated event
*/
lv_hit_test_info_t * lv_event_get_hit_test_info(lv_event_t * e);
/**
* Get a pointer to an area which should be examined whether the object fully covers it or not.
* Can be used in `LV_EVENT_HIT_TEST`
* @param e pointer to an event
* @return an area with absolute coordinates to check
*/
const lv_area_t * lv_event_get_cover_area(lv_event_t * e);
/**
* Set the result of cover checking. Can be used in `LV_EVENT_COVER_CHECK`
* @param e pointer to an event
* @param res an element of ::lv_cover_check_info_t
*/
void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res);
/**
* Get the draw task which was just added.
* Can be used in `LV_EVENT_DRAW_TASK_ADDED event`
* @param e pointer to an event
* @return the added draw task
*/
lv_draw_task_t * lv_event_get_draw_task(lv_event_t * e);
/**
* Get the previous state before the state change.
* Can be used in `LV_EVENT_STATE_CHANGED` event
* @param e pointer to an event
* @return the previous state
*/
lv_state_t lv_event_get_prev_state(lv_event_t * e);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_EVENT_H*/
File diff suppressed because it is too large Load Diff
+280
View File
@@ -0,0 +1,280 @@
/**
* @file lv_obj_property.h
*
*/
#ifndef LV_OBJ_PROPERTY_H
#define LV_OBJ_PROPERTY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "lv_style.h"
#include "lv_obj_style.h"
#if LV_USE_OBJ_PROPERTY
/*********************
* DEFINES
*********************/
/*All possible property value types*/
#define LV_PROPERTY_TYPE_INVALID 0 /*Use default 0 as invalid to detect program outliers*/
#define LV_PROPERTY_TYPE_INT 1 /*int32_t type*/
#define LV_PROPERTY_TYPE_PRECISE 2 /*lv_value_precise_t, int32_t or float depending on LV_USE_FLOAT*/
#define LV_PROPERTY_TYPE_COLOR 3 /*ARGB8888 type*/
#define LV_PROPERTY_TYPE_POINT 4 /*lv_point_t */
#define LV_PROPERTY_TYPE_POINTER 5 /*void * pointer*/
#define LV_PROPERTY_TYPE_IMGSRC 6 /*Special pointer for image*/
#define LV_PROPERTY_TYPE_TEXT 7 /*Special pointer of char* */
#define LV_PROPERTY_TYPE_OBJ 8 /*Special pointer of lv_obj_t* */
#define LV_PROPERTY_TYPE_DISPLAY 9 /*Special pointer of lv_display_t* */
#define LV_PROPERTY_TYPE_FONT 10 /*Special pointer of lv_font_t* */
#define LV_PROPERTY_TYPE_BOOL 11 /*int32_t type*/
#define LV_PROPERTY_TYPE_SHIFT 28
#define LV_PROPERTY_TYPE2_SHIFT 24
/* Example:
* LV_PROPERTY_ID(OBJ, FLAG_CLICKABLE, LV_PROPERTY_TYPE_INT, 1),
* produces
* LV_PROPERTY_OBJ_FLAG_CLICKABLE = (LV_PROPERTY_OBJ_START + (1)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT)
*/
#define LV_PROPERTY_ID(clz, name, type, index) LV_PROPERTY_## clz ##_##name = (LV_PROPERTY_## clz ##_START + ((int)index)) | ((type) << LV_PROPERTY_TYPE_SHIFT)
/* Example:
* LV_PROPERTY_ID2(SLIDER, VALUE, LV_PROPERTY_TYPE_INT, LV_PROPERTY_TYPE_BOOL, 0)
* produces
* LV_PROPERTY_SLIDER_VALUE = (LV_PROPERTY_SLIDER_START + (0)) | ((LV_PROPERTY_TYPE_INT) << LV_PROPERTY_TYPE_SHIFT) | ((LV_PROPERTY_TYPE_BOOL) << LV_PROPERTY_TYPE2_SHIFT)
*/
#define LV_PROPERTY_ID2(clz, name, type, type2, index) LV_PROPERTY_ID(clz, name, type, index) | ((type2) << LV_PROPERTY_TYPE2_SHIFT)
#define LV_PROPERTY_ID_TYPE(id) ((id) >> LV_PROPERTY_TYPE_SHIFT)
#define LV_PROPERTY_ID_TYPE2(id) ((id) >> LV_PROPERTY_TYPE_SHIFT)
#define LV_PROPERTY_ID_INDEX(id) ((id) & 0xfffffff)
/*Set properties from an array of lv_property_t*/
#define LV_OBJ_SET_PROPERTY_ARRAY(obj, array) lv_obj_set_properties(obj, array, LV_ARRAYLEN(array))
/* Helper to implement class definition of property and property names */
/* *INDENT-OFF* */
#if LV_USE_OBJ_PROPERTY_NAME
#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \
.prop_index_start = LV_PROPERTY_##uppercase##_START, \
.prop_index_end = LV_PROPERTY_##uppercase##_END, \
.properties = lv_##widget##_properties, \
.properties_count = LV_ARRAYLEN(lv_##widget##_properties), \
.property_names = lv_##widget##_property_names, \
.names_count = LV_ARRAYLEN(lv_##widget##_property_names)
#else
#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase) \
.prop_index_start = LV_PROPERTY_##uppercase##_START, \
.prop_index_end = LV_PROPERTY_##uppercase##_END, \
.properties = lv_##widget##_properties, \
.properties_count = LV_ARRAYLEN(lv_##widget##_properties)
#endif
/* *INDENT-ON* */
/**********************
* TYPEDEFS
**********************/
/**
* Group of predefined widget ID start value.
*/
enum _lv_prop_id_range_boundary_t {
LV_PROPERTY_ID_INVALID = 0,
/*ID 0x01 to 0xff are style ID, check lv_style_prop_t*/
LV_PROPERTY_STYLE_START = 0x00,
LV_PROPERTY_ID_START = 0x0100, /*ID smaller than 0xff is style ID*/
/*Define the property ID for every widget here. */
LV_PROPERTY_OBJ_START = 0x0100, /* lv_obj.c */
LV_PROPERTY_IMAGE_START = 0x0200, /* lv_image.c */
LV_PROPERTY_LABEL_START = 0x0300, /* lv_label.c */
LV_PROPERTY_KEYBOARD_START = 0x0400, /* lv_keyboard.c */
LV_PROPERTY_TEXTAREA_START = 0x0500, /* lv_textarea.c */
LV_PROPERTY_ROLLER_START = 0x0600, /* lv_roller.c */
LV_PROPERTY_DROPDOWN_START = 0x0700, /* lv_dropdown.c */
LV_PROPERTY_SLIDER_START = 0x0800, /* lv_slider.c */
LV_PROPERTY_ANIMIMAGE_START = 0x0900, /* lv_animimage.c */
LV_PROPERTY_ARC_START = 0x0a00, /* lv_arc.c */
LV_PROPERTY_BAR_START = 0x0b00, /* lv_bar.c */
LV_PROPERTY_SWITCH_START = 0x0c00, /* lv_switch.c */
LV_PROPERTY_CHECKBOX_START = 0x0d00, /* lv_checkbox.c */
LV_PROPERTY_LED_START = 0x0e00, /* lv_led.c */
LV_PROPERTY_LINE_START = 0x0f00, /* lv_line.c */
LV_PROPERTY_SCALE_START = 0x1000, /* lv_scale.c */
LV_PROPERTY_SPINBOX_START = 0x1100, /* lv_spinbox.c */
LV_PROPERTY_SPINNER_START = 0x1200, /* lv_spinner.c */
LV_PROPERTY_TABLE_START = 0x1300, /* lv_table.c */
LV_PROPERTY_TABVIEW_START = 0x1400, /* lv_tabview.c */
LV_PROPERTY_BUTTONMATRIX_START = 0x1500, /* lv_buttonmatrix.c */
LV_PROPERTY_SPAN_START = 0x1600, /* lv_span.c */
LV_PROPERTY_MENU_START = 0x1700, /* lv_menu.c */
LV_PROPERTY_CHART_START = 0x1800, /* lv_chart.c */
/*Special ID, use it to extend ID and make sure it's unique and compile time determinant*/
LV_PROPERTY_ID_BUILTIN_LAST = 0xffff, /*ID of 0x10000 ~ 0xfffffff is reserved for user*/
LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/
};
struct _lv_property_name_t {
const char * name;
lv_prop_id_t id;
};
typedef struct {
lv_prop_id_t id;
union {
int32_t num; /**< Signed integer number (enums or "normal" numbers)*/
uint32_t num_u; /**< Unsigned integer number (opacity, Booleans) */
bool enable; /**< Booleans */
const void * ptr; /**< Constant pointers (font, cone text, etc.) */
lv_color_t color; /**< Colors */
lv_value_precise_t precise; /**< float or int for precise value */
lv_point_t point; /**< Point, contains two int32_t */
struct {
/**
* Note that place struct member `style` at first place is intended.
* `style` shares same memory with `num`, `ptr`, `color`.
* So we set the style value directly without using `prop.style.num`.
*
* E.g.
*
* static const lv_property_t obj_pos_x = {
* .id = LV_PROPERTY_STYLE_X,
* .num = 123,
* .selector = LV_STATE_PRESSED,
* }
*
* instead of:
* static const lv_property_t obj_pos_x = {
* .id = LV_PROPERTY_STYLE_X,
* .style.num = 123, // note this line.
* .selector = LV_STATE_PRESSED,
* }
*/
lv_style_value_t style; /**< Make sure it's the first element in struct. */
uint32_t selector; /**< Style selector, lv_part_t | lv_state_t */
};
/**
* For some properties like slider range, it contains two simple (4-byte) values
* so we can use `arg1.num` and `arg2.num` to set the argument.
*/
struct {
union {
int32_t num;
uint32_t num_u;
bool enable;
const void * ptr;
lv_color_t color;
lv_value_precise_t precise;
} arg1, arg2;
};
};
} lv_property_t;
typedef struct {
lv_prop_id_t id;
void * setter; /**< Callback used to set property. */
void * getter; /**< Callback used to get property. */
} lv_property_ops_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Setter functions
*====================*/
/**
* Set Widget property.
* @param obj pointer to Widget
* @param value property value to set
* @return return LV_RESULT_OK if call succeeded
*/
lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value);
/**
* Set multiple Widget properties. Helper `LV_OBJ_SET_PROPERTY_ARRAY` can be used for constant property array.
* @param obj pointer to Widget
* @param value property value array to set
* @param count number of array elements
* @return return LV_RESULT_OK if call succeeded
*/
lv_result_t lv_obj_set_properties(lv_obj_t * obj, const lv_property_t * value, uint32_t count);
/*=====================
* Getter functions
*====================*/
/**
* Read property value from Widget.
* If id is a style property, computes the style of PART_MAIN.
* @param obj pointer to Widget
* @param id ID of property to read
* @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed.
*/
lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id);
/**
* Read style property value from Widget
* @param obj pointer to Widget
* @param id ID of style property
* @param part part for which the style property should be computed
* @return return property value read. The returned property ID is set to `LV_PROPERTY_ID_INVALID` if read failed.
*/
lv_property_t lv_obj_get_style_property(lv_obj_t * obj, lv_prop_id_t id, lv_part_t part);
/**
* Get property ID by recursively searching for name in Widget's class hierarchy, and
* if still not found, then search style properties.
* Requires to enabling `LV_USE_OBJ_PROPERTY_NAME`.
* @param obj pointer to Widget whose class and base-class hierarchy are to be searched.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_obj_property_get_id(const lv_obj_t * obj, const char * name);
/**
* Get property ID by doing a non-recursive search for name directly in Widget class properties.
* Requires enabling `LV_USE_OBJ_PROPERTY_NAME`.
* @param clz pointer to Widget class that has specified property.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_obj_class_property_get_id(const lv_obj_class_t * clz, const char * name);
/**
* Get style property ID by name. Requires enabling `LV_USE_OBJ_PROPERTY_NAME`.
* @param name property name
* @return property ID found or `LV_PROPERTY_ID_INVALID` if not found.
*/
lv_prop_id_t lv_style_property_get_id(const char * name);
/**********************
* MACROS
**********************/
#else
#define LV_PROPERTY_CLASS_FIELDS(widget, uppercase)
#endif /*LV_USE_OBJ_PROPERTY*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_PROPERTY_H*/
+39
View File
@@ -0,0 +1,39 @@
/**
* @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 "../lv_types.h"
#if LV_USE_OBJ_PROPERTY && LV_USE_OBJ_PROPERTY_NAME
extern const lv_property_name_t lv_animimage_property_names[4];
extern const lv_property_name_t lv_arc_property_names[11];
extern const lv_property_name_t lv_bar_property_names[6];
extern const lv_property_name_t lv_buttonmatrix_property_names[2];
extern const lv_property_name_t lv_chart_property_names[5];
extern const lv_property_name_t lv_checkbox_property_names[1];
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_led_property_names[2];
extern const lv_property_name_t lv_line_property_names[1];
extern const lv_property_name_t lv_menu_property_names[2];
extern const lv_property_name_t lv_obj_property_names[76];
extern const lv_property_name_t lv_roller_property_names[3];
extern const lv_property_name_t lv_scale_property_names[8];
extern const lv_property_name_t lv_slider_property_names[8];
extern const lv_property_name_t lv_span_property_names[5];
extern const lv_property_name_t lv_spinbox_property_names[8];
extern const lv_property_name_t lv_spinner_property_names[2];
extern const lv_property_name_t lv_style_property_names[131];
extern const lv_property_name_t lv_switch_property_names[1];
extern const lv_property_name_t lv_table_property_names[2];
extern const lv_property_name_t lv_tabview_property_names[2];
extern const lv_property_name_t lv_textarea_property_names[14];
#endif
#endif
+301
View File
@@ -0,0 +1,301 @@
/**
* @file lv_obj_scroll.h
*
*/
#ifndef LV_OBJ_SCROLL_H
#define LV_OBJ_SCROLL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_area.h"
#include "lv_anim.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Can't include lv_obj.h because it includes this header file*/
/** Scrollbar modes: shows when should the scrollbars be visible*/
typedef enum {
LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/
LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/
LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when Widget is being scrolled*/
LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/
} lv_scrollbar_mode_t;
/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/
typedef enum {
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/
LV_SCROLL_SNAP_START, /**< Align to the left/top*/
LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/
LV_SCROLL_SNAP_CENTER /**< Align to the center*/
} lv_scroll_snap_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*=====================
* Setter functions
*====================*/
/**
* Set how the scrollbars should behave.
* @param obj pointer to Widget
* @param mode LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
*/
void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode);
/**
* Set direction Widget can be scrolled
* @param obj pointer to Widget
* @param dir one or more bit-wise OR-ed values of `lv_dir_t` enumeration
*/
void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir);
/**
* Set where to snap the children when scrolling ends horizontally
* @param obj pointer to Widget
* @param align value from `lv_scroll_snap_t` enumeration
*/
void lv_obj_set_scroll_snap_x(lv_obj_t * obj, lv_scroll_snap_t align);
/**
* Set where to snap the children when scrolling ends vertically
* @param obj pointer to Widget
* @param align value from `lv_scroll_snap_t` enumeration
*/
void lv_obj_set_scroll_snap_y(lv_obj_t * obj, lv_scroll_snap_t align);
/*=====================
* Getter functions
*====================*/
/**
* Get the current scroll mode (when to hide the scrollbars)
* @param obj pointer to Widget
* @return the current scroll mode from `lv_scrollbar_mode_t`
*/
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj);
/**
* Get directions Widget can be scrolled (set with `lv_obj_set_scroll_dir()`)
* @param obj pointer to Widget
* @return current scroll direction bit(s)
*/
lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj);
/**
* Get where to snap child Widgets when horizontal scrolling ends.
* @param obj pointer to Widget
* @return current snap value from `lv_scroll_snap_t`
*/
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t * obj);
/**
* Get where to snap child Widgets when vertical scrolling ends.
* @param obj pointer to Widget
* @return current snap value from `lv_scroll_snap_t`
*/
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj);
/**
* Get current X scroll position. Identical to `lv_obj_get_scroll_left()`.
* @param obj pointer to scrollable container Widget
* @return current scroll position from left edge
* - If Widget is not scrolled return 0.
* - If scrolled return > 0.
* - If scrolled inside (elastic scroll) return < 0.
*/
int32_t lv_obj_get_scroll_x(const lv_obj_t * obj);
/**
* Get current Y scroll position. Identical to `lv_obj_get_scroll_top()`.
* @param obj pointer to scrollable container Widget
* @return current scroll position from top edge
* - If Widget is not scrolled return 0.
* - If scrolled return > 0.
* - If scrolled inside (elastic scroll) return < 0.
*/
int32_t lv_obj_get_scroll_y(const lv_obj_t * obj);
/**
* Number of pixels a scrollable container Widget can be scrolled down
* before its top edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag
* is set in Widget, this value can go negative while Widget is being
* dragged below its normal top-edge boundary.
* @param obj pointer to scrollable container Widget
* @return pixels Widget can be scrolled down before its top edge appears
*/
int32_t lv_obj_get_scroll_top(const lv_obj_t * obj);
/**
* Number of pixels a scrollable container Widget can be scrolled up
* before its bottom edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag
* is set in Widget, this value can go negative while Widget is being
* dragged above its normal bottom-edge boundary.
* @param obj pointer to scrollable container Widget
* @return pixels Widget can be scrolled up before its bottom edge appears
*/
int32_t lv_obj_get_scroll_bottom(const lv_obj_t * obj);
/**
* Number of pixels a scrollable container Widget can be scrolled right
* before its left edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag
* is set in Widget, this value can go negative while Widget is being
* dragged farther right than its normal left-edge boundary.
* @param obj pointer to scrollable container Widget
* @return pixels Widget can be scrolled right before its left edge appears
*/
int32_t lv_obj_get_scroll_left(const lv_obj_t * obj);
/**
* Number of pixels a scrollable container Widget can be scrolled left
* before its right edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag
* is set in Widget, this value can go negative while Widget is being
* dragged farther left than its normal right-edge boundary.
* @param obj pointer to scrollable container Widget
* @return pixels Widget can be scrolled left before its right edge appears
*/
int32_t lv_obj_get_scroll_right(const lv_obj_t * obj);
/**
* Get the X and Y coordinates where the scrolling will end for Widget if a scrolling animation is in progress.
* If no scrolling animation, give the current `x` or `y` scroll position.
* @param obj pointer to scrollable Widget
* @param end pointer to `lv_point_t` object in which to store result
*/
void lv_obj_get_scroll_end(lv_obj_t * obj, lv_point_t * end);
/*=====================
* Other functions
*====================*/
/**
* Scroll by given amount of pixels.
* @param obj pointer to scrollable Widget to scroll
* @param dx pixels to scroll horizontally
* @param dy pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
* @note e.g. dy = -20 means scroll down 20 px
*/
void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en);
/**
* Scroll by given amount of pixels.
* `dx` and `dy` will be limited internally to allow scrolling only on the content area.
* @param obj pointer to scrollable Widget to scroll
* @param dx pixels to scroll horizontally
* @param dy pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
* @note e.g. dy = -20 means scroll down 20 px
*/
void lv_obj_scroll_by_bounded(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en);
/**
* Scroll to given coordinate on Widget.
* `x` and `y` will be limited internally to allow scrolling only on the content area.
* @param obj pointer to scrollable Widget to scroll
* @param x pixels to scroll horizontally
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to(lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en);
/**
* Scroll to X coordinate on Widget.
* `x` will be limited internally to allow scrolling only on the content area.
* @param obj pointer to scrollable Widget to scroll
* @param x pixels to scroll horizontally
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_x(lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en);
/**
* Scroll to Y coordinate on Widget.
* `y` will be limited internally to allow scrolling only on the content area.
* @param obj pointer to scrollable Widget to scroll
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_y(lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en);
/**
* Scroll `obj`'s parent Widget until `obj` becomes visible.
* @param obj pointer to Widget to scroll into view
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll `obj`'s parent Widgets recursively until `obj` becomes visible.
* Widget will be scrolled into view even it has nested scrollable parents.
* @param obj pointer to Widget to scroll into view
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Tell whether Widget is being scrolled or not at this moment
* @param obj pointer to Widget
* @return true: `obj` is being scrolled
*/
bool lv_obj_is_scrolling(const lv_obj_t * obj);
/**
* Stop scrolling the current object
*
* @param obj The object being scrolled
*/
void lv_obj_stop_scroll_anim(const lv_obj_t * obj);
/**
* Check children of `obj` and scroll `obj` to fulfill scroll_snap settings.
* @param obj Widget whose children need to be checked and snapped
* @param anim_en LV_ANIM_ON/OFF
*/
void lv_obj_update_snap(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Get the area of the scrollbars
* @param obj pointer to Widget
* @param hor pointer to store the area of the horizontal scrollbar
* @param ver pointer to store the area of the vertical scrollbar
*/
void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver);
/**
* Invalidate the area of the scrollbars
* @param obj pointer to Widget
*/
void lv_obj_scrollbar_invalidate(lv_obj_t * obj);
/**
* Checks if the content is scrolled "in" and adjusts it to a normal position.
* @param obj pointer to Widget
* @param anim_en LV_ANIM_ON/OFF
*/
void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_SCROLL_H*/
+443
View File
@@ -0,0 +1,443 @@
/**
* @file lv_obj_style.h
*
*/
#ifndef LV_OBJ_STYLE_H
#define LV_OBJ_STYLE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../font/lv_bidi.h"
#include "lv_style.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Possible states of a widget.
* OR-ed values are possible
*/
typedef enum {
LV_STATE_DEFAULT = 0,
LV_STATE_ALT = 1 << 0,
/*1 reserved*/
LV_STATE_CHECKED = 1 << 2,
LV_STATE_FOCUSED = 1 << 3,
LV_STATE_FOCUS_KEY = 1 << 4,
LV_STATE_EDITED = 1 << 5,
LV_STATE_HOVERED = 1 << 6,
LV_STATE_PRESSED = 1 << 7,
LV_STATE_SCROLLED = 1 << 8,
LV_STATE_DISABLED = 1 << 9,
/*2 reserved*/
LV_STATE_USER_1 = 1 << 12,
LV_STATE_USER_2 = 1 << 13,
LV_STATE_USER_3 = 1 << 14,
LV_STATE_USER_4 = 1 << 15,
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
} lv_state_t;
/**
* The possible parts of widgets.
* The parts can be considered as the internal building block of the widgets.
* E.g. slider = background + indicator + knob
* Not all parts are used by every widget
*/
typedef enum {
LV_PART_MAIN = 0x000000, /**< A background like rectangle*/
LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/
LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/
LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/
LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/
LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/
LV_PART_CURSOR = 0x060000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/
LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/
LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/
} lv_part_t;
typedef enum {
LV_STYLE_STATE_CMP_SAME, /**< The style properties in the 2 states are identical */
LV_STYLE_STATE_CMP_DIFF_REDRAW, /**< The differences can be shown with a simple redraw */
LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /**< The differences can be shown with a simple redraw */
LV_STYLE_STATE_CMP_DIFF_LAYOUT, /**< The differences can be shown with a simple redraw */
} lv_style_state_cmp_t;
/**
* A joint type for `lv_part_t` and `lv_state_t`. Example values
* - `0`: means `LV_PART_MAIN | LV_STATE_DEFAULT`
* - `LV_STATE_PRSSED`
* - `LV_PART_KNOB`
* - `LV_PART_KNOB | LV_STATE_PRESSED | LV_STATE_CHECKED`
*/
typedef uint32_t lv_style_selector_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Add a style to an object.
* @param obj pointer to an object
* @param style pointer to a style to add
* @param selector OR-ed value of parts and state to which the style should be added
*
* Examples:
* @code
* lv_obj_add_style(btn, &style_btn, 0); //Default button style
*
* lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed
* @endcode
*/
void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/**
* Replaces a style of an object, preserving the order of the style stack (local styles and transitions are ignored).
* @param obj pointer to an object
* @param old_style pointer to a style to replace.
* @param new_style pointer to a style to replace the old style with.
* @param selector OR-ed values of states and a part to replace only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used
*
* Examples:
* @code
* lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_ANY | LV_STATE_ANY); //Replace a specific style
*
* lv_obj_replace_style(obj, &yellow_style, &blue_style, LV_PART_MAIN | LV_STATE_PRESSED); //Replace a specific style assigned to the main part when it is pressed
* @endcode
*/
bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv_style_t * new_style,
lv_style_selector_t selector);
/**
* Remove a style from an object.
* @param obj pointer to an object
* @param style pointer to a style to remove. Can be NULL to check only the selector
* @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used
*
* Examples:
* @code
* lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style
*
* lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part
*
* lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles
* @endcode
*/
void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/**
* Remove all styles added by a theme from a widget
* @param selector OR-ed values of states and a part to remove only styles with matching selectors.
* LV_STATE_ANY and LV_PART_ANY can be used
* @param obj pointer to a widget
*/
void lv_obj_remove_theme(lv_obj_t * obj, lv_style_selector_t selector);
/**
* Remove all styles from an object
* @param obj pointer to an object
*/
void lv_obj_remove_style_all(lv_obj_t * obj);
/**
* Notify all object if a style is modified
* @param style pointer to a style. Only the objects with this style will be notified
* (NULL to notify all objects)
*/
void lv_obj_report_style_change(lv_style_t * style);
/**
* Notify an object and its children about its style is modified.
* @param obj pointer to an object
* @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN`
* @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property.
* It is used to optimize what needs to be refreshed.
* `LV_STYLE_PROP_INV` to perform only a style cache update
*/
void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
/**
* Temporary disable a style for a selector. It will look like is the style wasn't added
* @param obj pointer to an object
* @param style pointer to a style
* @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB)
* @param dis true: disable the style, false: enable the style
*/
void lv_obj_style_set_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector, bool dis);
/**
* Get if a given style is disabled on an object.
* @param obj pointer to an object
* @param style pointer to a style
* @param selector the selector of a style (e.g. LV_STATE_PRESSED | LV_PART_KNOB)
* @return true: disable the style, false: enable the style
*/
bool lv_obj_style_get_disabled(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/**
* Enable or disable automatic style refreshing when a new style is added/removed to/from an object
* or any other style change happens.
* @param en true: enable refreshing; false: disable refreshing
*/
void lv_obj_enable_style_refresh(bool en);
/**
* Get the value of a style property. The current state of the object will be considered.
* Inherited properties will be inherited.
* If a property is not set a default value will be returned.
* @param obj pointer to an object
* @param part a part from which the property should be get
* @param prop the property to get
* @return the value of the property.
* Should be read from the correct field of the `lv_style_value_t` according to the type of the property.
*/
lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
/**
* Check if an object has a specified style property for a given style selector.
* @param obj pointer to an object
* @param selector the style selector to be checked, defining the scope of the style to be examined.
* @param prop the property to be checked.
* @return true if the object has the specified selector and property, false otherwise.
*/
bool lv_obj_has_style_prop(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop);
/**
* Set local style property on an object's part and state.
* @param obj pointer to an object
* @param prop the property
* @param value value of the property. The correct element should be set according to the type of the property
* @param selector OR-ed value of parts and state for which the style should be set
*/
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
lv_style_selector_t selector);
lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
lv_style_selector_t selector);
/**
* Remove a local style property from a part of an object with a given state.
* @param obj pointer to an object
* @param prop a style property to remove.
* @param selector OR-ed value of parts and state for which the style should be removed
* @return true the property was found and removed; false: the property was not found
*/
bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
/**
* Used internally for color filtering
*/
lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v);
/**
* Fade in an an object and all its children.
* @param obj the object to fade in
* @param time time of fade
* @param delay delay to start the animation
*/
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
/**
* Fade out an an object and all its children.
* @param obj the object to fade out
* @param time time of fade
* @param delay delay to start the animation
*/
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
static inline lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector)
{
return (lv_state_t)(selector & 0xFFFF);
}
static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector)
{
return (lv_part_t)(selector & 0xFF0000);
}
#include "lv_obj_style_gen.h"
static inline void lv_obj_set_style_pad_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_pad_left(obj, value, selector);
lv_obj_set_style_pad_right(obj, value, selector);
lv_obj_set_style_pad_top(obj, value, selector);
lv_obj_set_style_pad_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_pad_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_pad_left(obj, value, selector);
lv_obj_set_style_pad_right(obj, value, selector);
}
static inline void lv_obj_set_style_pad_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_pad_top(obj, value, selector);
lv_obj_set_style_pad_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_margin_all(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_margin_left(obj, value, selector);
lv_obj_set_style_margin_right(obj, value, selector);
lv_obj_set_style_margin_top(obj, value, selector);
lv_obj_set_style_margin_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_margin_hor(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_margin_left(obj, value, selector);
lv_obj_set_style_margin_right(obj, value, selector);
}
static inline void lv_obj_set_style_margin_ver(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_margin_top(obj, value, selector);
lv_obj_set_style_margin_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_pad_gap(lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_obj_set_style_pad_row(obj, value, selector);
lv_obj_set_style_pad_column(obj, value, selector);
}
static inline void lv_obj_set_style_size(lv_obj_t * obj, int32_t width, int32_t height,
lv_style_selector_t selector)
{
lv_obj_set_style_width(obj, width, selector);
lv_obj_set_style_height(obj, height, selector);
}
static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t value,
lv_style_selector_t selector)
{
lv_obj_set_style_transform_scale_x(obj, value, selector);
lv_obj_set_style_transform_scale_y(obj, value, selector);
}
static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_left(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part);
return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_right(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part);
return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_top(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part);
return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding;
}
static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part)
{
int32_t padding = lv_obj_get_style_pad_bottom(obj, part);
int32_t border_width = lv_obj_get_style_border_width(obj, part);
lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part);
return (border_side & LV_BORDER_SIDE_BOTTOM) ? padding + border_width : padding;
}
lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt);
static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part)
{
int32_t scale = lv_obj_get_style_transform_scale_x(obj, part);
return scale > 0 ? scale : 1;
}
static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part)
{
int32_t scale = lv_obj_get_style_transform_scale_y(obj, part);
return scale > 0 ? scale : 1;
}
/**
* Get the `opa` style property from all parents and multiply and `>> 8` them.
* @param obj the object whose opacity should be get
* @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of the MAIN part too
* @return the final opacity considering the parents' opacity too
*/
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part);
/**
* Apply recolor effect to the input color based on the object's style properties.
* @param obj the target object containing recolor style properties
* @param part the part to retrieve recolor styles.
* @param color the original color to be modified
* @return the blended color after applying recolor and opacity
*/
lv_color32_t lv_obj_style_apply_recolor(const lv_obj_t * obj, lv_part_t part, lv_color32_t color);
/**
* Get the `recolor` style property from all parents and blend them recursively.
* @param obj the object whose recolor value should be retrieved
* @param part the target part to check. Non-MAIN parts will also consider
* the `recolor` value from the MAIN part during calculation
* @return the final blended recolor value combining all parent's recolor values
*/
lv_color32_t lv_obj_get_style_recolor_recursive(const lv_obj_t * obj, lv_part_t part);
#if LV_USE_OBSERVER
/**
* Disable a style if a subject's value is not equal to a reference value
* @param obj pointer to Widget
* @param style pointer to a style
* @param selector pointer to a selector
* @param subject pointer to Subject
* @param ref_value reference value to compare Subject's value with
* @return pointer to newly-created Observer
*/
lv_observer_t * lv_obj_bind_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector,
lv_subject_t * subject, int32_t ref_value);
/**
* Connect a subject's value to a style property of a widget.
* @param obj pointer to a Widget
* @param prop a style property
* @param selector a selector for which the property should be added, e.g. `LV_PART_KNOB | LV_STATE_PRESSED`
* @param subject pointer a Subject to which value the property should be bound
* @return pointer to newly-created Observer
*/
lv_observer_t * lv_obj_bind_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector,
lv_subject_t * subject);
#endif
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_STYLE_H*/
File diff suppressed because it is too large Load Diff
+321
View File
@@ -0,0 +1,321 @@
/**
* @file lv_obj_tree.h
*
*/
#ifndef LV_OBJ_TREE_H
#define LV_OBJ_TREE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_types.h"
#include "lv_anim.h"
#include "../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_OBJ_TREE_WALK_NEXT,
LV_OBJ_TREE_WALK_SKIP_CHILDREN,
LV_OBJ_TREE_WALK_END,
} lv_obj_tree_walk_res_t;
typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Delete an object and all of its children.
* Also remove the objects from their group and remove all animations (if any).
* Send `LV_EVENT_DELETE` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_delete(lv_obj_t * obj);
/**
* Delete all children of an object.
* Also remove the objects from their group and remove all animations (if any).
* Send `LV_EVENT_DELETE` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_clean(lv_obj_t * obj);
/**
* Delete an object after some delay
* @param obj pointer to an object
* @param delay_ms time to wait before delete in milliseconds
*/
void lv_obj_delete_delayed(lv_obj_t * obj, uint32_t delay_ms);
/**
* A function to be easily used in animation ready callback to delete an object when the animation is ready
* @param a pointer to the animation
*/
void lv_obj_delete_anim_completed_cb(lv_anim_t * a);
/**
* Helper function for asynchronously deleting objects.
* Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).
* @param obj object to delete
* @see lv_async_call
*/
void lv_obj_delete_async(lv_obj_t * obj);
/**
* Move the parent of an object. The relative coordinates will be kept.
*
* @param obj pointer to an object whose parent needs to be changed
* @param parent pointer to the new parent
*/
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
/**
* Swap the positions of two objects.
* When used in listboxes, it can be used to sort the listbox items.
* @param obj1 pointer to the first object
* @param obj2 pointer to the second object
*/
void lv_obj_swap(lv_obj_t * obj1, lv_obj_t * obj2);
/**
* moves the object to the given index in its parent.
* When used in listboxes, it can be used to sort the listbox items.
* @param obj pointer to the object to be moved.
* @param index new index in parent. -1 to count from the back
* @note to move to the background: lv_obj_move_to_index(obj, 0)
* @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)
*/
void lv_obj_move_to_index(lv_obj_t * obj, int32_t index);
/**
* Get the screen of an object
* @param obj pointer to an object
* @return pointer to the object's screen
*/
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
/**
* Get the display of the object
* @param obj pointer to an object
* @return pointer to the object's display
*/
lv_display_t * lv_obj_get_display(const lv_obj_t * obj);
/**
* Get the parent of an object
* @param obj pointer to an object
* @return the parent of the object. (NULL if `obj` was a screen)
*/
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj);
/**
* Get the child of an object by the child's index.
* @param obj pointer to an object whose child should be get
* @param idx 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 pointer to the child or NULL if the index was invalid
*/
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t idx);
/**
* Get the child of an object by the child's index. Consider the children only with a given type.
* @param obj pointer to an object whose child should be get
* @param idx 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
* @param class_p the type of the children to check
* @return pointer to the child or NULL if the index was invalid
*/
lv_obj_t * lv_obj_get_child_by_type(const lv_obj_t * obj, int32_t idx,
const lv_obj_class_t * class_p);
/**
* Return a sibling of an object
* @param obj pointer to an object whose sibling should be get
* @param idx 0: `obj` itself
* -1: the first older sibling
* -2: the next older sibling
* 1: the first younger sibling
* 2: the next younger sibling
* etc
* @return pointer to the requested sibling or NULL if there is no such sibling
*/
lv_obj_t * lv_obj_get_sibling(const lv_obj_t * obj, int32_t idx);
/**
* Return a sibling of an object. Consider the siblings only with a given type.
* @param obj pointer to an object whose sibling should be get
* @param idx 0: `obj` itself
* -1: the first older sibling
* -2: the next older sibling
* 1: the first younger sibling
* 2: the next younger sibling
* etc
* @param class_p the type of the children to check
* @return pointer to the requested sibling or NULL if there is no such sibling
*/
lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t * obj, int32_t idx,
const lv_obj_class_t * class_p);
/**
* Get the number of children
* @param obj pointer to an object
* @return the number of children
*/
uint32_t lv_obj_get_child_count(const lv_obj_t * obj);
/**
* Get the number of children having a given type.
* @param obj pointer to an object
* @param class_p the type of the children to check
* @return the number of children
*/
uint32_t lv_obj_get_child_count_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p);
#if LV_USE_OBJ_NAME
/**
* Set a name for a widget. The name will be allocated and freed when the
* widget is deleted or a new name is set.
* @param obj pointer to an object
* @param name the name to set. If set to `NULL` the default "<widget_type>_#"
* name will be used.
* @note If the name ends with a `#`, older siblings with the same name
* will be counted, and the `#` will be replaced by the index of the
* given widget. For example, creating multiple widgets with the name
* "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1",
* "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved`
* is called, so the result reflects the currently existing widgets at
* that time.
*/
void lv_obj_set_name(lv_obj_t * obj, const char * name);
/**
* Set a name for a widget. Only a pointer will be saved.
* @param obj pointer to an object
* @param name the name to set. If set to `NULL` the default "<widget_type>_#"
* name will be used.
* @note If the name ends with a `#`, older siblings with the same name
* will be counted, and the `#` will be replaced by the index of the
* given widget. For example, creating multiple widgets with the name
* "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1",
* "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved`
* is called, so the result reflects the currently existing widgets at
* that time.
*/
void lv_obj_set_name_static(lv_obj_t * obj, const char * name);
/**
* Get the set name as it was set.
* @param obj pointer to an object
* @return get the set name or NULL if it wasn't set yet
*/
const char * lv_obj_get_name(const lv_obj_t * obj);
/**
* Get the set name or craft a name automatically.
* @param obj pointer to an object
* @param buf buffer to store the name
* @param buf_size the size of the buffer in bytes
* @note If the name ends with a `#`, older siblings with the same name
* will be counted, and the `#` will be replaced by the index of the
* given widget. For example, creating multiple widgets with the name
* "mybtn_#" will result in resolved names like "mybtn_0", "mybtn_1",
* "mybtn_2", etc. The name is resolved when `lv_obj_get_name_resolved`
* is called, so the result reflects the currently existing widgets at
* that time.
*/
void lv_obj_get_name_resolved(const lv_obj_t * obj, char buf[], size_t buf_size);
/**
* Find a child with a given name on a parent. This child doesn't have to be the
* direct child of the parent. First direct children of the parent will be checked,
* and the direct children of the first child, etc. (Breadth-first search).
*
* If the name of a widget was not set a name like "lv_button_1" will
* be created for it using `lv_obj_get_name_resolved`.
*
* @param parent the widget where the search should start
* @return the found widget or NULL if not found.
*/
lv_obj_t * lv_obj_find_by_name(const lv_obj_t * parent, const char * name);
/**
* Get an object by name. The name can be a path too, for example
* "main_container/lv_button_1/label".
* In this case the first part of the name-path should be the direct child of the parent,
* the second part, should the direct child of first one, etc.
*
* If the name of a widget was not set a name like "lv_button_1" will
* be created for it using `lv_obj_get_name_resolved`.
*
* @param parent the widget where the search should start
* @return the found widget or NULL if not found.
*/
lv_obj_t * lv_obj_get_child_by_name(const lv_obj_t * parent, const char * name_path);
#endif /*LV_USE_OBJ_NAME*/
/**
* Get the index of a child.
* @param obj pointer to an object
* @return the child index of the object.
* E.g. 0: the oldest (firstly created child).
* (-1 if child could not be found or no parent exists)
*/
int32_t lv_obj_get_index(const lv_obj_t * obj);
/**
* Get the index of a child. Consider the children only with a given type.
* @param obj pointer to an object
* @param class_p the type of the children to check
* @return the child index of the object.
* E.g. 0: the oldest (firstly created child with the given class).
* (-1 if child could not be found or no parent exists)
*/
int32_t lv_obj_get_index_by_type(const lv_obj_t * obj, const lv_obj_class_t * class_p);
/**
* Iterate through all children of any object.
* @param start_obj start integrating from this object
* @param cb call this callback on the objects
* @param user_data pointer to any user related data (will be passed to `cb`)
*/
void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data);
/**
* Iterate through all children of any object and print their ID.
* @param start_obj start integrating from this object
*/
void lv_obj_dump_tree(lv_obj_t * start_obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_TREE_H*/
File diff suppressed because it is too large Load Diff
+74
View File
@@ -0,0 +1,74 @@
/**
* @file lv_refr.h
*
*/
#ifndef LV_REFR_H
#define LV_REFR_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../display/lv_display.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Redraw the invalidated areas now.
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
* can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process
* (e.g. progress bar) this function can be called when the screen should be updated.
* @param disp pointer to display to refresh. NULL to refresh all displays.
*/
void lv_refr_now(lv_display_t * disp);
/**
* Redrawn on object and all its children using the passed draw context
* @param layer pointer to a layer where to draw.
* @param obj the start object from the redraw should start
*/
void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj);
/**
* Called periodically to handle the refreshing
* @param timer pointer to the timer itself, or `NULL`
*/
void lv_display_refr_timer(lv_timer_t * timer);
/**********************
* STATIC FUNCTIONS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_REFR_H*/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+149
View File
@@ -0,0 +1,149 @@
/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_style_properties.h
*/
#ifndef LV_STYLE_PROPERTIES_H
#define LV_STYLE_PROPERTIES_H
#include "../config/lv_conf_internal.h"
#if LV_USE_OBJ_PROPERTY
/* *INDENT-OFF* */
enum _lv_property_style_id_t {
LV_PROPERTY_ID(STYLE, ALIGN, LV_PROPERTY_TYPE_INT, LV_STYLE_ALIGN),
LV_PROPERTY_ID(STYLE, ANIM, LV_PROPERTY_TYPE_POINTER, 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_COLOR, LV_STYLE_ARC_COLOR),
LV_PROPERTY_ID(STYLE, ARC_IMAGE_SRC, LV_PROPERTY_TYPE_IMGSRC, 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_POINTER, 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_POINTER, LV_STYLE_BITMAP_MASK_SRC),
LV_PROPERTY_ID(STYLE, BLEND_MODE, LV_PROPERTY_TYPE_INT, LV_STYLE_BLEND_MODE),
LV_PROPERTY_ID(STYLE, BLUR_BACKDROP, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_BACKDROP),
LV_PROPERTY_ID(STYLE, BLUR_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_QUALITY),
LV_PROPERTY_ID(STYLE, BLUR_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_BLUR_RADIUS),
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_POINTER, 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, DROP_SHADOW_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_DROP_SHADOW_COLOR),
LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_X, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_X),
LV_PROPERTY_ID(STYLE, DROP_SHADOW_OFFSET_Y, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OFFSET_Y),
LV_PROPERTY_ID(STYLE, DROP_SHADOW_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_OPA),
LV_PROPERTY_ID(STYLE, DROP_SHADOW_QUALITY, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_QUALITY),
LV_PROPERTY_ID(STYLE, DROP_SHADOW_RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_DROP_SHADOW_RADIUS),
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_POINTER, 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_POINTER, LV_STYLE_GRID_ROW_DSC_ARRAY),
LV_PROPERTY_ID(STYLE, HEIGHT, LV_PROPERTY_TYPE_INT, LV_STYLE_HEIGHT),
LV_PROPERTY_ID(STYLE, IMAGE_COLORKEY, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_COLORKEY),
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_INVALID, 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_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_PAD_RADIAL),
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_INVALID, LV_STYLE_PROP_INV),
LV_PROPERTY_ID(STYLE, RADIAL_OFFSET, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIAL_OFFSET),
LV_PROPERTY_ID(STYLE, RADIUS, LV_PROPERTY_TYPE_INT, LV_STYLE_RADIUS),
LV_PROPERTY_ID(STYLE, RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_RECOLOR),
LV_PROPERTY_ID(STYLE, RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_RECOLOR_OPA),
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_LEADING_TRIM, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_LEADING_TRIM),
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, TEXT_OUTLINE_STROKE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_TEXT_OUTLINE_STROKE_COLOR),
LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_OPA),
LV_PROPERTY_ID(STYLE, TEXT_OUTLINE_STROKE_WIDTH, LV_PROPERTY_TYPE_INT, LV_STYLE_TEXT_OUTLINE_STROKE_WIDTH),
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_POINTER, LV_STYLE_TRANSITION),
LV_PROPERTY_ID(STYLE, TRANSLATE_RADIAL, LV_PROPERTY_TYPE_INT, LV_STYLE_TRANSLATE_RADIAL),
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
+221
View File
@@ -0,0 +1,221 @@
/**
* @file lv_timer.h
*/
#ifndef LV_TIMER_H
#define LV_TIMER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
#ifndef LV_ATTRIBUTE_TIMER_HANDLER
#define LV_ATTRIBUTE_TIMER_HANDLER
#endif
#define LV_NO_TIMER_READY 0xFFFFFFFF
/**********************
* TYPEDEFS
**********************/
/**
* Timers execute this type of functions.
*/
typedef void (*lv_timer_cb_t)(lv_timer_t *);
/**
* Timer handler resume this type of function.
*/
typedef void (*lv_timer_handler_resume_cb_t)(void * data);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Call it periodically to handle lv_timers.
* @return time till it needs to be run next (in ms)
*/
LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void);
/**
* Call it in the super-loop of main() or threads. It will run lv_timer_handler()
* with a given period in ms. You can use it with sleep or delay in OS environment.
* This function is used to simplify the porting.
* @param period the period for running lv_timer_handler()
* @return the time after which it must be called again
*/
LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period);
/**
* Call it in the super-loop of main() or threads. It will automatically call lv_timer_handler() at the right time.
* This function is used to simplify the porting.
*/
LV_ATTRIBUTE_TIMER_HANDLER void lv_timer_periodic_handler(void);
/**
* Set the resume callback to the timer handler
* @param cb the function to call when timer handler is resumed
* @param data pointer to a resume data
*/
void lv_timer_handler_set_resume_cb(lv_timer_handler_resume_cb_t cb, void * data);
/**
* Create an "empty" timer. It needs to be initialized with at least
* `lv_timer_set_cb` and `lv_timer_set_period`
* @return pointer to the created timer
*/
lv_timer_t * lv_timer_create_basic(void);
/**
* Create a new lv_timer
* @param timer_xcb a callback to call periodically.
* (the 'x' in the argument name indicates that it's not a fully generic function because it not follows
* the `func_name(object, callback, ...)` convention)
* @param period call period in ms unit
* @param user_data custom parameter
* @return pointer to the new timer
*/
lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data);
/**
* Delete a lv_timer
* @param timer pointer to an lv_timer
*/
void lv_timer_delete(lv_timer_t * timer);
/**
* Pause a timer.
* It is typically safe to call from an interrupt handler or a different thread.
* @param timer pointer to an lv_timer
*/
void lv_timer_pause(lv_timer_t * timer);
/**
* Resume a timer.
* @param timer pointer to an lv_timer
*/
void lv_timer_resume(lv_timer_t * timer);
/**
* Set the callback to the timer (the function to call periodically)
* @param timer pointer to a timer
* @param timer_cb the function to call periodically
*/
void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb);
/**
* Set new period for a lv_timer
* @param timer pointer to a lv_timer
* @param period the new period
*/
void lv_timer_set_period(lv_timer_t * timer, uint32_t period);
/**
* Make a lv_timer ready. It will not wait its period.
* @param timer pointer to a lv_timer.
*/
void lv_timer_ready(lv_timer_t * timer);
/**
* Set the number of times a timer will repeat.
* @param timer pointer to a lv_timer.
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
*/
void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count);
/**
* Set whether a lv_timer will be deleted automatically when it is called `repeat_count` times.
* @param timer pointer to a lv_timer.
* @param auto_delete true: auto delete; false: timer will be paused when it is called `repeat_count` times.
*/
void lv_timer_set_auto_delete(lv_timer_t * timer, bool auto_delete);
/**
* Set custom parameter to the lv_timer.
* @param timer pointer to a lv_timer.
* @param user_data custom parameter
*/
void lv_timer_set_user_data(lv_timer_t * timer, void * user_data);
/**
* Reset a lv_timer.
* It will be called the previously set period milliseconds later.
* @param timer pointer to a lv_timer.
*/
void lv_timer_reset(lv_timer_t * timer);
/**
* Enable or disable the whole lv_timer handling
* @param en true: lv_timer handling is running, false: lv_timer handling is suspended
*/
void lv_timer_enable(bool en);
/**
* Get idle percentage
* @return the lv_timer idle in percentage
*/
uint32_t lv_timer_get_idle(void);
/**
* Get the time remaining until the next timer will run
* @return the time remaining in ms
*/
uint32_t lv_timer_get_time_until_next(void);
/**
* Iterate through the timers
* @param timer NULL to start iteration or the previous return value to get the next timer
* @return the next timer or NULL if there is no more timer
*/
lv_timer_t * lv_timer_get_next(lv_timer_t * timer);
/**
* Get the user_data passed when the timer was created
* @param timer pointer to the lv_timer
* @return pointer to the user_data
*/
void * lv_timer_get_user_data(lv_timer_t * timer);
/**
* Get the pause state of a timer
* @param timer pointer to a lv_timer
* @return true: timer is paused; false: timer is running
*/
bool lv_timer_get_paused(lv_timer_t * timer);
#if LV_USE_EXT_DATA
/**
* @brief Attaches external user data and destructor callback to a timer object
*
* Associates custom user data with an LVGL timer and specifies a destructor function
* that will be automatically invoked when the timer is deleted to properly clean up
* the associated resources.
*
* @param timer Pointer to the timer object
* @param data User-defined data pointer to associate with the timer
* @param destructor Callback function for cleaning up ext_data when timer is deleted.
* Receives ext_data as parameter. NULL means no cleanup required.
*/
void lv_timer_set_external_data(lv_timer_t * timer, void * data, void (* free_cb)(void * data));
#endif
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
+147
View File
@@ -0,0 +1,147 @@
/**
* @file lv_translation.h
*
*/
#ifndef LV_TRANSLATION_H
#define LV_TRANSLATION_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_TRANSLATION
#include LV_STDINT_INCLUDE
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the translation module
*/
void lv_translation_init(void);
/**
* De-initialize the translation module and free all allocated translations
*/
void lv_translation_deinit(void);
/**
* Register a translation pack from static arrays.
* All the pointers need to be static, that is to live while they are used
* @param languages List of languages. E.g. `{"en", "de", NULL}`
* @param tags Tags that are using in the UI. E.g. `{"dog", "cat", NULL}`
* @param translations List of translations. E.g. `{"Dog", "Cat", "Hund", "Katze"}`
* @return The created pack
*/
lv_translation_pack_t * lv_translation_add_static(const char * const languages[], const char * const tags[],
const char * const translations[]);
/**
* Add a pack to which translations can be added dynamically.
* `pack->languages` needs to be a malloc-ed array where each language is also malloc-ed as an element.
* `pack->translation_array` stores the translation having `lv_translation_tag_dsc_t` items
* In each array element `tag` is a malloced string, `translations` is a malloc-ed array
* with malloc-ed array for each element.
* @return the created pack to which data can be added manually.
*/
lv_translation_pack_t * lv_translation_add_dynamic(void);
/**
* Select the current language
* The `LV_EVENT_TRANSLATION_LANGUAGE_CHANGED` event will be sent to every widget
* @param lang a string from the defined languages. E.g. "en" or "de"
*/
void lv_translation_set_language(const char * lang);
/**
* Get the current selected language
* @return the current selected language
*/
const char * lv_translation_get_language(void);
/**
* Get the translated version of a tag on the selected language
* @param tag the tag to translate
* @return the translation
* @note fallback rules:
* - if the tag is found on the selected language return it
* - if the tag is not found on the selected language, use the fist language
* - if the tag is not found on the first language, return the tag
*/
const char * lv_translation_get(const char * tag);
/**
* Shorthand of lv_translation_set_language
* @param tag the tag to translate
* @return the translation
*/
static inline const char * lv_tr(const char * tag)
{
return lv_translation_get(tag);
}
/**
* Add a new language to a dynamic language pack.
* All languages should be added before adding tags
* @param pack pointer to a dynamic translation pack
* @param lang language to add, e.g. "en", or "de"
* @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed
*/
lv_result_t lv_translation_add_language(lv_translation_pack_t * pack, const char * lang);
/**
* Get the index of a language in a pack.
* @param pack pointer to a static or dynamic language pack
* @param lang_name name of the language to find
* @return index of the language or -1 if not found.
*/
int32_t lv_translation_get_language_index(lv_translation_pack_t * pack, const char * lang_name);
/**
* Add a new tag to a dynamic language pack.
* Once the tag is added the translations for each language can be added too by using
* `lv_translation_set_tag_translation`
* @param pack pointer to a dynamic translation pack
* @param tag_name name of the tag, e.g. "dog", or "house"
* @return pointer to the allocated tag descriptor
*/
lv_translation_tag_dsc_t * lv_translation_add_tag(lv_translation_pack_t * pack, const char * tag_name);
/**
* Add a translation to a tag in a dynamic translation pack
* @param pack pointer to a dynamic translation pack
* @param tag return value of `lv_translation_add_tag`
* @param lang_idx index of the language for which translation should be set
* @param trans the translation on the given language
* @return LV_RESULT_OK: success, LV_RESULT_INVALID: failed
*/
lv_result_t lv_translation_set_tag_translation(lv_translation_pack_t * pack, lv_translation_tag_dsc_t * tag,
uint32_t lang_idx, const char * trans);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TRANSLATION*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TRANSLATION_H*/
+87
View File
@@ -0,0 +1,87 @@
/**
* @file lv_assert.h
*
*/
#ifndef LV_ASSERT_H
#define LV_ASSERT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../logging/lv_log.h"
#include "../stdlib/lv_mem.h"
#include LV_ASSERT_HANDLER_INCLUDE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#define LV_ASSERT(expr) \
do { \
if(!(expr)) { \
LV_LOG_ERROR("Asserted at expression: %s", #expr); \
LV_ASSERT_HANDLER \
} \
} while(0)
#define LV_ASSERT_MSG(expr, msg) \
do { \
if(!(expr)) { \
LV_LOG_ERROR("Asserted at expression: %s (%s)", #expr, msg); \
LV_ASSERT_HANDLER \
} \
} while(0)
#define LV_ASSERT_FORMAT_MSG(expr, format, ...) \
do { \
if(!(expr)) { \
LV_LOG_ERROR("Asserted at expression: %s " format , #expr, __VA_ARGS__); \
LV_ASSERT_HANDLER \
} \
} while(0)
/*-----------------
* ASSERTS
*-----------------*/
#if LV_USE_ASSERT_NULL
# define LV_ASSERT_NULL(p) LV_ASSERT_MSG(p != NULL, "NULL pointer");
#else
# define LV_ASSERT_NULL(p)
#endif
#if LV_USE_ASSERT_MALLOC
# define LV_ASSERT_MALLOC(p) LV_ASSERT_MSG(p != NULL, "Out of memory");
#else
# define LV_ASSERT_MALLOC(p)
#endif
#if LV_USE_ASSERT_MEM_INTEGRITY
# define LV_ASSERT_MEM_INTEGRITY() LV_ASSERT_MSG(lv_mem_test() == LV_RESULT_OK, "Memory integrity error");
#else
# define LV_ASSERT_MEM_INTEGRITY()
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ASSERT_H*/
+109
View File
@@ -0,0 +1,109 @@
/**
* @file lv_check_arg.h
*
*/
#ifndef LV_CHECK_ARG_H
#define LV_CHECK_ARG_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../logging/lv_log.h"
#include "lv_assert.h"
/*********************
* DEFINES
*********************/
#if defined(__GNUC__) || defined(__clang__)
#define LV_LIKELY(x) (__builtin_expect(!!(x), 1))
#define LV_UNLIKELY(x) (__builtin_expect(!!(x), 0))
#else
#define LV_LIKELY(x) (x)
#define LV_UNLIKELY(x) (x)
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#if LV_USE_CHECK_ARG
#if LV_CHECK_ARG_ASSERT_ON_FAIL
/**
* Internal macro: checks a condition, logs a warning, calls the assert handler,
* and then executes the specified action on failure.
* Do not use directly; use LV_CHECK_ARG instead.
*/
#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \
if(LV_UNLIKELY(!(cond))) { \
LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \
LV_ASSERT_HANDLER \
action_on_fail; \
} else {}
#else
/**
* Internal macro: checks a condition, logs a warning, and executes the
* specified action on failure.
* Do not use directly; use LV_CHECK_ARG instead.
*/
#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) \
if(LV_UNLIKELY(!(cond))) { \
LV_LOG_WARN("Check failed: " cond_str " " __VA_ARGS__); \
action_on_fail; \
} else {}
#endif /*LV_CHECK_ARG_ASSERT_ON_FAIL*/
#else
/** LV_CHECK_ARG is disabled; all checks compile to nothing. */
#define LV_CHECK_ARG_INTERNAL_(cond, cond_str, action_on_fail, ...) ((void)0)
#endif /*LV_USE_CHECK_ARG*/
/**
* Check that a condition is true. If the condition is false, log a warning
* and execute `action_on_fail` (e.g. `return`, `return val`, `break`).
* Additional printf-style arguments are appended to the log message.
*
* Can be disabled entirely by setting LV_USE_CHECK_ARG to 0 in lv_conf.h.
* If LV_CHECK_ARG_ASSERT_ON_FAIL is 1, LV_ASSERT_HANDLER is also invoked
* before the action.
*
* Example:
* @code
* LV_CHECK_ARG(ptr != NULL, return, "pointer must not be NULL");
* LV_CHECK_ARG(len > 0, return -1, "len=%d", (int)len);
* @endcode
*
* @param cond condition to check
* @param action_on_fail statement to execute on failure (e.g. `return`, `return 0`, `break`)
* @param ... optional printf-style format string and arguments appended to the log
*/
#define LV_CHECK_ARG(cond, action_on_fail, ...) \
LV_CHECK_ARG_INTERNAL_(cond, #cond, action_on_fail, __VA_ARGS__)
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHECK_ARG_H*/
+119
View File
@@ -0,0 +1,119 @@
/**
* @file lv_monkey.h
*
*/
#ifndef LV_MONKEY_H
#define LV_MONKEY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#include "../indev/lv_indev.h"
#if LV_USE_MONKEY
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct _lv_monkey_t lv_monkey_t;
typedef struct {
int32_t min;
int32_t max;
} lv_range_t;
typedef struct {
uint32_t min;
uint32_t max;
} lv_urange_t;
struct _lv_monkey_config_t {
/** Input device type */
lv_indev_type_t type;
/** Monkey execution period */
lv_urange_t period_range;
/** The range of input value */
lv_range_t input_range;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize a monkey config with default values
* @param config pointer to 'lv_monkey_config_t' variable to initialize
*/
void lv_monkey_config_init(lv_monkey_config_t * config);
/**
* Create monkey for test
* @param config pointer to 'lv_monkey_config_t' variable
* @return pointer to the created monkey
*/
lv_monkey_t * lv_monkey_create(const lv_monkey_config_t * config);
/**
* Get monkey input device
* @param monkey pointer to a monkey
* @return pointer to the input device
*/
lv_indev_t * lv_monkey_get_indev(lv_monkey_t * monkey);
/**
* Enable monkey
* @param monkey pointer to a monkey
* @param en set to true to enable
*/
void lv_monkey_set_enable(lv_monkey_t * monkey, bool en);
/**
* Get whether monkey is enabled
* @param monkey pointer to a monkey
* @return return true if monkey enabled
*/
bool lv_monkey_get_enable(lv_monkey_t * monkey);
/**
* Set the user_data field of the monkey
* @param monkey pointer to a monkey
* @param user_data pointer to the new user_data.
*/
void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data);
/**
* Get the user_data field of the monkey
* @param monkey pointer to a monkey
* @return the pointer to the user_data of the monkey
*/
void * lv_monkey_get_user_data(lv_monkey_t * monkey);
/**
* Delete monkey
* @param monkey pointer to monkey
*/
void lv_monkey_delete(lv_monkey_t * monkey);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MONKEY*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MONKEY_H*/
+184
View File
@@ -0,0 +1,184 @@
/**
* @file lv_profiler.h
*
*/
#ifndef LV_PROFILER_H
#define LV_PROFILER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_PROFILER
#include LV_PROFILER_INCLUDE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#else
#define LV_PROFILER_BEGIN
#define LV_PROFILER_END
#define LV_PROFILER_BEGIN_TAG(tag) LV_UNUSED(tag)
#define LV_PROFILER_END_TAG(tag) LV_UNUSED(tag)
#endif /*LV_USE_PROFILER*/
#if LV_USE_PROFILER && LV_PROFILER_LAYOUT
#define LV_PROFILER_LAYOUT_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_LAYOUT_END LV_PROFILER_END
#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_LAYOUT_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_LAYOUT_BEGIN
#define LV_PROFILER_LAYOUT_END
#define LV_PROFILER_LAYOUT_BEGIN_TAG(tag)
#define LV_PROFILER_LAYOUT_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_STYLE
#define LV_PROFILER_STYLE_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_STYLE_END LV_PROFILER_END
#define LV_PROFILER_STYLE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_STYLE_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_STYLE_BEGIN
#define LV_PROFILER_STYLE_END
#define LV_PROFILER_STYLE_BEGIN_TAG(tag)
#define LV_PROFILER_STYLE_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_DRAW
#define LV_PROFILER_DRAW_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_DRAW_END LV_PROFILER_END
#define LV_PROFILER_DRAW_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_DRAW_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_DRAW_BEGIN
#define LV_PROFILER_DRAW_END
#define LV_PROFILER_DRAW_BEGIN_TAG(tag)
#define LV_PROFILER_DRAW_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_DECODER
#define LV_PROFILER_DECODER_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_DECODER_END LV_PROFILER_END
#define LV_PROFILER_DECODER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_DECODER_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_DECODER_BEGIN
#define LV_PROFILER_DECODER_END
#define LV_PROFILER_DECODER_BEGIN_TAG(tag)
#define LV_PROFILER_DECODER_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_REFR
#define LV_PROFILER_REFR_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_REFR_END LV_PROFILER_END
#define LV_PROFILER_REFR_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_REFR_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_REFR_BEGIN
#define LV_PROFILER_REFR_END
#define LV_PROFILER_REFR_BEGIN_TAG(tag)
#define LV_PROFILER_REFR_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_INDEV
#define LV_PROFILER_INDEV_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_INDEV_END LV_PROFILER_END
#define LV_PROFILER_INDEV_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_INDEV_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_INDEV_BEGIN
#define LV_PROFILER_INDEV_END
#define LV_PROFILER_INDEV_BEGIN_TAG(tag)
#define LV_PROFILER_INDEV_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_FONT
#define LV_PROFILER_FONT_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_FONT_END LV_PROFILER_END
#define LV_PROFILER_FONT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_FONT_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_FONT_BEGIN
#define LV_PROFILER_FONT_END
#define LV_PROFILER_FONT_BEGIN_TAG(tag)
#define LV_PROFILER_FONT_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_CACHE
#define LV_PROFILER_CACHE_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_CACHE_END LV_PROFILER_END
#define LV_PROFILER_CACHE_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_CACHE_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_CACHE_BEGIN
#define LV_PROFILER_CACHE_END
#define LV_PROFILER_CACHE_BEGIN_TAG(tag)
#define LV_PROFILER_CACHE_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_FS
#define LV_PROFILER_FS_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_FS_END LV_PROFILER_END
#define LV_PROFILER_FS_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_FS_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_FS_BEGIN
#define LV_PROFILER_FS_END
#define LV_PROFILER_FS_BEGIN_TAG(tag)
#define LV_PROFILER_FS_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_TIMER
#define LV_PROFILER_TIMER_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_TIMER_END LV_PROFILER_END
#define LV_PROFILER_TIMER_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_TIMER_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_TIMER_BEGIN
#define LV_PROFILER_TIMER_END
#define LV_PROFILER_TIMER_BEGIN_TAG(tag)
#define LV_PROFILER_TIMER_END_TAG(tag)
#endif
#if LV_USE_PROFILER && LV_PROFILER_EVENT
#define LV_PROFILER_EVENT_BEGIN LV_PROFILER_BEGIN
#define LV_PROFILER_EVENT_END LV_PROFILER_END
#define LV_PROFILER_EVENT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
#define LV_PROFILER_EVENT_END_TAG(tag) LV_PROFILER_END_TAG(tag)
#else
#define LV_PROFILER_EVENT_BEGIN
#define LV_PROFILER_EVENT_END
#define LV_PROFILER_EVENT_BEGIN_TAG(tag)
#define LV_PROFILER_EVENT_END_TAG(tag)
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_PROFILER_H*/
@@ -0,0 +1,85 @@
/**
* @file lv_profiler_builtin.h
*
*/
#ifndef LV_PROFILER_BUILTIN_H
#define LV_PROFILER_BUILTIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../config/lv_conf_internal.h"
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
#include "../lv_types.h"
/*********************
* DEFINES
*********************/
#define LV_PROFILER_BUILTIN_BEGIN_TAG(tag) lv_profiler_builtin_write((tag), 'B')
#define LV_PROFILER_BUILTIN_END_TAG(tag) lv_profiler_builtin_write((tag), 'E')
#define LV_PROFILER_BUILTIN_BEGIN LV_PROFILER_BUILTIN_BEGIN_TAG(__func__)
#define LV_PROFILER_BUILTIN_END LV_PROFILER_BUILTIN_END_TAG(__func__)
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Initialize the configuration of the built-in profiler
* @param config Pointer to the configuration structure of the built-in profiler
*/
void lv_profiler_builtin_config_init(lv_profiler_builtin_config_t * config);
/**
* @brief Initialize the built-in profiler with the given configuration
* @param config Pointer to the configuration structure of the built-in profiler
*/
void lv_profiler_builtin_init(const lv_profiler_builtin_config_t * config);
/**
* @brief Uninitialize the built-in profiler
*/
void lv_profiler_builtin_uninit(void);
/**
* @brief Enable or disable the built-in profiler
* @param enable true to enable the built-in profiler, false to disable
*/
void lv_profiler_builtin_set_enable(bool enable);
/**
* @brief Flush the profiling data to the console
*/
void lv_profiler_builtin_flush(void);
/**
* @brief Write the profiling data for a function with the given tag
* @param func Name of the function being profiled
* @param tag Tag to associate with the profiling data for the function
*/
void lv_profiler_builtin_write(const char * func, char tag);
/**********************
* MACROS
**********************/
#endif /*LV_USE_PROFILER_BUILTIN*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_PROFILER_BUILTIN_H*/
+113
View File
@@ -0,0 +1,113 @@
/**
* @file lv_sysmon.h
*
*/
#ifndef LV_SYSMON_H
#define LV_SYSMON_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../core/lv_timer.h"
#include "../core/lv_observer.h"
#if LV_USE_SYSMON
#if LV_USE_LABEL == 0
#error "lv_sysmon: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#if LV_USE_OBSERVER == 0
#error "lv_observer: lv_observer is required. Enable it in lv_conf.h (LV_USE_OBSERVER 1) "
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a new system monitor label
* @param disp create the sys. mon. on this display's system layer
* @return the create label
*/
lv_obj_t * lv_sysmon_create(lv_display_t * disp);
#if LV_USE_PERF_MONITOR
/**
* Show system performance monitor: CPU usage and FPS count
* @param disp target display, NULL: use the default displays
*/
void lv_sysmon_show_performance(lv_display_t * disp);
/**
* Hide system performance monitor
* @param disp target display, NULL: use the default
*/
void lv_sysmon_hide_performance(lv_display_t * disp);
/**
* Dump the FPS data recorded between the last and current dump call.
* @param disp target display, NULL: use the default
*/
void lv_sysmon_performance_dump(lv_display_t * disp);
/**
* Resume the system performance monitor.
* @param disp target display, NULL: use the default
*/
void lv_sysmon_performance_resume(lv_display_t * disp);
/**
* Pause the system performance monitor.
*
* @param disp target display, NULL: use the default
* @note When the sysmon is stopped you can use `lv_sysmon_dump_performance` to
* get performance information. See `lv_sysmon_dump_performance` for more information.
*/
void lv_sysmon_performance_pause(lv_display_t * disp);
#endif /*LV_USE_PERF_MONITOR*/
#if LV_USE_MEM_MONITOR
/**
* Show system memory monitor: used memory and the memory fragmentation
* @param disp target display, NULL: use the default displays
*/
void lv_sysmon_show_memory(lv_display_t * disp);
/**
* Hide system memory monitor
* @param disp target display, NULL: use the default displays
*/
void lv_sysmon_hide_memory(lv_display_t * disp);
#endif /*LV_USE_MEM_MONITOR*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_SYSMON*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SYSMON_H*/

Some files were not shown because too many files have changed in this diff Show More