Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_line.h
1476 views
1
/**
2
* @file lv_line.h
3
*
4
*/
5
6
#ifndef LV_LINE_H
7
#define LV_LINE_H
8
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
13
/*********************
14
* INCLUDES
15
*********************/
16
#ifdef LV_CONF_INCLUDE_SIMPLE
17
#include "lv_conf.h"
18
#else
19
#include "../../lv_conf.h"
20
#endif
21
22
#if USE_LV_LINE != 0
23
24
#include "../lv_core/lv_obj.h"
25
26
/*********************
27
* DEFINES
28
*********************/
29
30
/**********************
31
* TYPEDEFS
32
**********************/
33
34
/*Data of line*/
35
typedef struct
36
{
37
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
38
const lv_point_t * point_array; /*Pointer to an array with the points of the line*/
39
uint16_t point_num; /*Number of points in 'point_array' */
40
uint8_t auto_size :1; /*1: set obj. width to x max and obj. height to y max */
41
uint8_t y_inv :1; /*1: y == 0 will be on the bottom*/
42
} lv_line_ext_t;
43
44
/**********************
45
* GLOBAL PROTOTYPES
46
**********************/
47
48
49
/**
50
* Create a line objects
51
* @param par pointer to an object, it will be the parent of the new line
52
* @return pointer to the created line
53
*/
54
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy);
55
56
/*=====================
57
* Setter functions
58
*====================*/
59
60
/**
61
* Set an array of points. The line object will connect these points.
62
* @param line pointer to a line object
63
* @param point_a an array of points. Only the address is saved,
64
* so the array can NOT be a local variable which will be destroyed
65
* @param point_num number of points in 'point_a'
66
*/
67
void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t point_num);
68
69
/**
70
* Enable (or disable) the auto-size option. The size of the object will fit to its points.
71
* (set width to x max and height to y max)
72
* @param line pointer to a line object
73
* @param en true: auto size is enabled, false: auto size is disabled
74
*/
75
void lv_line_set_auto_size(lv_obj_t * line, bool en);
76
77
/**
78
* Enable (or disable) the y coordinate inversion.
79
* If enabled then y will be subtracted from the height of the object,
80
* therefore the y=0 coordinate will be on the bottom.
81
* @param line pointer to a line object
82
* @param en true: enable the y inversion, false:disable the y inversion
83
*/
84
void lv_line_set_y_invert(lv_obj_t * line, bool en);
85
86
#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 work */
87
88
/**
89
* Set the style of a line
90
* @param line pointer to a line object
91
* @param style pointer to a style
92
*/
93
static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
94
{
95
lv_obj_set_style(line, style);
96
}
97
98
/**
99
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
100
* @param line -
101
* @param upscale -
102
*/
103
static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale)
104
{
105
(void) line;
106
(void) upcale;
107
}
108
/*=====================
109
* Getter functions
110
*====================*/
111
112
/**
113
* Get the auto size attribute
114
* @param line pointer to a line object
115
* @return true: auto size is enabled, false: disabled
116
*/
117
bool lv_line_get_auto_size(const lv_obj_t * line);
118
119
/**
120
* Get the y inversion attribute
121
* @param line pointer to a line object
122
* @return true: y inversion is enabled, false: disabled
123
*/
124
bool lv_line_get_y_invert(const lv_obj_t * line);
125
126
/**
127
* Get the style of an line object
128
* @param line pointer to an line object
129
* @return pointer to the line's style
130
*/
131
static inline lv_style_t* lv_line_get_style(const lv_obj_t *line)
132
{
133
return lv_obj_get_style(line);
134
}
135
136
/**
137
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
138
* @param line -
139
* @return false
140
*/
141
static inline bool lv_line_get_upscale(const lv_obj_t * line)
142
{
143
(void) line;
144
return false;
145
}
146
147
148
/**********************
149
* MACROS
150
**********************/
151
152
#endif /*USE_LV_LINE*/
153
154
#ifdef __cplusplus
155
} /* extern "C" */
156
#endif
157
158
#endif /*LV_LINE_H*/
159
160