1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_preload.h

152 lines
3.4 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
2018-06-09 08:47:09 +02:00
#include "../../lv_conf.h"
#endif
2018-06-09 08:47:09 +02:00
#if USE_LV_PRELOAD != 0
/*Testing of dependencies*/
#if USE_LV_ARC == 0
#error "lv_preload: lv_arc is required. Enable it in lv_conf.h (USE_LV_ARC 1) "
#endif
#if USE_LV_ANIMATION == 0
#error "lv_preload: animations are required. Enable it in lv_conf.h (USE_LV_ANIMATION 1) "
#endif
2018-06-09 08:47:09 +02:00
#include "../lv_core/lv_obj.h"
#include "lv_arc.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
2018-06-19 09:49:58 +02:00
LV_PRELOAD_TYPE_SPINNING_ARC,
} lv_preloader_type_t;
2018-06-09 08:47:09 +02:00
/*Data of pre loader*/
typedef struct {
lv_arc_ext_t arc; /*Ext. of ancestor*/
/*New data for this type */
2018-06-19 09:49:58 +02:00
uint16_t arc_length; /*Length of the spinning indicator in degree*/
uint16_t time; /*Time of one round*/
} lv_preload_ext_t;
2018-06-09 08:47:09 +02:00
/*Styles*/
typedef enum {
2018-06-19 09:49:58 +02:00
LV_PRELOAD_STYLE_MAIN,
} 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
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from it
* @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, uint16_t deg);
/**
* 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
* */
void lv_preload_set_style(lv_obj_t * preload, lv_preload_style_t type, lv_style_t *style);
/*=====================
* 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
* */
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
/*=====================
* 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_animation(void * ptr, int32_t val);
2018-06-09 08:47:09 +02:00
/**********************
* MACROS
**********************/
#endif /*USE_LV_PRELOAD*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_PRELOAD_H*/