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

Test btn extension

This commit is contained in:
Adam Martini 2020-06-20 11:06:06 -07:00
parent 446b0b6429
commit 1dfdabd638
2 changed files with 29 additions and 7 deletions

View File

@ -798,14 +798,14 @@ static void rotary_init(void)
#if LV_USE_ROTARY != 0
style_init_reset(&styles->rotary_bg);
lv_style_set_clip_corner(&styles->rotary_bg, LV_STATE_DEFAULT, true);
lv_style_set_pad_left(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_border_width(&styles->rotary_bg, LV_STATE_DEFAULT, 0);
lv_style_set_pad_left(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_pad_right(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_pad_top(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_pad_bottom(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_pad_inner(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_border_width(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(2));
lv_style_set_line_color(&styles->rotary_bg, LV_STATE_DEFAULT, COLOR_BG_SEC);
lv_style_set_line_width(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(8));
lv_style_set_line_width(&styles->rotary_bg, LV_STATE_DEFAULT, LV_DPX(2));
lv_style_set_line_rounded(&styles->rotary_bg, LV_STATE_DEFAULT, true);
style_init_reset(&styles->rotary_indic);

View File

@ -45,6 +45,18 @@ enum {
};
typedef uint8_t lv_rotary_type_t;
/** Possible states of a rotary.*/
enum {
LV_ROTARY_STATE_RELEASED = LV_BTN_STATE_RELEASED,
LV_ROTARY_STATE_PRESSED = LV_BTN_STATE_PRESSED,
LV_ROTARY_STATE_DISABLED = LV_BTN_STATE_DISABLED,
LV_ROTARY_STATE_CHECKED_RELEASED = LV_BTN_STATE_CHECKED_RELEASED,
LV_ROTARY_STATE_CHECKED_PRESSED = LV_BTN_STATE_CHECKED_PRESSED,
LV_ROTARY_STATE_CHECKED_DISABLED = LV_BTN_STATE_CHECKED_DISABLED,
_LV_ROTARY_STATE_LAST = _LV_BTN_STATE_LAST, /* Number of states*/
};
typedef uint8_t lv_btn_state_t;
/*Data of rotary*/
typedef struct {
/*Ext. of ancestor*/
@ -172,6 +184,16 @@ static inline void lv_rotary_set_rotation(lv_obj_t * rotary, uint16_t rotation_a
lv_arc_set_rotation(rotary, rotation_angle);
}
/**
* Set the state of the rotary
* @param rotary pointer to a rotary object
* @param state the new state of the rotary (from lv_rotary_state_t enum)
*/
void lv_rotary_set_state(lv_obj_t * rotary, lv_rotary_state_t state)
{
lv_btn_set_state(rotary, state);
}
/*=====================
* Getter functions
*====================*/