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.h"
|
|
|
|
#if USE_LV_LINE != 0
|
|
|
|
|
2017-08-23 14:39:09 +02:00
|
|
|
#include "../lv_obj/lv_obj.h"
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
2017-01-14 23:54:16 +01:00
|
|
|
|
|
|
|
/*Data of line*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
|
|
|
|
const 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*/
|
|
|
|
uint8_t upscale :1; /*1: upscale coordinates with LV_DOWNSCALE*/
|
|
|
|
}lv_line_ext_t;
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-13 16:11:05 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-13 16:11:05 +01:00
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param point_num number of points in 'point_a'
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2017-11-13 16:11:05 +01:00
|
|
|
* @param autosize_en true: auto size is enabled, false: auto size is disabled
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-11-13 16:11:05 +01:00
|
|
|
void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2017-11-13 16:11:05 +01:00
|
|
|
* @param yinv_en true: enable the y inversion, false:disable the y inversion
|
|
|
|
*/
|
|
|
|
void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable (or disable) the points' coordinate upscaling (if LV_ANTIALIAS is enabled).
|
|
|
|
* @param line pointer to a line object
|
|
|
|
* @param unscale_en true: enable the point coordinate upscaling
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-11-13 16:11:05 +01:00
|
|
|
void lv_line_set_upscale(lv_obj_t * line, bool unscale_en);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
2017-11-13 16:11:05 +01:00
|
|
|
* Set the style of a line
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param line pointer to a line object
|
2017-11-13 16:11:05 +01:00
|
|
|
* @param style pointer to a style
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-11-13 16:11:05 +01:00
|
|
|
static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style)
|
|
|
|
{
|
|
|
|
lv_obj_set_style(line, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the auto size attribute
|
|
|
|
* @param line pointer to a line object
|
|
|
|
* @return true: auto size is enabled, false: disabled
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
bool lv_line_get_auto_size(lv_obj_t * line);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the y inversion attribute
|
|
|
|
* @param line pointer to a line object
|
|
|
|
* @return true: y inversion is enabled, false: disabled
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
bool lv_line_get_y_inv(lv_obj_t * line);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the point upscale enable attribute
|
|
|
|
* @param obj pointer to a line object
|
|
|
|
* @return true: point coordinate upscale is enabled, false: disabled
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
bool lv_line_get_upscale(lv_obj_t * line);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2017-11-13 16:11:05 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Get the style of an line object
|
2017-11-13 16:11:05 +01:00
|
|
|
* @param line pointer to an line object
|
2017-11-15 15:50:33 +01:00
|
|
|
* @return pointer to the line's style
|
2017-11-13 16:11:05 +01:00
|
|
|
*/
|
2017-11-15 15:50:33 +01:00
|
|
|
static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
|
2017-11-13 16:11:05 +01:00
|
|
|
{
|
2017-11-15 15:50:33 +01:00
|
|
|
return lv_obj_get_style(line);
|
2017-11-13 16:11:05 +01:00
|
|
|
}
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#endif /*USE_LV_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
|
|
|
|
|
|
|
#endif /*LV_LINE_H*/
|