1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/src/lv_objx/lv_preload.h

191 lines
4.5 KiB
C
Raw Normal View History

2018-06-09 08:47:09 +02:00
/**
* @file lv_preload.h
2018-06-19 09:49:58 +02:00
*
2018-06-09 08:47:09 +02:00
*/
#ifndef LV_PRELOAD_H
#define LV_PRELOAD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
2019-03-17 08:33:03 +01:00
#include "../../../lv_conf.h"
#endif
#if LV_USE_PRELOAD != 0
2018-06-09 08:47:09 +02:00
/*Testing of dependencies*/
#if LV_USE_ARC == 0
#error "lv_preload: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) "
#endif
#if LV_USE_ANIMATION == 0
#error "lv_preload: animations are required. Enable it in lv_conf.h (LV_USE_ANIMATION 1) "
#endif
2018-06-09 08:47:09 +02:00
#include "../lv_core/lv_obj.h"
#include "lv_arc.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
2018-09-18 13:59:40 +02:00
enum {
2018-06-19 09:49:58 +02:00
LV_PRELOAD_TYPE_SPINNING_ARC,
LV_PRELOAD_TYPE_FILLSPIN_ARC,
2018-09-18 13:59:40 +02:00
};
2019-03-29 16:10:18 +01:00
typedef uint8_t lv_preload_type_t;
2018-06-09 08:47:09 +02:00
enum {
LV_PRELOAD_DIR_FORWARD,
LV_PRELOAD_DIR_BACKWARD,
};
typedef uint8_t lv_preload_dir_t;
2018-06-09 08:47:09 +02:00
/*Data of pre loader*/
2019-04-04 07:15:40 +02:00
typedef struct
{
2018-06-09 08:47:09 +02:00
lv_arc_ext_t arc; /*Ext. of ancestor*/
/*New data for this type */
2019-04-04 07:15:40 +02:00
uint16_t arc_length; /*Length of the spinning indicator in degree*/
uint16_t time; /*Time of one round*/
lv_preload_type_t anim_type:1; /*Type of the arc animation*/
lv_preload_dir_t anim_dir:1; /*Animation Direction*/
2018-06-19 09:49:58 +02:00
} lv_preload_ext_t;
2018-06-09 08:47:09 +02:00
/*Styles*/
2018-09-18 13:59:40 +02:00
enum {
2018-06-19 09:49:58 +02:00
LV_PRELOAD_STYLE_MAIN,
2018-09-18 13:59:40 +02:00
};
typedef uint8_t lv_preload_style_t;
2018-06-09 08:47:09 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a pre loader objects
* @param par pointer to an object, it will be the parent of the new pre loader
2019-04-04 07:15:40 +02:00
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from
* it
2018-06-09 08:47:09 +02:00
* @return pointer to the created pre loader
*/
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy);
2018-06-09 08:47:09 +02:00
/*======================
* Add/remove functions
*=====================*/
2018-06-11 10:36:36 +02:00
/**
* Set the length of the spinning arc in degrees
* @param preload pointer to a preload object
* @param deg length of the arc
*/
void lv_preload_set_arc_length(lv_obj_t * preload, int16_t deg);
2018-06-11 10:36:36 +02:00
/**
* Set the spin time of the arc
* @param preload pointer to a preload object
* @param time time of one round in milliseconds
*/
void lv_preload_set_spin_time(lv_obj_t * preload, uint16_t time);
2018-06-09 08:47:09 +02:00
/*=====================
* Setter functions
*====================*/
/**
* Set a style of a pre loader.
* @param preload pointer to pre loader object
* @param type which style should be set
* @param style pointer to a style
* */
2019-04-11 19:59:55 +08:00
void lv_preload_set_style(lv_obj_t * preload, lv_preload_style_t type, const lv_style_t * style);
2018-06-09 08:47:09 +02:00
/**
* Set the animation type of a preloader.
* @param preload pointer to pre loader object
* @param type animation type of the preload
* */
void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type);
/**
* Set the animation direction of a preloader
* @param preload pointer to pre loader object
* @param direction animation direction of the preload
*/
void lv_preload_set_anim_dir(lv_obj_t * preload, lv_preload_dir_t dir);
2018-06-09 08:47:09 +02:00
/*=====================
* Getter functions
*====================*/
2018-06-11 10:36:36 +02:00
/**
* Get the arc length [degree] of the a pre loader
* @param preload pointer to a pre loader object
*/
uint16_t lv_preload_get_arc_length(const lv_obj_t * preload);
2018-06-11 10:36:36 +02:00
/**
* Get the spin time of the arc
* @param preload pointer to a pre loader object [milliseconds]
*/
uint16_t lv_preload_get_spin_time(const lv_obj_t * preload);
2018-06-11 10:36:36 +02:00
2018-06-09 08:47:09 +02:00
/**
* Get style of a pre loader.
* @param preload pointer to pre loader object
* @param type which style should be get
* @return style pointer to the style
* */
2019-04-11 19:59:55 +08:00
const lv_style_t * lv_preload_get_style(const lv_obj_t * preload, lv_preload_style_t type);
2018-06-09 08:47:09 +02:00
/**
* Get the animation type of a preloader.
* @param preload pointer to pre loader object
* @return animation type
* */
lv_preload_type_t lv_preload_get_anim_type(lv_obj_t * preload);
/**
* Get the animation direction of a preloader
* @param preload pointer to pre loader object
* @return animation direction
*/
lv_preload_dir_t lv_preload_get_anim_dir(lv_obj_t * preload);
2018-06-09 08:47:09 +02:00
/*=====================
* Other functions
*====================*/
/**
* Get style of a pre loader.
* @param preload pointer to pre loader object
* @param type which style should be get
* @return style pointer to the style
* */
void lv_preload_spinner_anim(void * ptr, int16_t val);
2018-06-09 08:47:09 +02:00
/**********************
* MACROS
**********************/
2019-04-04 07:15:40 +02:00
#endif /*LV_USE_PRELOAD*/
2018-06-09 08:47:09 +02:00
#ifdef __cplusplus
} /* extern "C" */
#endif
2019-04-04 07:15:40 +02:00
#endif /*LV_PRELOAD_H*/