2018-06-08 10:26:10 +02:00
|
|
|
/**
|
|
|
|
* @file lv_arc.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
2018-06-08 10:26:10 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_ARC_H
|
|
|
|
#define LV_ARC_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2019-12-26 02:49:30 +01:00
|
|
|
#include "../lv_conf_internal.h"
|
2018-07-08 01:12:20 +02:00
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_ARC != 0
|
2018-06-08 10:26:10 +02:00
|
|
|
|
|
|
|
#include "../lv_core/lv_obj.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
/*Data of arc*/
|
2020-02-26 19:48:27 +01:00
|
|
|
typedef struct {
|
2018-06-08 10:26:10 +02:00
|
|
|
/*New data for this type */
|
2020-03-30 08:28:50 -07:00
|
|
|
uint16_t rotation_angle;
|
2020-03-27 10:15:51 -07:00
|
|
|
uint16_t arc_angle_start;
|
|
|
|
uint16_t arc_angle_end;
|
|
|
|
uint16_t bg_angle_start;
|
|
|
|
uint16_t bg_angle_end;
|
2020-01-16 14:26:36 +01:00
|
|
|
lv_style_list_t style_arc;
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_arc_ext_t;
|
2018-06-08 10:26:10 +02:00
|
|
|
|
2020-01-07 23:43:57 +01:00
|
|
|
/*Parts of the arc*/
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2020-01-10 11:10:07 +01:00
|
|
|
LV_ARC_PART_BG = LV_OBJ_PART_MAIN,
|
2020-03-04 16:29:21 +01:00
|
|
|
LV_ARC_PART_INDIC,
|
2020-02-03 16:18:53 +01:00
|
|
|
_LV_ARC_PART_VIRTUAL_LAST,
|
|
|
|
|
|
|
|
_LV_ARC_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
2020-01-07 23:43:57 +01:00
|
|
|
typedef uint8_t lv_arc_part_t;
|
2018-09-18 13:59:40 +02:00
|
|
|
|
2018-06-08 10:26:10 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a arc objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new arc
|
|
|
|
* @param copy pointer to a arc object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created arc
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy);
|
2018-06-08 10:26:10 +02:00
|
|
|
|
|
|
|
/*======================
|
|
|
|
* Add/remove functions
|
|
|
|
*=====================*/
|
|
|
|
|
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**
|
2020-02-12 08:54:03 +01:00
|
|
|
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
|
2018-06-08 10:26:10 +02:00
|
|
|
* @param arc pointer to an arc object
|
2019-11-26 13:22:03 +01:00
|
|
|
* @param start the start angle
|
2018-06-08 10:26:10 +02:00
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start);
|
2019-11-26 13:22:03 +01:00
|
|
|
|
|
|
|
/**
|
2020-02-12 08:54:03 +01:00
|
|
|
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
|
2019-11-26 13:22:03 +01:00
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param end the end angle
|
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end);
|
2018-06-08 10:26:10 +02:00
|
|
|
|
2020-02-05 10:40:50 +01:00
|
|
|
/**
|
|
|
|
* Set the start and end angles
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param start the start angle
|
|
|
|
* @param end the end angle
|
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_angles(lv_obj_t * arc, uint16_t start, uint16_t end);
|
2020-02-05 10:40:50 +01:00
|
|
|
|
2020-02-12 08:54:03 +01:00
|
|
|
/**
|
|
|
|
* Set the start angle of an arc background. 0 deg: right, 90 bottom, etc.
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param start the start angle
|
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_bg_start_angle(lv_obj_t * arc, uint16_t start);
|
2020-02-12 08:54:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the start angle of an arc background. 0 deg: right, 90 bottom etc.
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param end the end angle
|
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end);
|
2020-02-12 08:54:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the start and end angles of the arc background
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param start the start angle
|
|
|
|
* @param end the end angle
|
|
|
|
*/
|
2020-03-25 18:09:37 -07:00
|
|
|
void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end);
|
2020-02-12 08:54:03 +01:00
|
|
|
|
2020-03-30 08:28:50 -07:00
|
|
|
/**
|
|
|
|
* Set the rotation for the whole arc
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @param rotation_angle rotation angle
|
|
|
|
*/
|
|
|
|
void lv_arc_set_rotation(lv_obj_t * arc, uint16_t rotation_angle);
|
|
|
|
|
2018-06-08 10:26:10 +02:00
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**
|
2018-12-23 06:38:54 -05:00
|
|
|
* Get the start angle of an arc.
|
2018-06-08 10:26:10 +02:00
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @return the start angle [0..360]
|
|
|
|
*/
|
2018-06-09 08:45:38 +02:00
|
|
|
uint16_t lv_arc_get_angle_start(lv_obj_t * arc);
|
2018-06-08 10:26:10 +02:00
|
|
|
|
|
|
|
/**
|
2018-12-23 06:38:54 -05:00
|
|
|
* Get the end angle of an arc.
|
2018-06-08 10:26:10 +02:00
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @return the end angle [0..360]
|
|
|
|
*/
|
2018-06-09 08:45:38 +02:00
|
|
|
uint16_t lv_arc_get_angle_end(lv_obj_t * arc);
|
2018-06-08 10:26:10 +02:00
|
|
|
|
2020-03-24 13:41:19 -07:00
|
|
|
/**
|
|
|
|
* Get the start angle of an arc background.
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @return the start angle [0..360]
|
|
|
|
*/
|
|
|
|
uint16_t lv_arc_get_bg_angle_start(lv_obj_t * arc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the end angle of an arc background.
|
|
|
|
* @param arc pointer to an arc object
|
|
|
|
* @return the end angle [0..360]
|
|
|
|
*/
|
|
|
|
uint16_t lv_arc_get_bg_angle_end(lv_obj_t * arc);
|
|
|
|
|
2018-06-08 10:26:10 +02:00
|
|
|
/*=====================
|
|
|
|
* Other functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_USE_ARC*/
|
2018-06-08 10:26:10 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_ARC_H*/
|