2016-08-04 11:33:35 +02:00
|
|
|
/**
|
2017-04-11 10:50:57 +02:00
|
|
|
* @file lv_bar.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
2016-08-04 11:33:35 +02:00
|
|
|
*/
|
|
|
|
|
2017-04-11 10:50:57 +02:00
|
|
|
#ifndef LV_BAR_H
|
|
|
|
#define LV_BAR_H
|
2016-08-04 11:33:35 +02:00
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-08-04 11:33:35 +02:00
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2018-07-07 12:21:36 +02:00
|
|
|
#ifdef LV_CONF_INCLUDE_SIMPLE
|
2018-07-07 11:53:22 +02:00
|
|
|
#include "lv_conf.h"
|
|
|
|
#else
|
2017-11-26 23:57:39 +01:00
|
|
|
#include "../../lv_conf.h"
|
2018-07-07 11:53:22 +02:00
|
|
|
#endif
|
|
|
|
|
2017-04-11 10:50:57 +02:00
|
|
|
#if USE_LV_BAR != 0
|
2016-08-04 11:33:35 +02:00
|
|
|
|
2017-11-30 11:35:33 +01:00
|
|
|
#include "../lv_core/lv_obj.h"
|
2017-08-23 14:39:09 +02:00
|
|
|
#include "lv_cont.h"
|
2017-02-03 12:48:22 +01:00
|
|
|
#include "lv_btn.h"
|
2016-08-04 11:33:35 +02:00
|
|
|
#include "lv_label.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
2017-04-11 10:50:57 +02:00
|
|
|
/*Data of bar*/
|
2017-01-14 23:54:16 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2017-10-20 15:37:50 +02:00
|
|
|
/*No inherited ext*/ /*Ext. of ancestor*/
|
2017-01-14 23:54:16 +01:00
|
|
|
/*New data for this type */
|
2017-11-05 00:48:57 +01:00
|
|
|
int16_t cur_value; /*Current value of the bar*/
|
2017-10-20 15:37:50 +02:00
|
|
|
int16_t min_value; /*Minimum value of the bar*/
|
|
|
|
int16_t max_value; /*Maximum value of the bar*/
|
2017-11-16 10:20:30 +01:00
|
|
|
lv_style_t *style_indic; /*Style of the indicator*/
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_bar_ext_t;
|
2017-01-14 23:54:16 +01:00
|
|
|
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2017-11-15 15:50:33 +01:00
|
|
|
LV_BAR_STYLE_BG,
|
|
|
|
LV_BAR_STYLE_INDIC,
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
|
|
|
typedef uint8_t lv_bar_style_t;
|
2017-11-15 15:50:33 +01:00
|
|
|
|
2016-08-04 11:33:35 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
2017-04-21 09:15:39 +02:00
|
|
|
* Create a bar objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new bar
|
|
|
|
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created bar
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2017-04-21 09:15:39 +02:00
|
|
|
* Set a new value on the bar
|
|
|
|
* @param bar pointer to a bar object
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param value new value
|
|
|
|
*/
|
2017-04-11 10:50:57 +02:00
|
|
|
void lv_bar_set_value(lv_obj_t * bar, int16_t value);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-05-02 00:16:48 +02:00
|
|
|
/**
|
|
|
|
* Set a new value with animation on the bar
|
|
|
|
* @param bar pointer to a bar object
|
|
|
|
* @param value new value
|
|
|
|
* @param anim_time animation time in milliseconds
|
|
|
|
*/
|
|
|
|
void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time);
|
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2017-04-21 09:15:39 +02:00
|
|
|
* Set minimum and the maximum values of a bar
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param bar pointer to the bar object
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param min minimum value
|
|
|
|
* @param max maximum value
|
|
|
|
*/
|
2017-04-11 10:50:57 +02:00
|
|
|
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Set a style of a bar
|
2017-04-21 09:15:39 +02:00
|
|
|
* @param bar pointer to a bar object
|
2017-11-15 15:50:33 +01:00
|
|
|
* @param type which style should be set
|
|
|
|
* @param style pointer to a style
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-11-15 15:50:33 +01:00
|
|
|
void lv_bar_set_style(lv_obj_t *bar, lv_bar_style_t type, lv_style_t *style);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2017-04-21 09:15:39 +02:00
|
|
|
* Get the value of a bar
|
|
|
|
* @param bar pointer to a bar object
|
|
|
|
* @return the value of the bar
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
int16_t lv_bar_get_value(const lv_obj_t * bar);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-04-21 09:15:39 +02:00
|
|
|
/**
|
|
|
|
* Get the minimum value of a bar
|
|
|
|
* @param bar pointer to a bar object
|
|
|
|
* @return the minimum value of the bar
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
int16_t lv_bar_get_min_value(const lv_obj_t * bar);
|
2017-04-21 09:15:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the maximum value of a bar
|
|
|
|
* @param bar pointer to a bar object
|
|
|
|
* @return the maximum value of the bar
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
int16_t lv_bar_get_max_value(const lv_obj_t * bar);
|
2017-04-21 09:15:39 +02:00
|
|
|
|
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Get a style of a bar
|
2017-11-10 15:01:40 +01:00
|
|
|
* @param bar pointer to a bar object
|
2017-11-15 15:50:33 +01:00
|
|
|
* @param type which style should be get
|
|
|
|
* @return style pointer to a style
|
2017-11-10 15:01:40 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_style_t * lv_bar_get_style(const lv_obj_t *bar, lv_bar_style_t type);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2016-08-04 11:33:35 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#endif /*USE_LV_BAR*/
|
2016-08-04 11:33:35 +02:00
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
2016-08-04 11:33:35 +02:00
|
|
|
#endif
|
2017-07-09 15:32:49 +02:00
|
|
|
|
|
|
|
#endif /*LV_BAR_H*/
|