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

cpicker: rework

This commit is contained in:
Gabor Kiss-Vamosi 2019-10-01 21:16:30 +02:00
parent 8cb508dfec
commit 2600c1c3d9
2 changed files with 601 additions and 1342 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,13 +30,6 @@ extern "C" {
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
enum {
LV_CPICKER_INDICATOR_NONE,
LV_CPICKER_INDICATOR_LINE,
LV_CPICKER_INDICATOR_CIRCLE,
LV_CPICKER_INDICATOR_IN
};
typedef uint8_t lv_cpicker_indicator_type_t;
enum { enum {
LV_CPICKER_TYPE_RECT, LV_CPICKER_TYPE_RECT,
@ -56,21 +49,17 @@ typedef uint8_t lv_cpicker_color_mode_t;
/*Data of colorpicker*/ /*Data of colorpicker*/
typedef struct { typedef struct {
lv_color_hsv_t hsv; lv_color_hsv_t hsv;
lv_color_hsv_t prev_hsv; struct {
struct
{
lv_style_t * style; lv_style_t * style;
lv_cpicker_indicator_type_t type; lv_point_t pos;
} indicator; uint8_t colored :1;
} indic;
uint32_t last_click_time; uint32_t last_click_time;
lv_area_t rect_preview_area; uint32_t last_change_time;
lv_area_t rect_gradient_area; lv_cpicker_color_mode_t color_mode :2;
lv_coord_t rect_gradient_w; uint8_t color_mode_fixed :1;
lv_coord_t rect_gradient_h; lv_cpicker_type_t type :1;
uint16_t prev_pos;
lv_cpicker_color_mode_t color_mode:2;
uint8_t color_mode_fixed:1;
lv_cpicker_type_t type:1;
} lv_cpicker_ext_t; } lv_cpicker_ext_t;
/*Styles*/ /*Styles*/
@ -112,13 +101,6 @@ void lv_cpicker_set_type(lv_obj_t * chart, lv_cpicker_type_t type);
*/ */
void lv_cpicker_set_style(lv_obj_t * cpicker, lv_cpicker_style_t type, lv_style_t *style); void lv_cpicker_set_style(lv_obj_t * cpicker, lv_cpicker_style_t type, lv_style_t *style);
/**
* Set a type of a colorpicker indicator.
* @param cpicker pointer to colorpicker object
* @param type indicator type
*/
void lv_cpicker_set_indicator_type(lv_obj_t * cpicker, lv_cpicker_indicator_type_t type);
/** /**
* Set the current hue of a colorpicker. * Set the current hue of a colorpicker.
* @param cpicker pointer to colorpicker object * @param cpicker pointer to colorpicker object
@ -168,6 +150,13 @@ void lv_cpicker_set_color_mode(lv_obj_t * cpicker, lv_cpicker_color_mode_t mode)
*/ */
void lv_cpicker_set_color_mode_fixed(lv_obj_t * cpicker, bool fixed); void lv_cpicker_set_color_mode_fixed(lv_obj_t * cpicker, bool fixed);
/**
* Make the indicator to be colored to the current color
* @param cpicker pointer to colorpicker object
* @param en true: color the indicator; false: not color the indicator
*/
void lv_cpicker_set_indic_colored(lv_obj_t * cpicker, bool en);
/*===================== /*=====================
* Getter functions * Getter functions
*====================*/ *====================*/
@ -192,7 +181,7 @@ bool lv_cpicker_get_color_mode_fixed(lv_obj_t * cpicker);
* @param type which style should be get * @param type which style should be get
* @return pointer to the style * @return pointer to the style
*/ */
lv_style_t * lv_cpicker_get_style(const lv_obj_t * cpicker, lv_cpicker_style_t type); const lv_style_t * lv_cpicker_get_style(const lv_obj_t * cpicker, lv_cpicker_style_t type);
/** /**
* Get the current hue of a colorpicker. * Get the current hue of a colorpicker.
@ -229,6 +218,13 @@ lv_color_hsv_t lv_cpicker_get_hsv(lv_obj_t * cpicker);
*/ */
lv_color_t lv_cpicker_get_color(lv_obj_t * cpicker); lv_color_t lv_cpicker_get_color(lv_obj_t * cpicker);
/**
* Whether the indicator is colored to the current color or not
* @param cpicker pointer to colorpicker object
* @return true: color the indicator; false: not color the indicator
*/
bool lv_cpicker_get_indic_colored(lv_obj_t * cpicker);
/*===================== /*=====================
* Other functions * Other functions
*====================*/ *====================*/