1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/src/lv_widgets/lv_arc.h
2020-03-10 10:51:47 +01:00

146 lines
3.2 KiB
C

/**
* @file lv_arc.h
*
*/
#ifndef LV_ARC_H
#define LV_ARC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_ARC != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of arc*/
typedef struct {
/*New data for this type */
lv_coord_t arc_angle_start;
lv_coord_t arc_angle_end;
lv_coord_t bg_angle_start;
lv_coord_t bg_angle_end;
lv_style_list_t style_arc;
} lv_arc_ext_t;
/*Parts of the arc*/
enum {
LV_ARC_PART_BG = LV_OBJ_PART_MAIN,
LV_ARC_PART_INDIC,
_LV_ARC_PART_VIRTUAL_LAST,
_LV_ARC_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
typedef uint8_t lv_arc_part_t;
/**********************
* 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
*/
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle
*/
void lv_arc_set_start_angle(lv_obj_t * arc, int16_t start);
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param end the end angle
*/
void lv_arc_set_end_angle(lv_obj_t * arc, int16_t end);
/**
* Set the start and end angles
* @param arc pointer to an arc object
* @param start the start angle
* @param end the end angle
*/
void lv_arc_set_angles(lv_obj_t * arc, int16_t start, int16_t end);
/**
* 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
*/
void lv_arc_set_bg_start_angle(lv_obj_t * arc, int16_t start);
/**
* 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
*/
void lv_arc_set_bg_end_angle(lv_obj_t * arc, int16_t end);
/**
* 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
*/
void lv_arc_set_bg_angles(lv_obj_t * arc, int16_t start, int16_t end);
/*=====================
* Getter functions
*====================*/
/**
* Get the start angle of an arc.
* @param arc pointer to an arc object
* @return the start angle [0..360]
*/
uint16_t lv_arc_get_angle_start(lv_obj_t * arc);
/**
* Get the end angle of an arc.
* @param arc pointer to an arc object
* @return the end angle [0..360]
*/
uint16_t lv_arc_get_angle_end(lv_obj_t * arc);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ARC*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_ARC_H*/