acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_bar.h (4011B)
1 /** 2 * @file lv_bar.h 3 * 4 */ 5 6 #ifndef LV_BAR_H 7 #define LV_BAR_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_conf_internal.h" 17 18 #if LV_USE_BAR != 0 19 20 #include "../core/lv_obj.h" 21 #include "../misc/lv_anim.h" 22 #include "lv_btn.h" 23 #include "lv_label.h" 24 25 /********************* 26 * DEFINES 27 *********************/ 28 29 /********************** 30 * TYPEDEFS 31 **********************/ 32 33 enum { 34 LV_BAR_MODE_NORMAL, 35 LV_BAR_MODE_SYMMETRICAL, 36 LV_BAR_MODE_RANGE 37 }; 38 typedef uint8_t lv_bar_mode_t; 39 40 typedef struct { 41 lv_obj_t * bar; 42 int32_t anim_start; 43 int32_t anim_end; 44 int32_t anim_state; 45 } _lv_bar_anim_t; 46 47 typedef struct { 48 lv_obj_t obj; 49 int32_t cur_value; /**< Current value of the bar*/ 50 int32_t min_value; /**< Minimum value of the bar*/ 51 int32_t max_value; /**< Maximum value of the bar*/ 52 int32_t start_value; /**< Start value of the bar*/ 53 lv_area_t indic_area; /**< Save the indicator area. Might be used by derived types*/ 54 _lv_bar_anim_t cur_value_anim; 55 _lv_bar_anim_t start_value_anim; 56 lv_bar_mode_t mode : 2; /**< Type of bar*/ 57 } lv_bar_t; 58 59 extern const lv_obj_class_t lv_bar_class; 60 61 /** 62 * `type` field in `lv_obj_draw_part_dsc_t` if `class_p = lv_bar_class` 63 * Used in `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` 64 */ 65 typedef enum { 66 LV_BAR_DRAW_PART_INDICATOR, /**< The indicator*/ 67 } lv_bar_draw_part_type_t; 68 69 /********************** 70 * GLOBAL PROTOTYPES 71 **********************/ 72 73 /** 74 * Create a bar object 75 * @param parent pointer to an object, it will be the parent of the new bar 76 * @return pointer to the created bar 77 */ 78 lv_obj_t * lv_bar_create(lv_obj_t * parent); 79 80 /*===================== 81 * Setter functions 82 *====================*/ 83 84 /** 85 * Set a new value on the bar 86 * @param bar pointer to a bar object 87 * @param value new value 88 * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 89 */ 90 void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); 91 92 /** 93 * Set a new start value on the bar 94 * @param obj pointer to a bar object 95 * @param value new start value 96 * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 97 */ 98 void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_t anim); 99 100 /** 101 * Set minimum and the maximum values of a bar 102 * @param obj pointer to the bar object 103 * @param min minimum value 104 * @param max maximum value 105 */ 106 void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max); 107 108 /** 109 * Set the type of bar. 110 * @param obj pointer to bar object 111 * @param mode bar type from ::lv_bar_mode_t 112 */ 113 void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode); 114 115 /*===================== 116 * Getter functions 117 *====================*/ 118 119 /** 120 * Get the value of a bar 121 * @param obj pointer to a bar object 122 * @return the value of the bar 123 */ 124 int32_t lv_bar_get_value(const lv_obj_t * obj); 125 126 /** 127 * Get the start value of a bar 128 * @param obj pointer to a bar object 129 * @return the start value of the bar 130 */ 131 int32_t lv_bar_get_start_value(const lv_obj_t * obj); 132 133 /** 134 * Get the minimum value of a bar 135 * @param obj pointer to a bar object 136 * @return the minimum value of the bar 137 */ 138 int32_t lv_bar_get_min_value(const lv_obj_t * obj); 139 140 /** 141 * Get the maximum value of a bar 142 * @param obj pointer to a bar object 143 * @return the maximum value of the bar 144 */ 145 int32_t lv_bar_get_max_value(const lv_obj_t * obj); 146 147 /** 148 * Get the type of bar. 149 * @param obj pointer to bar object 150 * @return bar type from ::lv_bar_mode_t 151 */ 152 lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj); 153 154 /********************** 155 * MACROS 156 **********************/ 157 158 #endif /*LV_USE_BAR*/ 159 160 #ifdef __cplusplus 161 } /*extern "C"*/ 162 #endif 163 164 #endif /*LV_BAR_H*/