mirror of
https://github.com/lvgl/lvgl.git
synced 2024-12-04 23:24:18 +08:00
code formatting
This commit is contained in:
parent
87a9c371bb
commit
dc17c3d462
@ -25,16 +25,12 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
|
||||
static void lv_btns_init(void);
|
||||
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p);
|
||||
static void lv_btns_init(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/*-----------------
|
||||
* Style definition
|
||||
*-----------------*/
|
||||
static lv_btns_t lv_btns_def;
|
||||
static lv_btns_t lv_btns_transp;
|
||||
static lv_btns_t lv_btns_border;
|
||||
@ -365,6 +361,22 @@ static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the corresponding style according to the state to 'rects' in 'lv_btns_t'
|
||||
* @param obj_dp pointer to a button object
|
||||
*/
|
||||
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p)
|
||||
{
|
||||
lv_btn_state_t state = lv_btn_get_state(obj_dp);
|
||||
lv_btns_t * btns_p = lv_obj_get_style(obj_dp);
|
||||
|
||||
/*Load the style*/
|
||||
memcpy(rects_p, &btns_p->rects, sizeof(lv_rects_t));
|
||||
rects_p->objs.color = btns_p->mcolor[state];
|
||||
rects_p->gcolor = btns_p->gcolor[state];
|
||||
rects_p->bcolor = btns_p->bcolor[state];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the button styles
|
||||
*/
|
||||
@ -422,20 +434,4 @@ static void lv_btns_init(void)
|
||||
lv_btns_border.rects.vpad = 5 * LV_STYLE_MULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the corresponding style according to the state to 'rects' in 'lv_btns_t'
|
||||
* @param obj_dp pointer to a button object
|
||||
*/
|
||||
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p)
|
||||
{
|
||||
lv_btn_state_t state = lv_btn_get_state(obj_dp);
|
||||
lv_btns_t * btns_p = lv_obj_get_style(obj_dp);
|
||||
|
||||
/*Load the style*/
|
||||
memcpy(rects_p, &btns_p->rects, sizeof(lv_rects_t));
|
||||
rects_p->objs.color = btns_p->mcolor[state];
|
||||
rects_p->gcolor = btns_p->gcolor[state];
|
||||
rects_p->bcolor = btns_p->bcolor[state];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -26,10 +26,10 @@
|
||||
#if 0 /*Not necessary*/
|
||||
static bool lv_btnm_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
|
||||
#endif
|
||||
static void lv_btnms_init(void);
|
||||
static uint8_t lv_btnm_get_width_unit(const char * btn_str);
|
||||
static void lv_btnm_create_btns(lv_obj_t * obj_dp, const char ** map_p);
|
||||
static bool lv_btnm_btn_release_action(lv_obj_t * obj_dp, lv_dispi_t * dispi_p);
|
||||
static void lv_btnms_init(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -222,6 +222,27 @@ void lv_btnm_set_cb(lv_obj_t * obj_dp, lv_btnm_callback_t cb)
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the current map of a button matrix
|
||||
* @param obj_dp pointer to a button matrix object
|
||||
* @return the current map
|
||||
*/
|
||||
const char ** lv_btnm_get_map(lv_obj_t * obj_dp)
|
||||
{
|
||||
return LV_EA(obj_dp, lv_btnm_ext_t)->map_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a the callback function of the buttons on a button matrix
|
||||
* @param obj_dp: pointer to button matrix object
|
||||
* @return pointer to the callback function
|
||||
*/
|
||||
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * obj_dp)
|
||||
{
|
||||
return LV_EA(obj_dp, lv_btnm_ext_t)->cb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_btnms_builtin_t enum
|
||||
@ -256,26 +277,6 @@ lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy_p)
|
||||
return style_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current map of a button matrix
|
||||
* @param obj_dp pointer to a button matrix object
|
||||
* @return the current map
|
||||
*/
|
||||
const char ** lv_btnm_get_map(lv_obj_t * obj_dp)
|
||||
{
|
||||
return LV_EA(obj_dp, lv_btnm_ext_t)->map_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a the callback function of the buttons on a button matrix
|
||||
* @param obj_dp: pointer to button matrix object
|
||||
* @return pointer to the callback function
|
||||
*/
|
||||
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * obj_dp)
|
||||
{
|
||||
return LV_EA(obj_dp, lv_btnm_ext_t)->cb;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CHART != 0
|
||||
|
||||
#include <lvgl/lv_objx/lv_chart.h>
|
||||
#include "lvgl/lv_draw/lv_draw.h"
|
||||
#include "lv_chart.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -39,8 +39,8 @@ static void lv_chart_draw_cols(lv_obj_t* obj_dp, const area_t * mask_p);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_f_t ancestor_design_fp;
|
||||
static lv_charts_t lv_charts_def;
|
||||
static lv_design_f_t ancestor_design_fp;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -171,6 +171,17 @@ void lv_led_tgl(lv_obj_t * obj_dp)
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the brightness of a LEd object
|
||||
* @param obj_dp pointer to LED object
|
||||
* @return bright 0 (max. dark) ... 255 (max. light)
|
||||
*/
|
||||
uint8_t lv_led_get_bright(lv_obj_t * obj_dp)
|
||||
{
|
||||
lv_led_ext_t * ext_dp = lv_obj_get_ext(obj_dp);
|
||||
return ext_dp->bright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_leds_builtin_t enum
|
||||
@ -209,22 +220,10 @@ lv_leds_t * lv_leds_get(lv_leds_builtin_t style, lv_leds_t * copy_p)
|
||||
return style_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the brightness of a LEd object
|
||||
* @param obj_dp pointer to LED object
|
||||
* @return bright 0 (max. dark) ... 255 (max. light)
|
||||
*/
|
||||
uint8_t lv_led_get_bright(lv_obj_t * obj_dp)
|
||||
{
|
||||
lv_led_ext_t * ext_dp = lv_obj_get_ext(obj_dp);
|
||||
return ext_dp->bright;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the leds
|
||||
* @param obj_dp pointer to an object
|
||||
|
@ -29,6 +29,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
|
||||
static void lv_temps_init(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -127,6 +128,14 @@ bool lv_templ_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param)
|
||||
*/
|
||||
lv_templs_t * lv_templs_get(lv_templs_builtin_t style, lv_templs_t * copy_p)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_temps_init();
|
||||
style_inited = true;
|
||||
}
|
||||
|
||||
lv_templs_t *style_p;
|
||||
|
||||
switch(style) {
|
||||
@ -174,4 +183,12 @@ static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the template styles
|
||||
*/
|
||||
static void lv_temps_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,10 +34,9 @@ static void lv_pages_init(void);;
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
|
||||
static lv_pages_t lv_pages_def;
|
||||
static lv_pages_t lv_pages_transp;
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -273,6 +272,10 @@ static bool lv_scrolling_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param)
|
||||
return obj_valid;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Glue the object to the page. After it the page can be moved (dragged) with this object too.
|
||||
* @param obj_dp pointer to an object on a page
|
||||
@ -284,6 +287,11 @@ void lv_page_glue_obj(lv_obj_t* obj_dp, bool en)
|
||||
lv_obj_set_drag(obj_dp, en);
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_pages_builtin_t enum
|
||||
@ -321,17 +329,6 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy)
|
||||
return style_p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -34,7 +34,7 @@ static void lv_pbs_init(void);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static bool (*ancestor_design_fp)(lv_obj_t*, const area_t *, lv_design_mode_t);
|
||||
static lv_design_f_t ancestor_design_fp;
|
||||
static lv_pbs_t lv_pbs_def;
|
||||
|
||||
/**********************
|
||||
|
@ -438,7 +438,16 @@ static bool lv_ta_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An extended label design. Calls the normal label design function and it draws a cursor.
|
||||
* @param obj_dp pointer to a text area object
|
||||
* @param mask_p the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @return return true/false, depends on 'mode'
|
||||
*/
|
||||
static bool lv_ta_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
|
Loading…
Reference in New Issue
Block a user