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

120 lines
3.2 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_line.h
*
*/
#ifndef LV_LINE_H
#define LV_LINE_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2016-06-08 07:25:08 +02:00
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LINE != 0
2016-06-08 07:25:08 +02:00
2017-11-30 11:35:33 +01:00
#include "../lv_core/lv_obj.h"
2016-06-08 07:25:08 +02:00
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of line*/
2020-02-26 19:48:27 +01:00
typedef struct {
2019-04-04 07:15:40 +02:00
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
2019-06-06 06:05:40 +02:00
const lv_point_t * point_array; /*Pointer to an array with the points of the line*/
uint16_t point_num; /*Number of points in 'point_array' */
uint8_t auto_size : 1; /*1: set obj. width to x max and obj. height to y max */
uint8_t y_inv : 1; /*1: y == 0 will be on the bottom*/
2018-06-19 09:49:58 +02:00
} lv_line_ext_t;
/*Styles*/
enum {
2020-01-01 22:01:19 +01:00
LV_LINE_PART_MAIN,
};
typedef uint8_t lv_line_style_t;
2016-06-08 07:25:08 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a line objects
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy);
2017-11-13 16:11:05 +01:00
/*=====================
* Setter functions
*====================*/
/**
* Set an array of points. The line object will connect these points.
* @param line pointer to a line object
* @param point_a an array of points. Only the address is saved,
2017-04-21 09:15:39 +02:00
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t point_num);
/**
* Enable (or disable) the auto-size option. The size of the object will fit to its points.
* (set width to x max and height to y max)
* @param line pointer to a line object
* @param en true: auto size is enabled, false: auto size is disabled
*/
void lv_line_set_auto_size(lv_obj_t * line, bool en);
/**
* Enable (or disable) the y coordinate inversion.
* If enabled then y will be subtracted from the height of the object,
* therefore the y=0 coordinate will be on the bottom.
* @param line pointer to a line object
* @param en true: enable the y inversion, false:disable the y inversion
2017-11-13 16:11:05 +01:00
*/
void lv_line_set_y_invert(lv_obj_t * line, bool en);
2017-11-13 16:11:05 +01:00
2019-06-06 06:05:40 +02:00
#define lv_line_set_y_inv \
lv_line_set_y_invert /*The name was inconsistent. In v.6.0 only `lv_line_set_y_invert`will \
2020-02-26 19:48:27 +01:00
work */
2017-11-13 16:11:05 +01:00
/*=====================
* Getter functions
*====================*/
/**
* Get the auto size attribute
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
bool lv_line_get_auto_size(const lv_obj_t * line);
/**
* Get the y inversion attribute
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_invert(const lv_obj_t * line);
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
#endif /*LV_USE_LINE*/
2016-06-08 07:25:08 +02:00
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
} /* extern "C" */
2016-06-08 07:25:08 +02:00
#endif
2017-07-09 15:32:49 +02:00
2019-04-04 07:15:40 +02:00
#endif /*LV_LINE_H*/