review: bugfixes, minor updates
This commit is contained in:
107
lv_app/lv_app.c
107
lv_app/lv_app.c
@@ -10,7 +10,7 @@
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
#include <stdio.h>
|
||||
#include "lvgl/lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "lvgl/lv_obj/lv_refr.h"
|
||||
|
||||
#include "lv_app_util/lv_app_kb.h"
|
||||
@@ -64,7 +64,6 @@ static void lv_app_win_close_anim_cb(lv_obj_t * app_win);
|
||||
static void lv_app_win_minim_anim_cb(lv_obj_t * app_win);
|
||||
#endif
|
||||
|
||||
static void lv_app_init_icons(void);
|
||||
static void lv_app_init_style(void);
|
||||
|
||||
/**********************
|
||||
@@ -86,48 +85,6 @@ static lv_obj_t * app_list; /*A list which is opened on 'app_btn' release*/
|
||||
static lv_app_inst_t * con_send; /*The sender application in connection mode. Not NLL means connection mode is active*/
|
||||
static lv_app_style_t app_style; /*Styles for application related things*/
|
||||
|
||||
/*Declare icons*/
|
||||
#if USE_IMG_CLOSE != 0
|
||||
LV_IMG_DECLARE(img_close);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_DOWN != 0
|
||||
LV_IMG_DECLARE(img_down);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_DRIVER != 0
|
||||
LV_IMG_DECLARE(img_driver);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_FILE != 0
|
||||
LV_IMG_DECLARE(img_file);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_FOLDER != 0
|
||||
LV_IMG_DECLARE(img_folder);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_LEFT != 0
|
||||
LV_IMG_DECLARE(img_left);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_OK != 0
|
||||
LV_IMG_DECLARE(img_ok);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_RIGHT != 0
|
||||
LV_IMG_DECLARE(img_right);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_SETTINGS != 0
|
||||
LV_IMG_DECLARE(img_settings);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_UP != 0
|
||||
LV_IMG_DECLARE(img_up);
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -147,7 +104,6 @@ void lv_app_init(void)
|
||||
ll_init(&app_con_ll, sizeof(lv_app_con_t));
|
||||
|
||||
app_scr = lv_scr_act();
|
||||
lv_app_init_icons();
|
||||
lv_app_init_style();
|
||||
|
||||
#if LV_APP_DESKTOP != 0
|
||||
@@ -268,7 +224,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
|
||||
#if LV_APP_EFFECT_ANIM != 0
|
||||
lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_SCROLL);
|
||||
#else
|
||||
lv_obj_set_size(app->sc_title, LV_APP_SC_WIDTH, font_get_height(font_get(app_style.sc_title_style.font)) >> LV_FONT_ANTIALIAS);
|
||||
lv_obj_set_size(app->sc_title, LV_APP_SC_WIDTH, font_get_height(font_get(app_style.sc_title_style.font)) >> FONT_ANTIALIAS);
|
||||
lv_label_set_long_mode(app->sc_title, LV_LABEL_LONG_DOTS);
|
||||
#endif
|
||||
lv_label_set_text(app->sc_title, app->name);
|
||||
@@ -324,11 +280,13 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app)
|
||||
lv_obj_set_style(lv_win_get_header(app->win), &app_style.win_header);
|
||||
lv_win_set_title(app->win, app->dsc->name);
|
||||
|
||||
lv_win_set_style_cbtn(app->win, &app_style.win_cbtn_rel, &app_style.win_cbtn_pr);
|
||||
|
||||
if(app->dsc->conf_open != NULL) {
|
||||
lv_win_add_ctrl_btn(app->win, "U:/icon_settings", lv_app_win_conf_action);
|
||||
lv_win_add_ctrl_btn(app->win, SYMBOL_SETUP, lv_app_win_conf_action);
|
||||
}
|
||||
lv_win_add_ctrl_btn(app->win, "U:/icon_down", lv_app_win_minim_action);
|
||||
lv_win_add_ctrl_btn(app->win, "U:/icon_close",lv_app_win_close_action);
|
||||
lv_win_add_ctrl_btn(app->win, SYMBOL_DOWN, lv_app_win_minim_action);
|
||||
lv_win_add_ctrl_btn(app->win, SYMBOL_CLOSE,lv_app_win_close_action);
|
||||
|
||||
app->win_data = dm_alloc(app->dsc->win_data_size);
|
||||
|
||||
@@ -611,7 +569,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
|
||||
lv_obj_set_style(scrl, &app_style.menu);
|
||||
lv_obj_set_size(app_list, LV_HOR_RES / 3, (LV_VER_RES * 3) / 4);
|
||||
lv_obj_align(app_list, menuh, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
lv_list_set_styles_liste(app_list, &app_style.menu_btn_rel, &app_style.menu_btn_pr, NULL, NULL, NULL);
|
||||
lv_list_set_styles_btn(app_list, &app_style.menu_btn_rel, &app_style.menu_btn_pr, NULL, NULL, NULL);
|
||||
|
||||
lv_app_dsc_t ** dsc;
|
||||
lv_obj_t * elem;
|
||||
@@ -1142,58 +1100,13 @@ static void lv_app_init_style(void)
|
||||
|
||||
lv_style_get(LV_STYLE_TRANSP, &app_style.win_scrl);
|
||||
|
||||
|
||||
lv_style_get(LV_STYLE_BTN_REL, &app_style.win_cbtn_rel);
|
||||
app_style.win_cbtn_rel.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
|
||||
|
||||
memcpy(&app_style.win_cbtn_pr, &app_style.win_cbtn_rel, sizeof(lv_style_t));
|
||||
lv_style_get(LV_STYLE_BTN_PR, &app_style.win_cbtn_pr);
|
||||
app_style.win_cbtn_pr.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create files for the icons
|
||||
*/
|
||||
static void lv_app_init_icons(void)
|
||||
{
|
||||
#if USE_IMG_CLOSE != 0
|
||||
lv_img_create_file("icon_close", img_close);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_DOWN != 0
|
||||
lv_img_create_file("icon_down", img_down);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_DRIVER != 0
|
||||
lv_img_create_file("icon_driver", img_driver);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_FILE != 0
|
||||
lv_img_create_file("icon_file", img_file);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_FOLDER != 0
|
||||
lv_img_create_file("icon_folder", img_folder);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_LEFT != 0
|
||||
lv_img_create_file("icon_left", img_left);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_OK != 0
|
||||
lv_img_create_file("icon_ok", img_ok);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_RIGHT != 0
|
||||
lv_img_create_file("icon_right", img_right);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_SETTINGS != 0
|
||||
lv_img_create_file("icon_settings", img_settings);
|
||||
#endif
|
||||
|
||||
#if USE_IMG_UP != 0
|
||||
lv_img_create_file("icon_up", img_up);
|
||||
#endif
|
||||
}
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lvgl/lv_objx/lv_label.h"
|
||||
|
||||
#include "lvgl/lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <lvgl/lv_obj/lv_dispi.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <lvgl/lv_objx/lv_btn.h>
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <lvgl/lv_objx/lv_label.h>
|
||||
#include <lvgl/lv_objx/lv_page.h>
|
||||
#include <lvgl/lv_objx/lv_ta.h>
|
||||
#include <misc/others/color.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* Use LV_DOWNSCALE to compensate
|
||||
* the down scaling effect of antialiassing*/
|
||||
#define LV_ANTIALIAS 1
|
||||
#define LV_FONT_ANTIALIAS 0
|
||||
#define FONT_ANTIALIAS 0
|
||||
/*Set the downscaling value*/
|
||||
#if LV_ANTIALIAS == 0
|
||||
#define LV_DOWNSCALE 1
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/circ.h>
|
||||
#include <misc/gfx/circ.h>
|
||||
#include "lv_conf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "lvgl/lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "lv_draw.h"
|
||||
#include "misc/fs/fsint.h"
|
||||
#include "misc/math/math_base.h"
|
||||
@@ -246,7 +246,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
|
||||
pos.y = cords_p->y1;
|
||||
|
||||
/*Align the line to middle if enabled*/
|
||||
if(style->txt_align != 0) {
|
||||
if(style->txt_align == LV_TXT_ALIGN_MID) {
|
||||
line_length = txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->letter_space, flag);
|
||||
pos.x += (w - line_length) / 2;
|
||||
@@ -263,7 +263,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
|
||||
for(i = line_start; i < line_end; i++) {
|
||||
/*Handle the recolor command*/
|
||||
/*Handle the re-color command*/
|
||||
if((flag & TXT_FLAG_RECOLOR) != 0) {
|
||||
if(txt[i] == TXT_RECOLOR_CMD) {
|
||||
if(cmd_state == CMD_STATE_WAIT) { /*Start char*/
|
||||
@@ -300,7 +300,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
|
||||
|
||||
if(cmd_state == CMD_STATE_IN) letter_fp(&pos, mask_p, font, txt[i], recolor, style->opa);
|
||||
else letter_fp(&pos, mask_p, font, txt[i], style->ccolor, style->opa);
|
||||
pos.x += (font_get_width(font, txt[i]) >> LV_FONT_ANTIALIAS) + style->letter_space;
|
||||
pos.x += (font_get_width(font, txt[i]) >> FONT_ANTIALIAS) + style->letter_space;
|
||||
}
|
||||
/*Go to next line*/
|
||||
line_start = line_end;
|
||||
@@ -308,13 +308,13 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
|
||||
|
||||
pos.x = cords_p->x1;
|
||||
/*Align to middle*/
|
||||
if(style->txt_align != 0) {
|
||||
if(style->txt_align == LV_TXT_ALIGN_MID) {
|
||||
line_length = txt_get_width(&txt[line_start], line_end - line_start,
|
||||
font, style->letter_space, flag);
|
||||
pos.x += (w - line_length) / 2;
|
||||
}
|
||||
/*Go the next line position*/
|
||||
pos.y += font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
pos.y += font_get_height(font) >> FONT_ANTIALIAS;
|
||||
pos.y += style->line_space;
|
||||
}
|
||||
}
|
||||
@@ -1061,17 +1061,17 @@ static void lv_draw_cont_shadow(const area_t * cords_p, const area_t * mask_p, c
|
||||
shadow_style.empty = 1;
|
||||
shadow_style.bwidth = swidth;
|
||||
shadow_style.radius = style->radius;
|
||||
if(shadow_style.radius == LV_CONT_CIRCLE) {
|
||||
if(shadow_style.radius == LV_DRAW_CIRCLE) {
|
||||
shadow_style.radius = MATH_MIN(area_get_width(cords_p), area_get_height(cords_p));
|
||||
}
|
||||
shadow_style.radius += swidth + 1;
|
||||
shadow_style.bcolor = style->scolor;
|
||||
shadow_style.bopa = 100;
|
||||
shadow_style.bopa = style->opa;
|
||||
|
||||
shadow_area.x1 -= swidth;
|
||||
shadow_area.y1 -= swidth;
|
||||
shadow_area.x2 += swidth;
|
||||
shadow_area.y2 += swidth;
|
||||
shadow_area.x1 -= swidth - 1;
|
||||
shadow_area.y1 -= swidth - 1;
|
||||
shadow_area.x2 += swidth - 1;
|
||||
shadow_area.y2 += swidth - 1;
|
||||
|
||||
cord_t i;
|
||||
shadow_style.opa = style->opa / (swidth / res);
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "misc_conf.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "../lv_obj/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_CONT_CIRCLE ((cord_t)-1) /*A very big radius to always draw as circle*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_draw_rbasic.h"
|
||||
#include "lv_conf.h"
|
||||
#include "hal/disp/disp.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -59,8 +59,7 @@ void lv_rfill(const area_t * cords_p, const area_t * mask_p,
|
||||
|
||||
|
||||
if(union_ok != false){
|
||||
disp_area(DISP_ID_ALL, masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2);
|
||||
disp_fill(DISP_ID_ALL, color);
|
||||
disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +80,7 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
const uint8_t * bitmap_p = font_get_bitmap(font_p, letter);
|
||||
|
||||
uint8_t col, col_sub, row;
|
||||
|
||||
#if FONT_ANTIALIAS == 0
|
||||
for(row = 0; row < font_p->height_row; row ++) {
|
||||
for(col = 0, col_sub = 7; col < w; col ++, col_sub--) {
|
||||
if(*bitmap_p & (1 << col_sub)) {
|
||||
@@ -99,6 +98,48 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
/*Go to the next row*/
|
||||
bitmap_p ++;
|
||||
}
|
||||
#else
|
||||
const uint8_t * map1_p = bitmap_p;
|
||||
const uint8_t * map2_p = bitmap_p + font_p->width_byte;
|
||||
uint8_t px_cnt;
|
||||
uint8_t col_byte_cnt;
|
||||
for(row = 0; row < (font_p->height_row >> 1); row ++) {
|
||||
col_byte_cnt = 0;
|
||||
col_sub = 7;
|
||||
for(col = 0; col < (w >> 1); col ++) {
|
||||
|
||||
px_cnt = 0;
|
||||
if((*map1_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if(col_sub != 0) col_sub --;
|
||||
else {
|
||||
col_sub = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
if((*map1_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if(col_sub != 0) col_sub --;
|
||||
else {
|
||||
col_sub = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
|
||||
|
||||
if(px_cnt != 0) {
|
||||
lv_rpx(pos_p->x + col, pos_p->y + row, mask_p, color_mix(color, COLOR_SILVER, 63 * px_cnt));
|
||||
}
|
||||
}
|
||||
|
||||
map1_p += font_p->width_byte;
|
||||
map2_p += font_p->width_byte;
|
||||
map1_p += font_p->width_byte - col_byte_cnt;
|
||||
map2_p += font_p->width_byte - col_byte_cnt;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,11 +172,10 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p,
|
||||
|
||||
if(transp == false) {
|
||||
cord_t row;
|
||||
cord_t mask_w = area_get_width(&masked_a) - 1;
|
||||
for(row = 0; row < area_get_height(&masked_a); row++) {
|
||||
cord_t col;
|
||||
for(col = 0; col < area_get_width(&masked_a); col ++) {
|
||||
lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col]);
|
||||
}
|
||||
disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p);
|
||||
|
||||
map_p += map_width;
|
||||
}
|
||||
}else {
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "misc/others/color.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <lvgl/lv_misc/font.h>
|
||||
#include <misc/others/color.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <misc/gfx/font.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -66,13 +66,13 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
|
||||
/*If there are common part of the three area then draw to the vdb*/
|
||||
if(union_ok == true) {
|
||||
area_t vdb_rel_a; /*Stores relative coordinates on vdb*/
|
||||
vdb_rel_a.x1 = res_a.x1 - vdb_p->vdb_area.x1;
|
||||
vdb_rel_a.y1 = res_a.y1 - vdb_p->vdb_area.y1;
|
||||
vdb_rel_a.x2 = res_a.x2 - vdb_p->vdb_area.x1;
|
||||
vdb_rel_a.y2 = res_a.y2 - vdb_p->vdb_area.y1;
|
||||
vdb_rel_a.x1 = res_a.x1 - vdb_p->area.x1;
|
||||
vdb_rel_a.y1 = res_a.y1 - vdb_p->area.y1;
|
||||
vdb_rel_a.x2 = res_a.x2 - vdb_p->area.x1;
|
||||
vdb_rel_a.y2 = res_a.y2 - vdb_p->area.y1;
|
||||
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
uint32_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
uint32_t vdb_width = area_get_width(&vdb_p->area);
|
||||
/*Move the vdb_tmp to the first row*/
|
||||
vdb_buf_tmp += vdb_width * vdb_rel_a.y1;
|
||||
|
||||
@@ -142,7 +142,7 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
|
||||
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
cord_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
cord_t vdb_width = area_get_width(&vdb_p->area);
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
cord_t col, row;
|
||||
uint8_t col_bit;
|
||||
@@ -151,27 +151,29 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
/* Calculate the col/row start/end on the map
|
||||
* If font anti alaiassing is enabled use the reduced letter sizes*/
|
||||
cord_t col_start = pos_p->x > mask_p->x1 ? 0 : mask_p->x1 - pos_p->x;
|
||||
cord_t col_end = pos_p->x + (letter_w >> LV_FONT_ANTIALIAS) < mask_p->x2 ? (letter_w >> LV_FONT_ANTIALIAS) : mask_p->x2 - pos_p->x + 1;
|
||||
cord_t col_end = pos_p->x + (letter_w >> FONT_ANTIALIAS) < mask_p->x2 ? (letter_w >> FONT_ANTIALIAS) : mask_p->x2 - pos_p->x + 1;
|
||||
cord_t row_start = pos_p->y > mask_p->y1 ? 0 : mask_p->y1 - pos_p->y;
|
||||
cord_t row_end = pos_p->y + (letter_h >> LV_FONT_ANTIALIAS) < mask_p->y2 ? (letter_h >> LV_FONT_ANTIALIAS) : mask_p->y2 - pos_p->y + 1;
|
||||
cord_t row_end = pos_p->y + (letter_h >> FONT_ANTIALIAS) < mask_p->y2 ? (letter_h >> FONT_ANTIALIAS) : mask_p->y2 - pos_p->y + 1;
|
||||
|
||||
/*Set a pointer on VDB to the first pixel of the letter*/
|
||||
vdb_buf_tmp += ((pos_p->y - vdb_p->vdb_area.y1) * vdb_width)
|
||||
+ pos_p->x - vdb_p->vdb_area.x1;
|
||||
vdb_buf_tmp += ((pos_p->y - vdb_p->area.y1) * vdb_width)
|
||||
+ pos_p->x - vdb_p->area.x1;
|
||||
|
||||
/*If the letter is partially out of mask the move there on VDB*/
|
||||
vdb_buf_tmp += (row_start * vdb_width) + col_start;
|
||||
|
||||
/*Move on the map too*/
|
||||
map_p += ((row_start << LV_FONT_ANTIALIAS) * font_p->width_byte) + ((col_start << LV_FONT_ANTIALIAS) >> 3);
|
||||
map_p += ((row_start << FONT_ANTIALIAS) * font_p->width_byte) + ((col_start << FONT_ANTIALIAS) >> 3);
|
||||
|
||||
#if LV_FONT_ANTIALIAS != 0
|
||||
#if FONT_ANTIALIAS != 0
|
||||
opa_t opa_tmp = opa;
|
||||
if(opa_tmp != OPA_COVER) opa_tmp = opa_tmp >> 2; /*Opacity per pixel (used when sum the pixels)*/
|
||||
const uint8_t * map1_p = map_p;
|
||||
const uint8_t * map2_p = map_p + font_p->width_byte;
|
||||
uint8_t px_cnt;
|
||||
for(row = row_start; row < row_end; row ++) {
|
||||
col_byte_cnt = 0;
|
||||
col_bit = 7 - ((col_start << LV_FONT_ANTIALIAS) % 8);
|
||||
col_bit = 7 - ((col_start << FONT_ANTIALIAS) % 8);
|
||||
for(col = col_start; col < col_end; col ++) {
|
||||
|
||||
px_cnt = 0;
|
||||
@@ -197,7 +199,7 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
|
||||
if(px_cnt != 0) {
|
||||
if(opa == OPA_COVER) *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, 63*px_cnt);
|
||||
else *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, opa);
|
||||
else *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, opa_tmp * px_cnt);
|
||||
}
|
||||
|
||||
vdb_buf_tmp++;
|
||||
@@ -276,12 +278,12 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
|
||||
/*Stores coordinates relative to the act vdb*/
|
||||
masked_a.x1 = masked_a.x1 - vdb_p->vdb_area.x1;
|
||||
masked_a.y1 = masked_a.y1 - vdb_p->vdb_area.y1;
|
||||
masked_a.x2 = masked_a.x2 - vdb_p->vdb_area.x1;
|
||||
masked_a.y2 = masked_a.y2 - vdb_p->vdb_area.y1;
|
||||
masked_a.x1 = masked_a.x1 - vdb_p->area.x1;
|
||||
masked_a.y1 = masked_a.y1 - vdb_p->area.y1;
|
||||
masked_a.x2 = masked_a.x2 - vdb_p->area.x1;
|
||||
masked_a.y2 = masked_a.y2 - vdb_p->area.y1;
|
||||
|
||||
cord_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
cord_t vdb_width = area_get_width(&vdb_p->area);
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
#if LV_VDB_SIZE != 0
|
||||
|
||||
#include "misc/others/color.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <lvgl/lv_draw/lv_draw.h>
|
||||
#include <lvgl/lv_misc/anim.h>
|
||||
#include <misc/gfx/anim.h>
|
||||
#include <lvgl/lv_obj/lv_dispi.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <lvgl/lv_obj/lv_refr.h>
|
||||
@@ -1440,7 +1440,7 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
|
||||
|
||||
uint16_t r = style->radius;
|
||||
|
||||
if(r == LV_CONT_CIRCLE) return false;
|
||||
if(r == LV_DRAW_CIRCLE) return false;
|
||||
|
||||
area_t area_tmp;
|
||||
|
||||
|
||||
@@ -9,17 +9,19 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include "lv_conf.h"
|
||||
#include <misc/gfx/area.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "misc/mem/dyn_mem.h"
|
||||
#include "misc/mem/linked_list.h"
|
||||
#include "misc/others/color.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/*Error check of lv_conf.h*/
|
||||
#if LV_HOR_RES == 0 || LV_VER_RES == 0
|
||||
#error "LV: LV_HOR_RES and LV_VER_RES must be greater then 0"
|
||||
|
||||
@@ -230,12 +230,12 @@ static void lv_refr_area_with_vdb(const area_t * area_p)
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
|
||||
/*Always use the full row*/
|
||||
vdb_p->vdb_area.x1 = area_p->x1;
|
||||
vdb_p->vdb_area.y1 = area_p->y1;
|
||||
vdb_p->vdb_area.x2 = area_p->x2;
|
||||
vdb_p->area.x1 = area_p->x1;
|
||||
vdb_p->area.y1 = area_p->y1;
|
||||
vdb_p->area.x2 = area_p->x2;
|
||||
|
||||
/*Calculate the max row num*/
|
||||
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (vdb_p->vdb_area.x2 - vdb_p->vdb_area.x1 + 1);
|
||||
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (vdb_p->area.x2 - vdb_p->area.x1 + 1);
|
||||
if(max_row > area_get_height(area_p)) max_row = area_get_height(area_p);
|
||||
|
||||
/*Round the row number with downscale*/
|
||||
@@ -248,17 +248,17 @@ static void lv_refr_area_with_vdb(const area_t * area_p)
|
||||
|
||||
for(row = area_p->y1; row + max_row - 1 <= area_p->y2; row += max_row) {
|
||||
/*Calc. the next y coordinates of VDB*/
|
||||
vdb_p->vdb_area.y1 = row;
|
||||
vdb_p->vdb_area.y2 = row + max_row - 1;
|
||||
vdb_p->area.y1 = row;
|
||||
vdb_p->area.y2 = row + max_row - 1;
|
||||
|
||||
lv_refr_area_part_vdb(area_p);
|
||||
}
|
||||
|
||||
/*If the last y coordinates are not handled yet ...*/
|
||||
if(area_p->y2 != vdb_p->vdb_area.y2) {
|
||||
if(area_p->y2 != vdb_p->area.y2) {
|
||||
/*Calc. the next y coordinates of VDB*/
|
||||
vdb_p->vdb_area.y1 = row;
|
||||
vdb_p->vdb_area.y2 = area_p->y2;
|
||||
vdb_p->area.y1 = row;
|
||||
vdb_p->area.y2 = area_p->y2;
|
||||
|
||||
/*Refresh this part too*/
|
||||
lv_refr_area_part_vdb(area_p);
|
||||
@@ -277,7 +277,7 @@ static void lv_refr_area_part_vdb(const area_t * area_p)
|
||||
/*Get the new mask from the original area and the act. VDB
|
||||
It will be a part of 'area_p'*/
|
||||
area_t start_mask;
|
||||
area_union(&start_mask, area_p, &vdb_p->vdb_area);
|
||||
area_union(&start_mask, area_p, &vdb_p->area);
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act());
|
||||
|
||||
@@ -33,8 +33,6 @@ static lv_style_t lv_style_plain;
|
||||
static lv_style_t lv_style_plain_color;
|
||||
static lv_style_t lv_style_pretty;
|
||||
static lv_style_t lv_style_pretty_color;
|
||||
//static lv_style_t lv_style_focus;
|
||||
//static lv_style_t lv_style_focus_color;
|
||||
static lv_style_t lv_style_btn_rel;
|
||||
static lv_style_t lv_style_btn_pr;
|
||||
static lv_style_t lv_style_btn_trel;
|
||||
@@ -54,10 +52,13 @@ static lv_style_t lv_style_btn_ina;
|
||||
*/
|
||||
void lv_style_init (void)
|
||||
{
|
||||
|
||||
/* Not White/Black/Gray colors are created by HSV model with
|
||||
* HUE = 210*/
|
||||
|
||||
/*Screen style*/
|
||||
lv_style_set_ccolor(&lv_style_scr, COLOR_MAKE(0x20, 0x20, 0x20));
|
||||
lv_style_set_opa(&lv_style_scr, OPA_COVER);
|
||||
lv_style_set_opa_prop(&lv_style_scr, true);
|
||||
|
||||
lv_style_set_mcolor(&lv_style_scr, COLOR_WHITE);
|
||||
lv_style_set_gcolor(&lv_style_scr, COLOR_WHITE);
|
||||
@@ -66,15 +67,15 @@ void lv_style_init (void)
|
||||
lv_style_set_radius(&lv_style_scr, 0);
|
||||
lv_style_set_bwidth(&lv_style_scr, 0);
|
||||
lv_style_set_swidth(&lv_style_scr, 0);
|
||||
lv_style_set_vpad(&lv_style_scr, LV_DPI / 6);
|
||||
lv_style_set_hpad(&lv_style_scr, LV_DPI / 4);
|
||||
lv_style_set_opad(&lv_style_scr, LV_DPI / 6);
|
||||
lv_style_set_vpad(&lv_style_scr, LV_DPI / 8);
|
||||
lv_style_set_hpad(&lv_style_scr, LV_DPI / 8);
|
||||
lv_style_set_opad(&lv_style_scr, LV_DPI / 8);
|
||||
lv_style_set_bopa(&lv_style_scr, OPA_COVER);
|
||||
lv_style_set_empty(&lv_style_scr, false);
|
||||
|
||||
lv_style_set_font(&lv_style_scr, font_get(LV_FONT_DEFAULT));
|
||||
lv_style_set_font(&lv_style_scr, font_get(FONT_DEFAULT));
|
||||
lv_style_set_letter_space(&lv_style_scr, 1 * LV_DOWNSCALE);
|
||||
lv_style_set_line_space(&lv_style_scr, 5 * LV_DOWNSCALE);
|
||||
lv_style_set_line_space(&lv_style_scr, 2 * LV_DOWNSCALE);
|
||||
lv_style_set_txt_align(&lv_style_scr, 0);
|
||||
|
||||
lv_style_set_img_recolor(&lv_style_scr, OPA_TRANSP);
|
||||
@@ -86,27 +87,28 @@ void lv_style_init (void)
|
||||
|
||||
/*Plain color style*/
|
||||
memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_set_ccolor(&lv_style_plain_color, COLOR_RED);//MAKE(0xf0, 0xf0, 0xf0));
|
||||
lv_style_set_mcolor(&lv_style_plain_color, COLOR_MAKE(0x40, 0x60, 0x80));
|
||||
lv_style_set_gcolor(&lv_style_plain_color, COLOR_MAKE(0x40, 0x60, 0x80));
|
||||
lv_style_set_ccolor(&lv_style_plain_color, COLOR_MAKE(0xf0, 0xf0, 0xf0));
|
||||
lv_style_set_mcolor(&lv_style_plain_color, COLOR_MAKE(0x55, 0x96, 0xd8));
|
||||
lv_style_set_gcolor(&lv_style_plain_color, lv_style_plain_color.mcolor);
|
||||
|
||||
/*Pretty style */
|
||||
memcpy(&lv_style_pretty, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_set_ccolor(&lv_style_pretty, COLOR_MAKE(0x20, 0x20, 0x20));
|
||||
lv_style_set_mcolor(&lv_style_pretty, COLOR_WHITE);
|
||||
lv_style_set_gcolor(&lv_style_pretty, COLOR_SILVER);
|
||||
lv_style_set_bcolor(&lv_style_pretty, COLOR_GRAY);
|
||||
lv_style_set_bcolor(&lv_style_pretty, COLOR_MAKE(0x40, 0x40, 0x40));
|
||||
lv_style_set_radius(&lv_style_pretty, LV_DPI / 10);
|
||||
lv_style_set_bwidth(&lv_style_pretty, LV_DPI / 20 >= 1 ? LV_DPI / 30 >= 1 : 1);
|
||||
// lv_style_set_swidth(&lv_style_pretty, LV_DPI / 6);
|
||||
// lv_style_set_scolor(&lv_style_pretty, COLOR_BLACK);
|
||||
lv_style_set_bwidth(&lv_style_pretty, LV_DPI / 30 >= 1 ? LV_DPI / 30 : 1);
|
||||
lv_style_set_bopa(&lv_style_pretty, OPA_50);
|
||||
|
||||
/*Pretty color style*/
|
||||
memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t));
|
||||
lv_style_set_ccolor(&lv_style_pretty_color, COLOR_RED);//MAKE(0xf0, 0xf0, 0xf0));
|
||||
lv_style_set_mcolor(&lv_style_pretty_color, COLOR_WHITE);
|
||||
lv_style_set_gcolor(&lv_style_pretty_color, COLOR_CYAN);
|
||||
lv_style_set_scolor(&lv_style_pretty_color, COLOR_BLACK);
|
||||
lv_style_set_swidth(&lv_style_pretty_color, LV_DPI / 2);
|
||||
lv_style_set_ccolor(&lv_style_pretty_color, COLOR_MAKE(0xe0, 0xe0, 0xe0));
|
||||
lv_style_set_gcolor(&lv_style_pretty_color, COLOR_MAKE(0x2b, 0x59, 0x8b));
|
||||
lv_style_set_mcolor(&lv_style_pretty_color, COLOR_MAKE(0x90, 0xb3, 0xd5));
|
||||
lv_style_set_bcolor(&lv_style_pretty_color, COLOR_MAKE(0x15, 0x2c, 0x42));
|
||||
lv_style_set_scolor(&lv_style_pretty_color, COLOR_MAKE(0x6a, 0x8f, 0xb4));
|
||||
lv_style_set_swidth(&lv_style_pretty_color, 0);
|
||||
|
||||
/*Transparent style*/
|
||||
memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t));
|
||||
@@ -120,27 +122,44 @@ void lv_style_init (void)
|
||||
|
||||
/*Button released style*/
|
||||
memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_set_mcolor(&lv_style_btn_rel, COLOR_WHITE);
|
||||
lv_style_set_gcolor(&lv_style_btn_rel, COLOR_GRAY);
|
||||
lv_style_set_mcolor(&lv_style_btn_rel, COLOR_MAKE(0x76, 0xa2, 0xd0));
|
||||
lv_style_set_gcolor(&lv_style_btn_rel, COLOR_MAKE(0x19, 0x3a, 0x5d));
|
||||
lv_style_set_bcolor(&lv_style_btn_rel, COLOR_MAKE(0x0b, 0x19, 0x28));
|
||||
lv_style_set_ccolor(&lv_style_btn_rel, COLOR_MAKE(0xff, 0xff, 0xff));
|
||||
lv_style_set_bwidth(&lv_style_btn_rel, LV_DPI / 30 >= 1 ? LV_DPI / 30 : 1);
|
||||
lv_style_set_radius(&lv_style_btn_rel, LV_DPI / 10);
|
||||
lv_style_set_bopa(&lv_style_btn_rel, OPA_70);
|
||||
lv_style_set_scolor(&lv_style_btn_rel, COLOR_GRAY);
|
||||
lv_style_set_swidth(&lv_style_btn_rel, 0);
|
||||
lv_style_set_hpad(&lv_style_btn_rel, LV_DPI / 3);
|
||||
lv_style_set_vpad(&lv_style_btn_rel, LV_DPI / 4);
|
||||
lv_style_set_opad(&lv_style_btn_rel, LV_DPI / 6);
|
||||
|
||||
/*Button pressed style*/
|
||||
memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_set_mcolor(&lv_style_btn_pr, COLOR_BLACK);
|
||||
lv_style_set_ccolor(&lv_style_btn_pr, COLOR_SILVER);
|
||||
lv_style_set_scolor(&lv_style_btn_pr, COLOR_GRAY);
|
||||
lv_style_set_swidth(&lv_style_btn_pr, 10);
|
||||
lv_style_set_mcolor(&lv_style_btn_pr, COLOR_MAKE(0x33, 0x62, 0x94));
|
||||
lv_style_set_gcolor(&lv_style_btn_pr, COLOR_MAKE(0x10, 0x26, 0x3c));
|
||||
lv_style_set_ccolor(&lv_style_btn_pr, COLOR_MAKE(0xa4, 0xb5, 0xc6));
|
||||
|
||||
/*Button toggle released style*/
|
||||
memcpy(&lv_style_btn_trel, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_set_mcolor(&lv_style_btn_trel, COLOR_LIME);
|
||||
lv_style_set_gcolor(&lv_style_btn_trel, COLOR_MAKE(0x37, 0x62, 0x90));
|
||||
lv_style_set_mcolor(&lv_style_btn_trel, COLOR_MAKE(0x0a, 0x11, 0x22));
|
||||
lv_style_set_bcolor(&lv_style_btn_trel, COLOR_MAKE(0x01, 0x07, 0x0d));
|
||||
lv_style_set_ccolor(&lv_style_btn_trel, COLOR_MAKE(0xc8, 0xdd, 0xf4));
|
||||
|
||||
/*Button toggle pressed style*/
|
||||
memcpy(&lv_style_btn_tpr, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_set_mcolor(&lv_style_btn_tpr, COLOR_GREEN);
|
||||
lv_style_set_gcolor(&lv_style_btn_tpr, COLOR_MAKE(0x2b, 0x4c, 0x70));
|
||||
lv_style_set_mcolor(&lv_style_btn_tpr, COLOR_MAKE(0x02, 0x14, 0x27));
|
||||
lv_style_set_ccolor(&lv_style_btn_tpr, COLOR_MAKE(0xa4, 0xb5, 0xc6));
|
||||
|
||||
/*Button inactive style*/
|
||||
memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_set_mcolor(&lv_style_btn_ina, COLOR_YELLOW);
|
||||
lv_style_set_gcolor(&lv_style_btn_ina, COLOR_MAKE(0xd8, 0xd8, 0xd8));
|
||||
lv_style_set_mcolor(&lv_style_btn_ina, COLOR_MAKE(0xd8, 0xd8, 0xd8));
|
||||
lv_style_set_bcolor(&lv_style_btn_ina, COLOR_MAKE(0x90, 0x90, 0x90));
|
||||
lv_style_set_ccolor(&lv_style_btn_ina, COLOR_MAKE(0x70, 0x70, 0x70));
|
||||
}
|
||||
|
||||
|
||||
@@ -219,15 +238,6 @@ void lv_style_set_opa(lv_style_t * style, opa_t opa)
|
||||
style->opa = opa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the proportional opacity attribute of a style (make the opacity relative to the parent)
|
||||
* @param style pointer to style
|
||||
* @param opa_prop true: enabled, false: disabled
|
||||
*/
|
||||
void lv_style_set_opa_prop(lv_style_t * style, bool opa_prop)
|
||||
{
|
||||
style->opa_prop = opa_prop == false ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the container main color of a style
|
||||
@@ -391,9 +401,9 @@ void lv_style_set_line_space(lv_style_t * style, cord_t line_space)
|
||||
/**
|
||||
* Set the text align of a style
|
||||
* @param style pointer to style
|
||||
* @param align TODO
|
||||
* @param align type of text alignment from 'lv_txt_align_t'
|
||||
*/
|
||||
void lv_style_set_txt_align(lv_style_t * style, uint8_t align)
|
||||
void lv_style_set_txt_align(lv_style_t * style, lv_txt_align_t align)
|
||||
{
|
||||
style->txt_align = align;
|
||||
}
|
||||
@@ -443,16 +453,6 @@ opa_t lv_style_get_opa(lv_style_t * style)
|
||||
return style->opa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the proportional opacity attribute of a style (make the opacity relative to the parent)
|
||||
* @param style pointer to style
|
||||
* @return true: enabled, false: disabled
|
||||
*/
|
||||
bool lv_style_get_opa_prop(lv_style_t * style)
|
||||
{
|
||||
return style->opa_prop == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the container main color of a style
|
||||
* @param style pointer to style
|
||||
@@ -615,9 +615,9 @@ cord_t lv_style_get_line_space(lv_style_t * style)
|
||||
/**
|
||||
* Get the text align of a style
|
||||
* @param style pointer to style
|
||||
* @return TODO
|
||||
* @return type of text alignment from 'lv_txt_align_t'
|
||||
*/
|
||||
uint8_t lv_style_get_txt_align(lv_style_t * style)
|
||||
lv_txt_align_t lv_style_get_txt_align(lv_style_t * style)
|
||||
{
|
||||
return style->txt_align;
|
||||
}
|
||||
|
||||
@@ -10,23 +10,29 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
#include "misc/others/color.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_DRAW_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_TXT_ALIGN_LEFT = 0,
|
||||
LV_TXT_ALIGN_MID,
|
||||
}lv_txt_align_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*Object level styles*/
|
||||
color_t ccolor; /*Content color (e.g. text or image re-color )*/
|
||||
opa_t opa; /*Opacity of the object*/
|
||||
uint8_t opa_prop:1; /*Opacity is proportional to the parent*/
|
||||
uint8_t empty :1; /*Transparent background (border drawn)*/
|
||||
color_t mcolor; /*Main color of background*/
|
||||
color_t gcolor; /*Gradient color of background*/
|
||||
@@ -320,7 +326,7 @@ void lv_style_clear_line_space(lv_style_t * style);
|
||||
* @param style pointer to style
|
||||
* @param align TODO
|
||||
*/
|
||||
void lv_style_set_txt_align(lv_style_t * style, uint8_t align);
|
||||
void lv_style_set_txt_align(lv_style_t * style, lv_txt_align_t align);
|
||||
|
||||
/**
|
||||
* Clear the text align of a style (it will be inherited from the parent style)
|
||||
|
||||
@@ -53,8 +53,7 @@ lv_vdb_t * lv_vdb_get(void)
|
||||
void lv_vdb_flush(void)
|
||||
{
|
||||
#if LV_ANTIALIAS == 0
|
||||
disp_area(DISP_ID_ALL, vdb.vdb_area.x1 , vdb.vdb_area.y1, vdb.vdb_area.x2, vdb.vdb_area.y2);
|
||||
disp_map(DISP_ID_ALL, vdb.buf);
|
||||
disp_map(vdb.area.x1, vdb.area.y1, vdb.area.x2, vdb.area.y2, vdb.buf);
|
||||
#else
|
||||
/* Get the average of 2x2 pixels and put the result back to the VDB
|
||||
* The reading goes much faster then the write back
|
||||
@@ -69,12 +68,12 @@ void lv_vdb_flush(void)
|
||||
* */
|
||||
cord_t x;
|
||||
cord_t y;
|
||||
cord_t w = area_get_width(&vdb.vdb_area);
|
||||
cord_t w = area_get_width(&vdb.area);
|
||||
color_t * in1_buf = vdb.buf; /*Pointer to the first row*/
|
||||
color_t * in2_buf = vdb.buf + w; /*Pointer to the second row*/
|
||||
color_t * out_buf = vdb.buf; /*Store the result here*/
|
||||
for(y = vdb.vdb_area.y1; y < vdb.vdb_area.y2; y += 2) {
|
||||
for(x = vdb.vdb_area.x1; x < vdb.vdb_area.x2; x += 2) {
|
||||
for(y = vdb.area.y1; y < vdb.area.y2; y += 2) {
|
||||
for(x = vdb.area.x1; x < vdb.area.x2; x += 2) {
|
||||
|
||||
/*If the pixels are the same do not calculate the average */
|
||||
if(in1_buf->full == (in1_buf + 1)->full &&
|
||||
@@ -104,8 +103,7 @@ void lv_vdb_flush(void)
|
||||
|
||||
/* Now the full the VDB is filtered and the result is stored in the first quarter of it
|
||||
* Write out the filtered map to the display*/
|
||||
disp_area(DISP_ID_ALL, vdb.vdb_area.x1 >> 1, vdb.vdb_area.y1 >> 1, vdb.vdb_area.x2 >> 1, vdb.vdb_area.y2 >> 1);
|
||||
disp_map(DISP_ID_ALL, vdb.buf);
|
||||
disp_map(vdb.area.x1 >> 1, vdb.area.y1 >> 1, vdb.area.x2 >> 1, vdb.area.y2 >> 1, vdb.buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
|
||||
#if LV_VDB_SIZE != 0
|
||||
|
||||
#include "misc/others/color.h"
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -27,7 +26,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
area_t vdb_area;
|
||||
area_t area;
|
||||
color_t buf[LV_VDB_SIZE];
|
||||
}lv_vdb_t;
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_set_click(new_bar, false);
|
||||
lv_obj_set_size(new_bar, LV_BAR_DEF_WIDTH, LV_BAR_DEF_HEIGHT);
|
||||
lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
|
||||
lv_bar_set_value(new_bar, ext->act_value);
|
||||
} else {
|
||||
lv_bar_ext_t * ext_copy = lv_obj_get_ext(copy);
|
||||
@@ -106,11 +105,15 @@ bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_cont_signal(bar, sign, param);
|
||||
valid = lv_obj_signal(bar, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
if(style_indic->swidth > bar->ext_size) bar->ext_size = style_indic->swidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,7 +134,6 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value)
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
ext->act_value = value > ext->max_value ? ext->max_value : value;
|
||||
ext->act_value = ext->act_value < ext->min_value ? ext->min_value : ext->act_value;
|
||||
|
||||
lv_obj_inv(bar);
|
||||
}
|
||||
|
||||
@@ -155,7 +157,7 @@ void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
|
||||
|
||||
/**
|
||||
* Set the style of bar indicator
|
||||
* @param bar pointer to a bar obeject
|
||||
* @param bar pointer to a bar object
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style)
|
||||
@@ -164,6 +166,8 @@ void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style)
|
||||
|
||||
ext->style_indic = style;
|
||||
|
||||
bar->signal_f(bar, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
|
||||
lv_obj_inv(bar);
|
||||
}
|
||||
|
||||
@@ -182,6 +186,28 @@ int16_t lv_bar_get_value(lv_obj_t * bar)
|
||||
return ext->act_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the minimum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_min_value(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
return ext->min_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the maximum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_max_value(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
return ext->max_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
@@ -213,29 +239,33 @@ lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar)
|
||||
static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return ancestor_design_f(bar, mask, mode);
|
||||
/*Return false if the object is not covers the mask area*/
|
||||
return ancestor_design_f(bar, mask, mode);;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_design_f(bar, mask, mode);
|
||||
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
area_t bar_area;
|
||||
area_cpy(&bar_area, &bar->cords);
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
area_t indic_area;
|
||||
area_cpy(&indic_area, &bar->cords);
|
||||
indic_area.x1 += style_indic->hpad;
|
||||
indic_area.x2 -= style_indic->hpad;
|
||||
indic_area.y1 += style_indic->vpad;
|
||||
indic_area.y2 -= style_indic->vpad;
|
||||
|
||||
cord_t w = lv_obj_get_width(bar);
|
||||
cord_t h = lv_obj_get_height(bar);
|
||||
cord_t w = area_get_width(&indic_area);
|
||||
cord_t h = area_get_height(&indic_area);
|
||||
|
||||
if(w >= h) {
|
||||
bar_area.x2 = (int32_t) ((int32_t)w * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
bar_area.x2 += bar_area.x1;
|
||||
indic_area.x2 = (int32_t) ((int32_t)w * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
indic_area.x2 += indic_area.x1;
|
||||
} else {
|
||||
bar_area.y1 = (int32_t) ((int32_t)h * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
bar_area.y1 = bar_area.y2 - bar_area.y1;
|
||||
indic_area.y1 = (int32_t) ((int32_t)h * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1;
|
||||
}
|
||||
|
||||
/*Draw the main bar*/
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
lv_draw_rect(&bar_area, mask, style_indic);
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&indic_area, mask, style_indic);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,15 +12,6 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BAR != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_bar: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
#error "lv_bar: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_btn.h"
|
||||
@@ -50,52 +41,71 @@ typedef struct
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a progress bar objects
|
||||
* @param par pointer to an object, it will be the parent of the new progress bar
|
||||
* @param copy pointer to a progress bar object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created progress bar
|
||||
* 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
|
||||
*/
|
||||
lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Signal function of the progress bar
|
||||
* @param bar pointer to a progress bar object
|
||||
* Signal function of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
*/
|
||||
bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set a new value on the progress bar
|
||||
* @param bar pointer to a progress bar object
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a progress bar
|
||||
* @param bar pointer to he progress bar object
|
||||
* Set minimum and the maximum values of a bar
|
||||
* @param bar pointer to he bar object
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
|
||||
|
||||
/**
|
||||
* Set format string for the label of the progress bar
|
||||
* @param bar pointer to progress bar object
|
||||
* @param format a printf-like format string with one number (e.g. "Loading (%d)")
|
||||
* Set the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_bar_set_format_str(lv_obj_t * bar, const char * format);
|
||||
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the value of a progress bar
|
||||
* @param bar pointer to a progress bar object
|
||||
* @return the value of the progress bar
|
||||
* Get the value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the minimum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the minimum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_min_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the maximum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the maximum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_max_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @return pointer to the bar indicator style
|
||||
*/
|
||||
lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar);
|
||||
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <misc/others/color.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if USE_LV_BTN != 0
|
||||
@@ -122,8 +122,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
bool tgl = lv_btn_get_tgl(btn);
|
||||
|
||||
switch (sign) {
|
||||
case LV_SIGNAL_PRESSED:
|
||||
if(sign == LV_SIGNAL_PRESSED) {
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_REL) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_PR);
|
||||
@@ -132,27 +131,24 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
ext->lpr_exec = 0;
|
||||
/*Call the press action, here 'param' is the caller dispi*/
|
||||
/*Call the press action, 'param' is the caller dispi*/
|
||||
if(ext->pr_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->pr_action(btn, param);
|
||||
}
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_PRESS_LOST:
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST) {
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
|
||||
break;
|
||||
case LV_SIGNAL_PRESSING:
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
/*When the button begins to drag revert pressed states to released*/
|
||||
if(lv_dispi_is_dragging(param) != false) {
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
}
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_RELEASED:
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
/*If not dragged and it was not long press action then
|
||||
*change state and run the action*/
|
||||
if(lv_dispi_is_dragging(param) == false && ext->lpr_exec == 0) {
|
||||
@@ -176,24 +172,19 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case LV_SIGNAL_LONG_PRESS:
|
||||
/*Call the long press action, here 'param' is the caller dispi*/
|
||||
}
|
||||
else if(sign == LV_SIGNAL_LONG_PRESS) {
|
||||
/*Call the long press action, 'param' is the caller dispi*/
|
||||
if(ext->lpr_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
ext->lpr_exec = 1;
|
||||
valid = ext->lpr_action(btn, param);
|
||||
}
|
||||
break;
|
||||
case LV_SIGNAL_LONG_PRESS_REP:
|
||||
/*Call the release action, here 'param' is the caller dispi*/
|
||||
}
|
||||
else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
/*Call the release action, 'param' is the caller dispi*/
|
||||
if(ext->lpr_rep_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->lpr_rep_action(btn, param);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*Do nothing*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +278,9 @@ void lv_btn_set_lpr_rep_action(lv_obj_t * btn, lv_action_t lpr_rep_action)
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_btn_set_styles(lv_obj_t * btn, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina)
|
||||
void lv_btn_set_styles(lv_obj_t * btn, lv_style_t * rel, lv_style_t * pr,
|
||||
lv_style_t * trel, lv_style_t * tpr,
|
||||
lv_style_t * ina)
|
||||
{
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
ext->styles[LV_BTN_STATE_REL] = rel;
|
||||
|
||||
@@ -119,6 +119,15 @@ void lv_btn_set_lpr_action(lv_obj_t * btn, lv_action_t lpr_action);
|
||||
*/
|
||||
void lv_btn_set_lpr_rep_action(lv_obj_t * btn, lv_action_t lpr_rep_action);
|
||||
|
||||
/**
|
||||
* Set styles of a button is each state
|
||||
* @param btn pointer to button object
|
||||
* @param rel pointer to a style for releases state
|
||||
* @param pr pointer to a style for pressed state
|
||||
* @param trel pointer to a style for toggled releases state
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_btn_set_styles(lv_obj_t * btn, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina);
|
||||
|
||||
/**
|
||||
@@ -135,7 +144,14 @@ lv_btn_state_t lv_btn_get_state(lv_obj_t * btn);
|
||||
*/
|
||||
bool lv_btn_get_tgl(lv_obj_t * btn);
|
||||
|
||||
/**
|
||||
* Get the style of a button in a given state
|
||||
* @param btn pointer to a button object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_state_t state);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "lv_btnm.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "../lv_obj/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
@@ -88,7 +88,11 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_btnm_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->style_btn_rel = copy_ext->style_btn_rel;
|
||||
ext->style_btn_pr = copy_ext->style_btn_pr;
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy));
|
||||
ext->cb = copy_ext->cb;
|
||||
}
|
||||
|
||||
return new_btnm;
|
||||
@@ -151,11 +155,12 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
ext->btn_pr = btn_pr;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
if(ext->cb != NULL &&
|
||||
ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
if(ext->cb != NULL && ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
uint16_t txt_i = 0;
|
||||
uint16_t btn_i = 0;
|
||||
/*Search the next valid text in the map*/
|
||||
|
||||
/* Search the text of ext->btn_pr the buttons text in the map
|
||||
* Skip "\n"-s*/
|
||||
while(btn_i != ext->btn_pr) {
|
||||
btn_i ++;
|
||||
txt_i ++;
|
||||
@@ -164,6 +169,7 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
|
||||
ext->cb(btnm, txt_i);
|
||||
}
|
||||
|
||||
if(sign == LV_SIGNAL_RELEASED && ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
/*Invalidate to old area*/;
|
||||
lv_obj_get_cords(btnm, &btnm_area);
|
||||
@@ -177,8 +183,12 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
ext->btn_pr = LV_BTNM_PR_NONE;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST) {
|
||||
ext->btn_pr = LV_BTNM_PR_NONE;
|
||||
lv_obj_inv(btnm);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
@@ -418,10 +428,10 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
while(strcmp(ext->map_p[txt_i], "\n") == 0) txt_i ++;
|
||||
|
||||
/*Calculate the size of the text*/
|
||||
const font_t * font = style->font;
|
||||
const font_t * font = btn_style->font;
|
||||
point_t txt_size;
|
||||
txt_get_size(&txt_size, ext->map_p[txt_i], font,
|
||||
style->letter_space, style->line_space,
|
||||
btn_style->letter_space, btn_style->line_space,
|
||||
area_get_width(&area_btnm), TXT_FLAG_NONE);
|
||||
|
||||
area_tmp.x1 += (btn_w - txt_size.x) / 2;
|
||||
@@ -429,7 +439,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
area_tmp.x2 = area_tmp.x1 + txt_size.x;
|
||||
area_tmp.y2 = area_tmp.y1 + txt_size.y;
|
||||
|
||||
lv_draw_label(&area_tmp, mask, style, ext->map_p[txt_i], TXT_FLAG_NONE);
|
||||
lv_draw_label(&area_tmp, mask, btn_style, ext->map_p[txt_i], TXT_FLAG_NONE);
|
||||
txt_i ++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,12 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map);
|
||||
*/
|
||||
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_callback_t cb);
|
||||
|
||||
/**
|
||||
* Set the styles of the buttons of the button matrox
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @param style pointer to style
|
||||
*/
|
||||
void lv_btnm_set_styles_btn(lv_obj_t * btnm, lv_style_t * rel, lv_style_t * pr);
|
||||
|
||||
/**
|
||||
@@ -110,7 +116,14 @@ const char ** lv_btnm_get_map(lv_obj_t * btnm);
|
||||
*/
|
||||
lv_btnm_callback_t lv_btnm_get_action(lv_obj_t * btnm);
|
||||
|
||||
/**
|
||||
* Get the style of buttons in button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @return pointer the button style in the given state
|
||||
*/
|
||||
lv_style_t * lv_btnm_get_style_btn(lv_obj_t * btnm, lv_btn_state_t state);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -75,8 +75,9 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->vdiv_num = LV_CHART_VDIV_DEF;
|
||||
ext->pnum = LV_CHART_PNUM_DEF;
|
||||
ext->type = LV_CHART_LINE;
|
||||
ext->data_opa = OPA_COVER;
|
||||
ext->dark_eff = OPA_50;
|
||||
ext->dl_opa = OPA_COVER;
|
||||
ext->dl_dark = OPA_50;
|
||||
ext->dl_width = 2 * LV_DOWNSCALE;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_chart);
|
||||
|
||||
@@ -94,7 +95,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->hdiv_num = ext_copy->hdiv_num;
|
||||
ext->vdiv_num = ext_copy->vdiv_num;
|
||||
ext->pnum = ext_copy->pnum;
|
||||
ext->data_opa = ext_copy->data_opa;
|
||||
ext->dl_opa = ext_copy->dl_opa;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_chart);
|
||||
@@ -136,18 +137,16 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
|
||||
* Allocate and add a data line to the chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param color color of the data line
|
||||
* @param width line width/point radius/column width
|
||||
* @return pointer to the allocated data line (
|
||||
*/
|
||||
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color, cord_t width)
|
||||
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_chart_dl_t * dl = ll_ins_head(&ext->dl_ll);
|
||||
cord_t def = (ext->ymax - ext->ymin) >> 2; /*1/4 range as default value*/
|
||||
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
|
||||
|
||||
if(dl == NULL) return NULL;
|
||||
|
||||
dl->width = width;
|
||||
dl->color = color;
|
||||
|
||||
dl->points = dm_alloc(sizeof(cord_t) * ext->pnum);
|
||||
@@ -248,21 +247,33 @@ void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum)
|
||||
* @param chart pointer to chart object
|
||||
* @param opa opacity of the data lines
|
||||
*/
|
||||
void lv_chart_set_data_opa(lv_obj_t * chart, opa_t opa)
|
||||
void lv_chart_set_dl_opa(lv_obj_t * chart, opa_t opa)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->data_opa = opa;
|
||||
ext->dl_opa = opa;
|
||||
lv_obj_inv(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the line width or point radius of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param width the new width
|
||||
*/
|
||||
void lv_chart_set_dl_width(lv_obj_t * chart, cord_t width)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->dl_width = width;
|
||||
lv_obj_inv(chart);
|
||||
}
|
||||
/**
|
||||
* Set the dark effect on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
void lv_chart_set_drak_effect(lv_obj_t * chart, opa_t dark_eff)
|
||||
void lv_chart_set_dl_dark(lv_obj_t * chart, opa_t dark_eff)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->dark_eff = dark_eff;
|
||||
ext->dl_dark = dark_eff;
|
||||
}
|
||||
/**
|
||||
* Shift all data right and set the most right data on a data line
|
||||
@@ -318,10 +329,21 @@ uint16_t lv_chart_get_pnum(lv_obj_t * chart)
|
||||
* @param chart pointer to chart object
|
||||
* @return the opacity of the data lines
|
||||
*/
|
||||
opa_t lv_chart_get_data_opa(lv_obj_t * chart)
|
||||
opa_t lv_chart_get_dl_opa(lv_obj_t * chart)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->data_opa;
|
||||
return ext->dl_opa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data line width
|
||||
* @param chart pointer to chart object
|
||||
* @return the width the data lines (lines or points)
|
||||
*/
|
||||
cord_t lv_chart_get_dl_width(lv_obj_t * chart)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->dl_width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,10 +351,10 @@ opa_t lv_chart_get_data_opa(lv_obj_t * chart)
|
||||
* @param chart pointer to chart object
|
||||
* @return dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
opa_t lv_chart_get_dark_effect(lv_obj_t * chart, opa_t dark_eff)
|
||||
opa_t lv_chart_get_dl_dark(lv_obj_t * chart, opa_t dark_eff)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->dark_eff;
|
||||
return ext->dl_dark;
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
@@ -362,19 +384,9 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
|
||||
|
||||
lv_chart_draw_div(chart, mask);
|
||||
|
||||
switch(ext->type) {
|
||||
case LV_CHART_LINE:
|
||||
lv_chart_draw_lines(chart, mask);
|
||||
break;
|
||||
case LV_CHART_COL:
|
||||
lv_chart_draw_cols(chart, mask);
|
||||
break;
|
||||
case LV_CHART_POINT:
|
||||
lv_chart_draw_points(chart, mask);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(ext->type & LV_CHART_LINE) lv_chart_draw_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_COL) lv_chart_draw_cols(chart, mask);
|
||||
if(ext->type & LV_CHART_POINT) lv_chart_draw_points(chart, mask);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -433,14 +445,13 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
int32_t y_tmp;
|
||||
lv_chart_dl_t * dl;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_style_t lines;
|
||||
lv_style_get(LV_STYLE_PLAIN, &lines);
|
||||
lines.opa = (uint16_t)((uint16_t)style->opa * ext->data_opa) >> 8;
|
||||
lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
lines.line_width = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
lines.line_width = dl->width;
|
||||
lines.ccolor = dl->color;
|
||||
|
||||
p1.x = 0 + x_ofs;
|
||||
@@ -461,7 +472,6 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
|
||||
lv_draw_line(&p1, &p2, mask, &lines);
|
||||
}
|
||||
dl_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,14 +499,14 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
|
||||
style_point.bwidth = 0;
|
||||
style_point.empty = 0;
|
||||
style_point.radius = LV_CONT_CIRCLE;
|
||||
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->data_opa) >> 8;
|
||||
style_point.radius = LV_DRAW_CIRCLE;
|
||||
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
style_point.radius = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
style_point.radius = dl->width;
|
||||
style_point.mcolor = dl->color;
|
||||
style_point.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dark_eff);
|
||||
style_point.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs;
|
||||
@@ -533,37 +543,32 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
int32_t y_tmp;
|
||||
lv_chart_dl_t * dl;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_style_t rects;
|
||||
cord_t col_w = w / (2 * ext->dl_num * ext->pnum); /* Suppose (2 * dl_num) * pnum columns*/
|
||||
cord_t col_w = w / ((ext->dl_num + 1) * ext->pnum); /* Suppose + 1 dl as separator*/
|
||||
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
|
||||
|
||||
lv_style_get(LV_STYLE_PLAIN, &rects);
|
||||
rects.bwidth = 0;
|
||||
rects.empty = 0;
|
||||
rects.radius = 0;
|
||||
rects.opa = (uint16_t)((uint16_t)style->opa * ext->data_opa) >> 8;
|
||||
rects.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
|
||||
col_a.y2 = chart->cords.y2;
|
||||
|
||||
/*Go through all data lines*/
|
||||
cord_t x_act;
|
||||
|
||||
/*Go through all points*/
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
x_act = (int32_t)((int32_t) w * i) / ext->pnum;
|
||||
x_act += chart->cords.x1 + x_ofs;
|
||||
|
||||
/*Draw the current point of all data line*/
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
rects.mcolor = dl->color;
|
||||
rects.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dark_eff);
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
/* Calculate the x coordinates. Suppose (2 * dl_num) * pnum columns and draw to every second
|
||||
* the other columns will be spaces.
|
||||
* col_w = w / (2 * ext->dl_num * ext->pnum)
|
||||
* act_col_x = col_w * i * ext->dl_num * 2 + 2 * dl_cnt
|
||||
* Reorder the operation to multiply first*/
|
||||
|
||||
col_a.x1 = (int32_t)((int32_t) w * ((i * ext->dl_num * 2) + (2 * dl_cnt))) /
|
||||
(ext->pnum * 2 * ext->dl_num);
|
||||
col_a.x1 += chart->cords.x1;
|
||||
rects.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
|
||||
col_a.x1 = x_act;
|
||||
col_a.x2 = col_a.x1 + col_w;
|
||||
col_a.x1 += x_ofs;
|
||||
col_a.x2 += x_ofs;
|
||||
x_act += col_w;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) dl->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
@@ -574,7 +579,6 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
lv_draw_rect(&chart->cords, &col_mask, &rects);
|
||||
}
|
||||
}
|
||||
dl_cnt++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,6 @@ typedef struct
|
||||
{
|
||||
cord_t * points;
|
||||
color_t color;
|
||||
cord_t width;
|
||||
}lv_chart_dl_t;
|
||||
|
||||
/*Data of chart */
|
||||
@@ -45,25 +44,26 @@ typedef struct
|
||||
{
|
||||
/*No inherited ext*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
|
||||
cord_t ymin; /*y min value (used to scale the data)*/
|
||||
cord_t ymax; /*y max value (used to scale the data)*/
|
||||
uint8_t hdiv_num; /*Number of horizontal division lines*/
|
||||
uint8_t vdiv_num; /*Number of vertical division lines*/
|
||||
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
|
||||
uint16_t pnum; /*Point number in a data line*/
|
||||
uint8_t type :3; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
cord_t dl_width; /*Line width or point radius*/
|
||||
uint8_t dl_num; /*Number of data lines in dl_ll*/
|
||||
opa_t data_opa; /*Opacity of data lines*/
|
||||
opa_t dark_eff; /*Dark level of the point/column bottoms*/
|
||||
opa_t dl_opa; /*Opacity of data lines*/
|
||||
opa_t dl_dark; /*Dark level of the point/column bottoms*/
|
||||
uint8_t type :3; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
}lv_chart_ext_t;
|
||||
|
||||
/*Chart types*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CHART_NONE = 0,
|
||||
LV_CHART_LINE,
|
||||
LV_CHART_COL,
|
||||
LV_CHART_POINT,
|
||||
LV_CHART_LINE = 0x01,
|
||||
LV_CHART_COL = 0x02,
|
||||
LV_CHART_POINT = 0x04,
|
||||
}lv_chart_type_t;
|
||||
|
||||
|
||||
@@ -90,9 +90,10 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
|
||||
/**
|
||||
* Allocate and add a data line to the chart
|
||||
* @param chart pointer to a chart object
|
||||
* @return pointer to the allocated data line
|
||||
* @param color color of the data line
|
||||
* @return pointer to the allocated data line (
|
||||
*/
|
||||
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color, cord_t width);
|
||||
lv_chart_dl_t * lv_chart_add_dataline(lv_obj_t * chart, color_t color);
|
||||
|
||||
/**
|
||||
* Refresh a chart if its data line has changed
|
||||
@@ -132,9 +133,26 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type);
|
||||
*/
|
||||
void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum);
|
||||
|
||||
void lv_chart_set_data_opa(lv_obj_t * chart, opa_t opa);
|
||||
/**
|
||||
* Set the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param opa opacity of the data lines
|
||||
*/
|
||||
void lv_chart_set_dl_opa(lv_obj_t * chart, opa_t opa);
|
||||
|
||||
void lv_chart_set_drak_effect(lv_obj_t * chart, opa_t dark_eff);
|
||||
/**
|
||||
* Set the line width or point radius of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param width the new width
|
||||
*/
|
||||
void lv_chart_set_dl_width(lv_obj_t * chart, cord_t width);
|
||||
|
||||
/**
|
||||
* Set the dark effect on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
void lv_chart_set_dl_dark(lv_obj_t * chart, opa_t dark_eff);
|
||||
|
||||
/**
|
||||
* Shift all data right and set the most right data on a data line
|
||||
@@ -158,8 +176,27 @@ lv_chart_type_t lv_chart_get_type(lv_obj_t * chart);
|
||||
*/
|
||||
uint16_t lv_chart_get_pnum(lv_obj_t * chart);
|
||||
|
||||
opa_t lv_chart_get_data_opa(lv_obj_t * chart);
|
||||
opa_t lv_chart_get_dark_effect(lv_obj_t * chart, opa_t dark_eff);
|
||||
/**
|
||||
* Get the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @return the opacity of the data lines
|
||||
*/
|
||||
opa_t lv_chart_get_dl_opa(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Get the data line width
|
||||
* @param chart pointer to chart object
|
||||
* @return the width the data lines (lines or points)
|
||||
*/
|
||||
cord_t lv_chart_get_dl_width(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Get the dark effect level on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @return dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
opa_t lv_chart_get_dl_dark(lv_obj_t * chart, opa_t dark_eff);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_cont.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_draw/lv_draw_vbasic.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "misc/gfx/area.h"
|
||||
|
||||
#include "misc/mem/dyn_mem.h"
|
||||
#include "misc/mem/linked_list.h"
|
||||
#include "misc/others/color.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
@@ -77,8 +77,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_alloc_ext(new_rect, sizeof(lv_cont_ext_t));
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(new_rect);
|
||||
dm_assert(ext);
|
||||
ext->hpad_en = 0;
|
||||
ext->vpad_en = 0;
|
||||
ext->hfit_en = 0;
|
||||
ext->vfit_en = 0;
|
||||
ext->layout = LV_CONT_LAYOUT_OFF;
|
||||
|
||||
lv_obj_set_signal_f(new_rect, lv_cont_signal);
|
||||
@@ -90,8 +90,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_cont_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->hpad_en = copy_ext->hpad_en;
|
||||
ext->vpad_en = copy_ext->vpad_en;
|
||||
ext->hfit_en = copy_ext->hfit_en;
|
||||
ext->vfit_en = copy_ext->vfit_en;
|
||||
ext->layout = copy_ext->layout;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
@@ -118,9 +118,6 @@ bool lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_STYLE_CHG: /*Recalculate the padding if the style changed*/
|
||||
lv_cont_refr_layout(cont);
|
||||
@@ -175,8 +172,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
|
||||
{
|
||||
lv_obj_inv(cont);
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
ext->hpad_en = hor_en == false ? 0 : 1;
|
||||
ext->vpad_en = ver_en == false ? 0 : 1;
|
||||
ext->hfit_en = hor_en == false ? 0 : 1;
|
||||
ext->vfit_en = ver_en == false ? 0 : 1;
|
||||
|
||||
/*Send a signal to set a new size*/
|
||||
cont->signal_f(cont, LV_SIGNAL_CORD_CHG, cont);
|
||||
@@ -205,7 +202,7 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont)
|
||||
bool lv_cont_get_hfit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
return ext->hpad_en == 0 ? false : true;
|
||||
return ext->hfit_en == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +213,7 @@ bool lv_cont_get_hfit(lv_obj_t * cont)
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
return ext->vpad_en == 0 ? false : true;
|
||||
return ext->vfit_en == 0 ? false : true;
|
||||
}
|
||||
|
||||
|
||||
@@ -549,8 +546,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
|
||||
if(ext->hpad_en == 0 &&
|
||||
ext->vpad_en == 0) {
|
||||
if(ext->hfit_en == 0 &&
|
||||
ext->vfit_en == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -565,10 +562,10 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
lv_obj_get_cords(cont, &ori);
|
||||
lv_obj_get_cords(cont, &new_cords);
|
||||
|
||||
new_cords.x1 = LV_CORD_MAX;
|
||||
new_cords.y1 = LV_CORD_MAX;
|
||||
new_cords.x2 = LV_CORD_MIN;
|
||||
new_cords.y2 = LV_CORD_MIN;
|
||||
new_cords.x1 = CORD_MAX;
|
||||
new_cords.y1 = CORD_MAX;
|
||||
new_cords.x2 = CORD_MIN;
|
||||
new_cords.y2 = CORD_MIN;
|
||||
|
||||
LL_READ(cont->child_ll, i) {
|
||||
if(lv_obj_get_hidden(i) != false) continue;
|
||||
@@ -579,15 +576,15 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
}
|
||||
|
||||
/*If the value is not the init value then the page has >=1 child.*/
|
||||
if(new_cords.x1 != LV_CORD_MAX) {
|
||||
if(ext->hpad_en != 0) {
|
||||
if(new_cords.x1 != CORD_MAX) {
|
||||
if(ext->hfit_en != 0) {
|
||||
new_cords.x1 -= hpad;
|
||||
new_cords.x2 += hpad;
|
||||
} else {
|
||||
new_cords.x1 = cont->cords.x1;
|
||||
new_cords.x2 = cont->cords.x2;
|
||||
}
|
||||
if(ext->vpad_en != 0) {
|
||||
if(ext->vfit_en != 0) {
|
||||
new_cords.y1 -= vpad;
|
||||
new_cords.y2 += vpad;
|
||||
} else {
|
||||
|
||||
@@ -42,9 +42,9 @@ typedef struct
|
||||
{
|
||||
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
uint8_t layout :5; /*Set a layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hpad_en :1; /*Enable horizontal padding according to the children*/
|
||||
uint8_t vpad_en :1; /*Enable horizontal padding according to the children*/
|
||||
uint8_t layout :5; /*A layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
uint8_t vfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
}lv_cont_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -99,12 +99,11 @@ bool lv_cont_get_hfit(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get vertical fit enable attribute of a container
|
||||
* @param obj pointer to a container object
|
||||
* @param cont pointer to a container object
|
||||
* @return true: vertical padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "lv_ddlist.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -85,7 +85,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSP, NULL));
|
||||
|
||||
ext->opt_label = lv_label_create(new_ddlist, NULL);
|
||||
lv_obj_set_style(ext->opt_label, NULL); /*Inherit the style*/
|
||||
lv_obj_set_style(ext->opt_label, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
lv_cont_set_fit(new_ddlist, true, false);
|
||||
lv_page_set_rel_action(new_ddlist, lv_ddlist_rel_action);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
|
||||
@@ -126,6 +126,8 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param)
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
lv_obj_set_style(ext->opt_label, lv_obj_get_style(ddlist));
|
||||
lv_ddlist_refr_size(ddlist, false);
|
||||
}
|
||||
}
|
||||
@@ -296,7 +298,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
|
||||
if(ext->opened != 0) {
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
const font_t * font = style->font;
|
||||
cord_t font_h = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
area_t rect_area;
|
||||
lv_style_t * style_page_scrl = lv_obj_get_style(lv_page_get_scrl(ddlist));
|
||||
rect_area.y1 = ext->opt_label->cords.y1;
|
||||
@@ -386,7 +388,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
|
||||
} else { /*Close the list*/
|
||||
const font_t * font = style->font;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
cord_t font_h = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
new_height = font_h + 2 * label_style->line_space;
|
||||
}
|
||||
if(anim_en == false) {
|
||||
@@ -420,7 +422,7 @@ static void lv_ddlist_pos_act_option(lv_obj_t * ddlist)
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
const font_t * font = style->font;
|
||||
cord_t font_h = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ddlist);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
|
||||
@@ -83,7 +83,6 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
|
||||
*/
|
||||
void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_res_t (*cb)(lv_obj_t *, uint16_t));
|
||||
|
||||
|
||||
/**
|
||||
* Set the auto size attribute. If enabled the height will reduced to be visible on the parent.
|
||||
* In this case the drop down list can be scrolled.
|
||||
@@ -92,6 +91,11 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_res_t (*cb)(lv_obj_t *, u
|
||||
*/
|
||||
void lv_ddlist_set_auto_size(lv_obj_t * ddlist, bool auto_size);
|
||||
|
||||
/**
|
||||
* Set the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param style pointer the new style of the select rectangle
|
||||
*/
|
||||
void lv_dlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style);
|
||||
|
||||
/**
|
||||
@@ -110,11 +114,16 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
|
||||
|
||||
/**
|
||||
* Get the auto size attribute.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return true: the auto_size is enabled, false: disabled
|
||||
*/
|
||||
bool lv_ddlist_get_auto_size(lv_obj_t * ddlist, bool auto_size);
|
||||
|
||||
/**
|
||||
* Get the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return pointer the style of the select rectangle
|
||||
*/
|
||||
lv_style_t * lv_dlist_get_style_select(lv_obj_t * ddlist);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "misc/math/trigo.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define LV_GAUGE_DEF_HEIGHT (3 * LV_DPI)
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
||||
#define LV_GAUGE_DEF_ANGLE 220
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -406,7 +407,7 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_
|
||||
point_t label_size;
|
||||
txt_get_size(&label_size, scale_txt, style->font,
|
||||
style->letter_space, style->line_space,
|
||||
LV_CORD_MAX, TXT_FLAG_NONE);
|
||||
CORD_MAX, TXT_FLAG_NONE);
|
||||
|
||||
/*Draw the label*/
|
||||
label_cord.x1 = x - label_size.x / 2;
|
||||
@@ -458,7 +459,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
|
||||
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
|
||||
style_neddle_mid.mcolor = style->bcolor;
|
||||
style_neddle_mid.gcolor = style->bcolor;
|
||||
style_neddle_mid.radius = LV_CONT_CIRCLE;
|
||||
style_neddle_mid.radius = LV_DRAW_CIRCLE;
|
||||
|
||||
area_t nm_cord;
|
||||
nm_cord.x1 = x_ofs - style->opad;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "misc/fs/ufs/ufs.h"
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@@ -79,10 +79,13 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
* and must be screen sized*/
|
||||
if(par != NULL) ext->auto_size = 1;
|
||||
else ext->auto_size = 0;
|
||||
lv_obj_set_style(new_img, lv_style_get(LV_STYLE_PLAIN, NULL));
|
||||
if(par != NULL) lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/
|
||||
else lv_obj_set_style(new_img, lv_style_get(LV_STYLE_PLAIN, NULL)); /*Set style for screens*/
|
||||
} else {
|
||||
ext->auto_size = lv_img_get_auto_size(copy);
|
||||
lv_img_set_file(new_img, ext->fn);
|
||||
lv_img_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->auto_size = copy_ext->auto_size;
|
||||
ext->upscale = copy_ext->upscale;
|
||||
lv_img_set_file(new_img, copy_ext->fn);
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_img);
|
||||
@@ -107,14 +110,15 @@ bool lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_img_ext_t * img_p = lv_obj_get_ext(img);
|
||||
switch(sign) {
|
||||
/*TODO set file again if style changed with symbols*/
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
dm_free(img_p->fn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
lv_img_ext_t * ext = lv_obj_get_ext(img);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
dm_free(ext->fn);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
/*Refresh the file name to refresh the symbol text size*/
|
||||
if(lv_img_is_symbol(ext->fn) != false) {
|
||||
lv_img_set_file(img, ext->fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +190,7 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
#if LV_IMG_ENABLE_SYMBOLS
|
||||
lv_style_t * style = lv_obj_get_style(img);
|
||||
point_t size;
|
||||
txt_get_size(&size, fn, style->font, 0, 0, LV_CORD_MAX, TXT_FLAG_NONE);
|
||||
txt_get_size(&size, fn, style->font, style->letter_space, style->line_space, CORD_MAX, TXT_FLAG_NONE);
|
||||
ext->w = size.x;
|
||||
ext->h = size.y;
|
||||
ext->transp = 0;
|
||||
@@ -347,6 +351,8 @@ static bool lv_img_is_symbol(const char * txt)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if(txt == NULL) return false;
|
||||
|
||||
/* if txt begins with an upper case letter then it refers to a driver
|
||||
* so it is a file name*/
|
||||
if(txt[0] >= 'A' && txt[0] <= 'Z') return false;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS
|
||||
#include "lv_label.h"
|
||||
#include "../lv_misc/fonts/symbol_def.h"
|
||||
#include "misc/gfx/fonts/symbol_def.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_LABEL != 0
|
||||
|
||||
#include "misc/others/color.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/math/math_base.h"
|
||||
#include "lv_label.h"
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "../lv_misc/anim.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
/*********************
|
||||
@@ -351,7 +351,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
|
||||
cord_t max_w = lv_obj_get_width(label);
|
||||
lv_style_t * style = lv_obj_get_style(label);
|
||||
const font_t * font = style->font;
|
||||
uint8_t letter_height = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
uint8_t letter_height = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
cord_t y = 0;
|
||||
txt_flag_t flag = TXT_FLAG_NONE;
|
||||
|
||||
@@ -359,7 +359,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
|
||||
|
||||
/*If the width will be expanded the set the max length to very big */
|
||||
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {
|
||||
max_w = LV_CORD_MAX;
|
||||
max_w = CORD_MAX;
|
||||
}
|
||||
|
||||
/*Search the line of the index letter */;
|
||||
@@ -388,10 +388,10 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos)
|
||||
}
|
||||
}
|
||||
|
||||
x += (font_get_width(font, text[i]) >> LV_FONT_ANTIALIAS) + style->letter_space;
|
||||
x += (font_get_width(font, text[i]) >> FONT_ANTIALIAS) + style->letter_space;
|
||||
}
|
||||
|
||||
if(style->txt_align != 0) {
|
||||
if(style->txt_align == LV_TXT_ALIGN_MID) {
|
||||
cord_t line_w;
|
||||
line_w = txt_get_width(&text[line_start], new_line_start - line_start,
|
||||
font, style->letter_space, flag);
|
||||
@@ -418,7 +418,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
|
||||
cord_t max_w = lv_obj_get_width(label);
|
||||
lv_style_t * style = lv_obj_get_style(label);
|
||||
const font_t * font = style->font;
|
||||
uint8_t letter_height = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
uint8_t letter_height = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
cord_t y = 0;
|
||||
txt_flag_t flag = TXT_FLAG_NONE;
|
||||
|
||||
@@ -426,7 +426,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
|
||||
|
||||
/*If the width will be expanded set the max length to very big */
|
||||
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {
|
||||
max_w = LV_CORD_MAX;
|
||||
max_w = CORD_MAX;
|
||||
}
|
||||
|
||||
/*Search the line of the index letter */;
|
||||
@@ -439,7 +439,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
|
||||
|
||||
/*Calculate the x coordinate*/
|
||||
cord_t x = 0;
|
||||
if(style->txt_align != 0) {
|
||||
if(style->txt_align == LV_TXT_ALIGN_MID) {
|
||||
cord_t line_w;
|
||||
line_w = txt_get_width(&text[line_start], new_line_start - line_start,
|
||||
font, style->letter_space, flag);
|
||||
@@ -456,7 +456,7 @@ uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos)
|
||||
}
|
||||
}
|
||||
|
||||
x += (font_get_width(font, text[i]) >> LV_FONT_ANTIALIAS) + style->letter_space;
|
||||
x += (font_get_width(font, text[i]) >> FONT_ANTIALIAS) + style->letter_space;
|
||||
if(pos->x < x) break;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
|
||||
/*If the width will be expanded set the max length to very big */
|
||||
if(ext->long_mode == LV_LABEL_LONG_EXPAND || ext->long_mode == LV_LABEL_LONG_SCROLL) {
|
||||
max_w = LV_CORD_MAX;
|
||||
max_w = CORD_MAX;
|
||||
}
|
||||
|
||||
/*Calc. the height and longest line*/
|
||||
@@ -544,7 +544,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
anim.var = label;
|
||||
anim.repeat = 1;
|
||||
anim.playback = 1;
|
||||
anim.start = font_get_width(font, ' ') >> LV_FONT_ANTIALIAS;
|
||||
anim.start = font_get_width(font, ' ') >> FONT_ANTIALIAS;
|
||||
anim.act_time = 0;
|
||||
anim.end_cb = NULL;
|
||||
anim.path = anim_get_path(ANIM_PATH_LIN);
|
||||
@@ -555,7 +555,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
bool hor_anim = false;
|
||||
if(lv_obj_get_width(label) > lv_obj_get_width(parent)) {
|
||||
anim.end = lv_obj_get_width(parent) - lv_obj_get_width(label) -
|
||||
(font_get_width(font, ' ') >> LV_FONT_ANTIALIAS);
|
||||
(font_get_width(font, ' ') >> FONT_ANTIALIAS);
|
||||
anim.fp = (anim_fp_t) lv_obj_set_x;
|
||||
anim.time = anim_speed_to_time(LV_LABEL_SCROLL_SPEED, anim.start, anim.end);
|
||||
anim_create(&anim);
|
||||
@@ -564,7 +564,7 @@ static void lv_label_refr_text(lv_obj_t * label)
|
||||
|
||||
if(lv_obj_get_height(label) > lv_obj_get_height(parent)) {
|
||||
anim.end = lv_obj_get_height(parent) - lv_obj_get_height(label) -
|
||||
(font_get_height(font) - LV_FONT_ANTIALIAS);
|
||||
(font_get_height(font) - FONT_ANTIALIAS);
|
||||
anim.fp = (anim_fp_t)lv_obj_set_y;
|
||||
|
||||
/*Different animation speed if horizontal animation is created too*/
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#if USE_LV_LABEL != 0
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/font.h"
|
||||
#include "misc/gfx/text.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -41,8 +41,8 @@ typedef struct
|
||||
/*New data for this type */
|
||||
char * txt; /*Text of the label*/
|
||||
lv_label_long_mode_t long_mode; /*Determinate what to do with the long texts*/
|
||||
char dot_tmp[LV_LABEL_DOT_NUM]; /*Store character which are replaced with dots*/
|
||||
uint16_t dot_end; /*The text end position in dot mode*/
|
||||
char dot_tmp[LV_LABEL_DOT_NUM]; /*Store the character which are replaced by dots (Handled by the library)*/
|
||||
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
|
||||
uint8_t static_txt :1; /*Flag to indicate the text is static*/
|
||||
uint8_t recolor :1; /*Enable in-line letter re-coloring*/
|
||||
}lv_label_ext_t;
|
||||
@@ -97,6 +97,7 @@ void lv_label_set_text_static(lv_obj_t * label, const char * text);
|
||||
* @param text pointe rto the new text
|
||||
*/
|
||||
void lv_label_append_text(lv_obj_t * label, const char * text);
|
||||
|
||||
/**
|
||||
* Set the behavior of the label with longer text then the object size
|
||||
* @param label pointer to a label object
|
||||
@@ -125,7 +126,6 @@ const char * lv_label_get_text(lv_obj_t * label);
|
||||
*/
|
||||
lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label);
|
||||
|
||||
|
||||
/**
|
||||
* Get the recoloring attribute
|
||||
* @param label pointer to a label object
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_LED != 0
|
||||
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_led.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
@@ -18,7 +17,7 @@
|
||||
*********************/
|
||||
#define LV_LED_WIDTH_DEF (LV_DPI / 2)
|
||||
#define LV_LED_HEIGHT_DEF (LV_DPI / 2)
|
||||
#define LV_LED_BRIGHT_OFF 40
|
||||
#define LV_LED_BRIGHT_OFF 128
|
||||
#define LV_LED_BRIGHT_ON 255
|
||||
|
||||
/**********************
|
||||
@@ -56,7 +55,7 @@ static lv_design_f_t ancestor_design_f;
|
||||
lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_led = lv_cont_create(par, copy);
|
||||
lv_obj_t * new_led = lv_obj_create(par, copy);
|
||||
dm_assert(new_led);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
@@ -98,18 +97,12 @@ bool lv_led_signal(lv_obj_t * led, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_cont_signal(led, sign, param);
|
||||
valid = lv_obj_signal(led, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return valid;
|
||||
@@ -210,9 +203,11 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
|
||||
/*Mix. the color with black proportionally with brightness*/
|
||||
leds_tmp.mcolor = color_mix(leds_tmp.mcolor, COLOR_BLACK, ext->bright);
|
||||
leds_tmp.gcolor = color_mix(leds_tmp.gcolor, COLOR_BLACK, ext->bright);
|
||||
leds_tmp.bcolor = color_mix(leds_tmp.bcolor, COLOR_BLACK, ext->bright);
|
||||
|
||||
/*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF and LV_LED_BRIGHT_ON*/
|
||||
leds_tmp.swidth = (uint16_t)(uint16_t)(ext->bright * style->swidth) >> 8;
|
||||
uint16_t bright_tmp = ext->bright;
|
||||
leds_tmp.swidth = ((bright_tmp - LV_LED_BRIGHT_OFF) * style->swidth) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);
|
||||
|
||||
led->style_p = &leds_tmp;
|
||||
ancestor_design_f(led, mask, mode);
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_LED != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_led: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
@@ -30,7 +25,7 @@
|
||||
/*Data of led*/
|
||||
typedef struct
|
||||
{
|
||||
lv_cont_ext_t bg_rect; /*Ext. of ancestor*/
|
||||
/*No inherited ext.*/
|
||||
/*New data for this type */
|
||||
uint8_t bright; /*Current brightness of the LED (0..255)*/
|
||||
}lv_led_ext_t;
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
#include "../lv_draw/lv_draw_vbasic.h"
|
||||
#include "../lv_draw/lv_draw_rbasic.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <misc/math/math_base.h>
|
||||
#include <misc/mem/dyn_mem.h>
|
||||
#include <misc/others/color.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -76,11 +76,12 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_line_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
lv_line_set_auto_size(new_line,lv_line_get_auto_size(copy));
|
||||
lv_line_set_y_inv(new_line,lv_line_get_y_inv(copy));
|
||||
lv_line_set_auto_size(new_line,lv_line_get_auto_size(copy));
|
||||
lv_line_set_upscale(new_line,lv_line_get_upscale(copy));
|
||||
lv_line_set_points(new_line, ext->point_array, ext->point_num);
|
||||
lv_line_set_points(new_line, copy_ext->point_array, copy_ext->point_num);
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_line);
|
||||
}
|
||||
@@ -121,7 +122,7 @@ bool lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
|
||||
* Set an array of points. The line object will connect these points.
|
||||
* @param line pointer to a line object
|
||||
* @param point_a an array of points. Only the address is saved,
|
||||
* so the array can be a local variable which will be destroyed
|
||||
* so the array can NOT be a local variable which will be destroyed
|
||||
* @param point_num number of points in 'point_a'
|
||||
*/
|
||||
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num)
|
||||
@@ -137,8 +138,8 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
|
||||
|
||||
if(point_num > 0 && ext->auto_size != 0) {
|
||||
uint16_t i;
|
||||
cord_t xmax = LV_CORD_MIN;
|
||||
cord_t ymax = LV_CORD_MIN;
|
||||
cord_t xmax = CORD_MIN;
|
||||
cord_t ymax = CORD_MIN;
|
||||
for(i = 0; i < point_num; i++) {
|
||||
xmax = MATH_MAX(point_a[i].x * us, xmax);
|
||||
ymax = MATH_MAX(point_a[i].y * us, ymax);
|
||||
|
||||
@@ -37,7 +37,6 @@ typedef struct
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Create a line objects
|
||||
* @param par pointer to an object, it will be the parent of the new line
|
||||
@@ -57,7 +56,7 @@ bool lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param);
|
||||
* Set an array of points. The line object will connect these points.
|
||||
* @param line pointer to a line object
|
||||
* @param point_a an array of points. Only the address is saved,
|
||||
* so the array can be a local variable which will be destroyed
|
||||
* so the array can NOT be a local variable which will be destroyed
|
||||
* @param point_num number of points in 'point_a'
|
||||
*/
|
||||
void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point_num);
|
||||
|
||||
@@ -59,23 +59,35 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_list_ext_t * ext = lv_obj_alloc_ext(new_list, sizeof(lv_list_ext_t));
|
||||
dm_assert(ext);
|
||||
|
||||
ext->width_sb = 0;
|
||||
ext->styles_liste[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->styles_liste[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->styles_liste[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
|
||||
ext->styles_liste[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
|
||||
ext->styles_liste[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
|
||||
ext->sb_out = 0;
|
||||
ext->style_img = NULL;
|
||||
ext->styles_btn[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->styles_btn[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
|
||||
ext->styles_btn[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
|
||||
ext->styles_btn[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
|
||||
|
||||
lv_obj_set_signal_f(new_list, lv_list_signal);
|
||||
|
||||
/*Init the new list object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size_us(new_list, 2 * LV_DPI, 3 * LV_DPI);
|
||||
lv_obj_set_size(new_list, 2 * LV_DPI, 3 * LV_DPI);
|
||||
lv_cont_set_layout(ext->page.scrl, LV_LIST_LAYOUT_DEF);
|
||||
lv_obj_set_style(new_list, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
|
||||
lv_obj_set_style(lv_page_get_scrl(new_list), lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
lv_page_set_sb_mode(new_list, LV_PAGE_SB_MODE_AUTO);
|
||||
} else {
|
||||
lv_list_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
|
||||
lv_list_set_styles_btn(new_list, copy_ext->styles_btn[LV_BTN_STATE_REL],
|
||||
copy_ext->styles_btn[LV_BTN_STATE_PR],
|
||||
copy_ext->styles_btn[LV_BTN_STATE_TREL],
|
||||
copy_ext->styles_btn[LV_BTN_STATE_TPR],
|
||||
copy_ext->styles_btn[LV_BTN_STATE_INA]);
|
||||
lv_list_set_style_img(new_list, copy_ext->style_img);
|
||||
|
||||
lv_list_set_sb_out(new_list, copy_ext->sb_out);
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_list);
|
||||
}
|
||||
@@ -115,9 +127,9 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
|
||||
/*Create a list element with the image an the text*/
|
||||
lv_obj_t * liste;
|
||||
liste = lv_btn_create(list, NULL);
|
||||
lv_btn_set_styles(liste, ext->styles_liste[LV_BTN_STATE_REL], ext->styles_liste[LV_BTN_STATE_PR],
|
||||
ext->styles_liste[LV_BTN_STATE_TREL], ext->styles_liste[LV_BTN_STATE_TPR],
|
||||
ext->styles_liste[LV_BTN_STATE_INA]);
|
||||
lv_btn_set_styles(liste, ext->styles_btn[LV_BTN_STATE_REL], ext->styles_btn[LV_BTN_STATE_PR],
|
||||
ext->styles_btn[LV_BTN_STATE_TREL], ext->styles_btn[LV_BTN_STATE_TPR],
|
||||
ext->styles_btn[LV_BTN_STATE_INA]);
|
||||
|
||||
lv_btn_set_rel_action(liste, rel_action);
|
||||
lv_page_glue_obj(liste, true);
|
||||
@@ -127,14 +139,14 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
|
||||
if(img_fn != NULL && img_fn[0] != '\0') {
|
||||
lv_obj_t * img = lv_img_create(liste, NULL);
|
||||
lv_img_set_file(img, img_fn);
|
||||
lv_obj_set_style(img, ext->styles_liste[LV_BTN_STATE_REL]);
|
||||
lv_obj_set_style(img, ext->style_img);
|
||||
lv_obj_set_click(img, false);
|
||||
}
|
||||
|
||||
if(txt != NULL) {
|
||||
lv_obj_t * label = lv_label_create(liste, NULL);
|
||||
lv_label_set_text(label, txt);
|
||||
lv_obj_set_style(label, ext->styles_liste[LV_BTN_STATE_REL]);
|
||||
lv_obj_set_style(label, ext->styles_btn[LV_BTN_STATE_REL]);
|
||||
lv_obj_set_click(label, false);
|
||||
}
|
||||
|
||||
@@ -145,7 +157,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
|
||||
w -= hpad_tot * 2;
|
||||
|
||||
/*Make place for the scrollbar if hpad_tot is too small*/
|
||||
if(ext->width_sb != 0) {
|
||||
if(ext->sb_out != 0) {
|
||||
if(hpad_tot < ext->page.sb_width) w -= ext->page.sb_width - hpad_tot;
|
||||
}
|
||||
lv_obj_set_width(liste, w);
|
||||
@@ -202,6 +214,19 @@ void lv_list_down(lv_obj_t * list)
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Enable/Disable to scrollbar outside attribute
|
||||
* @param list pointer to list object
|
||||
* @param out true: reduce the buttons width therefore scroll bar will be out of the buttons,
|
||||
* false: keep button size and place scroll bar on the buttons
|
||||
*/
|
||||
void lv_list_set_sb_out(lv_obj_t * list, bool out)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
|
||||
ext->sb_out = out == false ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set styles of the list elements of a list in each state
|
||||
* @param list pointer to list object
|
||||
@@ -211,15 +236,17 @@ void lv_list_down(lv_obj_t * list)
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_list_set_styles_liste(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina)
|
||||
void lv_list_set_styles_btn(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr,
|
||||
lv_style_t * trel, lv_style_t * tpr,
|
||||
lv_style_t * ina)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
|
||||
ext->styles_liste[LV_BTN_STATE_REL] = rel;
|
||||
ext->styles_liste[LV_BTN_STATE_PR] = pr;
|
||||
ext->styles_liste[LV_BTN_STATE_TREL] = trel;
|
||||
ext->styles_liste[LV_BTN_STATE_TPR] = tpr;
|
||||
ext->styles_liste[LV_BTN_STATE_INA] = ina;
|
||||
ext->styles_btn[LV_BTN_STATE_REL] = rel;
|
||||
ext->styles_btn[LV_BTN_STATE_PR] = pr;
|
||||
ext->styles_btn[LV_BTN_STATE_TREL] = trel;
|
||||
ext->styles_btn[LV_BTN_STATE_TPR] = tpr;
|
||||
ext->styles_btn[LV_BTN_STATE_INA] = ina;
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrl(list);
|
||||
lv_obj_t * liste = lv_obj_get_child(scrl, NULL);
|
||||
@@ -228,7 +255,31 @@ void lv_list_set_styles_liste(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr
|
||||
lv_btn_set_styles(liste, rel, pr, trel, tpr, ina);
|
||||
liste = lv_obj_get_child(scrl, liste);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the styles of the list element image (typically to set symbol font)
|
||||
* @param list pointer to list object
|
||||
* @param style pointer to the new style of the button images
|
||||
*/
|
||||
void lv_list_set_style_img(lv_obj_t * list, lv_style_t * style)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
|
||||
ext->style_img = style;
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrl(list);
|
||||
lv_obj_t * liste = lv_obj_get_child(scrl, NULL);
|
||||
lv_obj_t * img;
|
||||
while(liste != NULL)
|
||||
{
|
||||
img = lv_obj_get_child(liste, NULL); /*Now img = the label*/
|
||||
img = lv_obj_get_child(liste, img); /*Now img = the image (if ULL then no image) */
|
||||
if(img != NULL) lv_obj_set_style(img, style);
|
||||
|
||||
liste = lv_obj_get_child(scrl, liste);
|
||||
}
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -247,10 +298,20 @@ const char * lv_list_element_get_txt(lv_obj_t * liste)
|
||||
return lv_label_get_text(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scroll bar outside attribute
|
||||
* @param list pointer to list object
|
||||
* @param en true: scroll bar outside the buttons, false: scroll bar inside
|
||||
*/
|
||||
bool lv_list_get_sb_out(lv_obj_t * list, bool en)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
return ext->sb_out == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style of the list elements in a given state
|
||||
* @param list pointer to a button object
|
||||
* @param list pointer to a list object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
@@ -258,12 +319,26 @@ lv_style_t * lv_list_get_style_liste(lv_obj_t * list, lv_btn_state_t state)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
|
||||
if(ext->styles_liste[state] == NULL) return lv_obj_get_style(list);
|
||||
if(ext->styles_btn[state] == NULL) return lv_obj_get_style(list);
|
||||
|
||||
return ext->styles_liste[state];
|
||||
return ext->styles_btn[state];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the style of the list elements images
|
||||
* @param list pointer to a list object
|
||||
* @return pointer to the image style
|
||||
*/
|
||||
lv_style_t * lv_list_get_style_img(lv_obj_t * list, lv_btn_state_t state)
|
||||
{
|
||||
lv_list_ext_t * ext = lv_obj_get_ext(list);
|
||||
|
||||
if(ext->style_img == NULL) return lv_list_get_style_liste(list, LV_BTN_STATE_REL);
|
||||
|
||||
return ext->style_img;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -43,8 +43,9 @@ typedef struct
|
||||
{
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_style_t * styles_liste[LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/
|
||||
uint8_t width_sb :1; /*1: Keep space for the scrollbar*/
|
||||
lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/
|
||||
lv_style_t * style_img; /*Style of the list element images on buttons*/
|
||||
uint8_t sb_out :1; /*1: Keep space for the scrollbar*/
|
||||
}lv_list_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -89,7 +90,34 @@ void lv_list_up(lv_obj_t * list);
|
||||
*/
|
||||
void lv_list_down(lv_obj_t * list);
|
||||
|
||||
void lv_list_set_styles_liste(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina);
|
||||
/**
|
||||
* Enable/Disable to scrollbar outside attribute
|
||||
* @param list pointer to list object
|
||||
* @param out true: reduce the buttons width therefore scroll bar will be out of the buttons,
|
||||
* false: keep button size and place scroll bar on the buttons
|
||||
*/
|
||||
void lv_list_set_sb_out(lv_obj_t * list, bool out);
|
||||
|
||||
/**
|
||||
* Set styles of the list elements of a list in each state
|
||||
* @param list pointer to list object
|
||||
* @param rel pointer to a style for releases state
|
||||
* @param pr pointer to a style for pressed state
|
||||
* @param trel pointer to a style for toggled releases state
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_list_set_styles_btn(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr,
|
||||
lv_style_t * trel, lv_style_t * tpr,
|
||||
lv_style_t * ina);
|
||||
|
||||
/**
|
||||
* Set the styles of the list element image (typically to set symbol font)
|
||||
* @param list pointer to list object
|
||||
* @param style pointer to the new style of the button images
|
||||
*/
|
||||
void lv_list_set_style_img(lv_obj_t * list, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the text of a list element
|
||||
* @param liste pointer to list element
|
||||
@@ -97,7 +125,28 @@ void lv_list_set_styles_liste(lv_obj_t * list, lv_style_t * rel, lv_style_t * pr
|
||||
*/
|
||||
const char * lv_list_element_get_txt(lv_obj_t * liste);
|
||||
|
||||
/**
|
||||
* Get the scroll bar outside attribute
|
||||
* @param list pointer to list object
|
||||
* @param en true: scroll bar outside the buttons, false: scroll bar inside
|
||||
*/
|
||||
bool lv_list_get_sb_out(lv_obj_t * list, bool en);
|
||||
|
||||
/**
|
||||
* Get the style of the list elements in a given state
|
||||
* @param list pointer to a list object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
lv_style_t * lv_list_get_style_liste(lv_obj_t * list, lv_btn_state_t state);
|
||||
|
||||
/**
|
||||
* Get the style of the list elements images
|
||||
* @param list pointer to a list object
|
||||
* @return pointer to the image style
|
||||
*/
|
||||
lv_style_t * lv_list_get_style_img(lv_obj_t * list, lv_btn_state_t state);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if USE_LV_MBOX != 0
|
||||
|
||||
#include "lv_mbox.h"
|
||||
#include "../lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
@@ -67,11 +67,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
dm_assert(ext);
|
||||
ext->txt = NULL;
|
||||
ext->btnh = NULL;
|
||||
ext->styles_btn[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->styles_btn[LV_STYLE_BTN_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->styles_btn[LV_STYLE_BTN_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
|
||||
ext->styles_btn[LV_STYLE_BTN_TPR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
|
||||
ext->styles_btn[LV_STYLE_BTN_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
|
||||
ext->style_btn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->style_btn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_f(new_mbox, lv_mbox_signal);
|
||||
@@ -97,12 +94,10 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_t * btn_copy;
|
||||
const char * btn_txt_copy;
|
||||
lv_btn_ext_t * btn_ext_copy;
|
||||
btn_copy = lv_obj_get_child(copy_ext->btnh, NULL);
|
||||
while(btn_copy != NULL) {
|
||||
LL_READ_BACK(copy_ext->btnh->child_ll, btn_copy) {
|
||||
btn_txt_copy = lv_label_get_text(lv_obj_get_child(btn_copy, NULL));
|
||||
btn_ext_copy = lv_obj_get_ext(btn_copy);
|
||||
lv_mbox_add_btn(new_mbox, btn_txt_copy, btn_ext_copy->rel_action);
|
||||
btn_copy = lv_obj_get_child(copy_ext->btnh, btn_copy);
|
||||
}
|
||||
}
|
||||
/*Refresh the style with new signal function*/
|
||||
@@ -150,20 +145,14 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
lv_dispi_wait_release(param);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_set_style(ext->txt, ext->styles_btn[LV_BTN_STATE_REL]);
|
||||
|
||||
/*Refresh all the buttons*/
|
||||
if(ext->btnh != NULL) {
|
||||
lv_obj_t * btn;
|
||||
btn = lv_obj_get_child(ext->btnh, NULL);
|
||||
while(btn != NULL) {
|
||||
/*Refresh the next button's style*/
|
||||
lv_btn_set_styles(btn, ext->styles_btn[LV_BTN_STATE_REL], ext->styles_btn[LV_BTN_STATE_PR],
|
||||
ext->styles_btn[LV_BTN_STATE_TREL], ext->styles_btn[LV_BTN_STATE_TPR],
|
||||
ext->styles_btn[LV_BTN_STATE_INA]);
|
||||
lv_btn_set_styles(btn, ext->style_btn_rel, ext->style_btn_pr, NULL, NULL, NULL);
|
||||
|
||||
/*Refresh the button label too*/
|
||||
lv_obj_set_style(lv_obj_get_child(btn, NULL), ext->styles_btn[LV_BTN_STATE_REL]);
|
||||
btn = lv_obj_get_child(ext->btnh, btn);
|
||||
}
|
||||
}
|
||||
@@ -211,14 +200,11 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
|
||||
lv_obj_t * btn;
|
||||
btn = lv_btn_create(ext->btnh, NULL);
|
||||
lv_btn_set_rel_action(btn, rel_action);
|
||||
lv_btn_set_styles(btn, ext->styles_btn[LV_BTN_STATE_REL], ext->styles_btn[LV_BTN_STATE_PR],
|
||||
ext->styles_btn[LV_BTN_STATE_TREL], ext->styles_btn[LV_BTN_STATE_TPR],
|
||||
ext->styles_btn[LV_BTN_STATE_INA]);
|
||||
lv_btn_set_styles(btn, ext->style_btn_rel, ext->style_btn_pr, NULL, NULL, NULL);
|
||||
lv_cont_set_fit(btn, true, true);
|
||||
|
||||
lv_obj_t * label;
|
||||
label = lv_label_create(btn, NULL);
|
||||
lv_obj_set_style(label, ext->styles_btn[LV_BTN_STATE_REL]);
|
||||
lv_label_set_text(label, btn_txt);
|
||||
|
||||
lv_mbox_realign(mbox);
|
||||
@@ -252,20 +238,16 @@ void lv_mbox_set_text(lv_obj_t * mbox, const char * txt)
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina)
|
||||
void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr)
|
||||
{
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext(mbox);
|
||||
|
||||
ext->styles_btn[LV_BTN_STATE_REL] = rel;
|
||||
ext->styles_btn[LV_BTN_STATE_PR] = pr;
|
||||
ext->styles_btn[LV_BTN_STATE_TREL] = trel;
|
||||
ext->styles_btn[LV_BTN_STATE_TPR] = tpr;
|
||||
ext->styles_btn[LV_BTN_STATE_INA] = ina;
|
||||
|
||||
ext->style_btn_rel = rel;
|
||||
ext->style_btn_pr = pr;
|
||||
lv_obj_t * btn = lv_obj_get_child(ext->btnh, NULL);
|
||||
|
||||
while(btn != NULL) {
|
||||
lv_btn_set_styles(btn, rel, pr, trel, tpr, ina);
|
||||
lv_btn_set_styles(btn, rel, pr, NULL, NULL, NULL);
|
||||
btn = lv_obj_get_child(mbox, btn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ typedef struct
|
||||
/*New data for this type */
|
||||
lv_obj_t * txt; /*Text of the message box*/
|
||||
lv_obj_t * btnh; /*Holder of the buttons*/
|
||||
lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Style of the buttons*/
|
||||
lv_style_t * style_btn_rel; /*Style of the released buttons*/
|
||||
lv_style_t * style_btn_pr; /*Style of the pressed buttons*/
|
||||
}lv_mbox_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -71,28 +72,39 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set the text of the message box
|
||||
* @param mbox pointer to a message box
|
||||
* @param txt a '\0' terminated character string which will be the message box text
|
||||
* A release action which can be assigned to a message box button to close it
|
||||
* @param btn pointer to the released button
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return always lv_action_res_t because the button is deleted with the mesage box
|
||||
*/
|
||||
void lv_mbox_set_text(lv_obj_t * mbox, const char * txt);
|
||||
void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina);
|
||||
lv_action_res_t lv_mbox_close_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
|
||||
/**
|
||||
* Add a button to the message box
|
||||
* @param mbox pointer to message box object
|
||||
* @param btn_txt the text of the button
|
||||
* @param rel_action a function which will be called when the button is relesed
|
||||
* @param rel_action a function which will be called when the button is released
|
||||
* @return pointer to the created button (lv_btn)
|
||||
*/
|
||||
lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t rel_action);
|
||||
|
||||
/**
|
||||
* A release action which can be assigned to a message box button to close it
|
||||
* @param btn pointer to the released button
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return always LV_ACTION_RES_INV because the button is deleted with the message box
|
||||
* Set the text of the message box
|
||||
* @param mbox pointer to a message box
|
||||
* @param txt a '\0' terminated character string which will be the message box text
|
||||
*/
|
||||
lv_action_res_t lv_mbox_close_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
void lv_mbox_set_text(lv_obj_t * mbox, const char * txt);
|
||||
|
||||
/**
|
||||
* Set styles of the buttons of a message box in each state
|
||||
* @param mbox pointer to a message box object
|
||||
* @param rel pointer to a style for releases state
|
||||
* @param pr pointer to a style for pressed state
|
||||
* @param trel pointer to a style for toggled releases state
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr);
|
||||
|
||||
/**
|
||||
* Automatically delete the message box after a given time
|
||||
@@ -122,6 +134,15 @@ const char * lv_mbox_get_txt(lv_obj_t * mbox);
|
||||
*/
|
||||
lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn);
|
||||
|
||||
/**
|
||||
* Get the style of the buttons on a message box
|
||||
* @param mbox pointer to a message box object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
lv_style_t * lv_mbox_get_style_btn(lv_obj_t * mbox, lv_btn_state_t state);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../lv_objx/lv_cont.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_obj/lv_refr.h"
|
||||
#include "../lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -73,7 +73,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->sbh_draw = 0;
|
||||
ext->sbv_draw = 0;
|
||||
ext->style_sb = lv_style_get(LV_STYLE_PRETTY, NULL);
|
||||
ext->sb_width = LV_DPI / 8;
|
||||
ext->sb_width = LV_DPI / 6;
|
||||
ext->sb_mode = LV_PAGE_SB_MODE_ON;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_page);
|
||||
@@ -89,6 +89,10 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_cont_set_fit(ext->scrl, true, true);
|
||||
lv_obj_set_style(ext->scrl, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
|
||||
lv_page_set_sb_width(new_page, ext->sb_width);
|
||||
lv_page_set_sb_mode(new_page, ext->sb_mode);
|
||||
lv_page_set_style_sb(new_page, ext->style_sb);
|
||||
|
||||
/* Add the signal function only if 'scrolling' is created
|
||||
* because everything has to be ready before any signal is received*/
|
||||
lv_obj_set_signal_f(new_page, lv_page_signal);
|
||||
@@ -101,6 +105,9 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
lv_page_set_pr_action(new_page, copy_ext->pr_action);
|
||||
lv_page_set_rel_action(new_page, copy_ext->rel_action);
|
||||
lv_page_set_sb_mode(new_page, copy_ext->sb_mode);
|
||||
lv_page_set_sb_width(new_page, copy_ext->sb_width);
|
||||
lv_page_set_style_sb(new_page, copy_ext->style_sb);
|
||||
|
||||
/* Add the signal function only if 'scrolling' is created
|
||||
* because everything has to be ready before any signal is received*/
|
||||
@@ -150,9 +157,6 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
area_set_height(&ext->sbh, ext->sb_width);
|
||||
area_set_width(&ext->sbv, ext->sb_width);
|
||||
|
||||
if(ext->sb_mode == LV_PAGE_SB_MODE_ON) {
|
||||
ext->sbh_draw = 1;
|
||||
ext->sbv_draw = 1;
|
||||
@@ -368,6 +372,9 @@ void lv_page_set_sb_width(lv_obj_t * page, cord_t sb_width)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext(page);
|
||||
ext->sb_width = sb_width;
|
||||
area_set_height(&ext->sbh, ext->sb_width);
|
||||
area_set_width(&ext->sbv, ext->sb_width);
|
||||
lv_page_sb_refresh(page);
|
||||
lv_obj_inv(page);
|
||||
}
|
||||
|
||||
@@ -380,6 +387,7 @@ void lv_page_set_sb_mode(lv_obj_t * page, lv_page_sb_mode_t sb_mode)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext(page);
|
||||
ext->sb_mode = sb_mode;
|
||||
page->signal_f(page, LV_SIGNAL_STYLE_CHG, NULL);
|
||||
lv_obj_inv(page);
|
||||
}
|
||||
|
||||
@@ -579,7 +587,6 @@ static bool lv_page_design(lv_obj_t * page, const area_t * mask, lv_design_mode_
|
||||
*/
|
||||
static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
{
|
||||
// return;
|
||||
/*Always let sb_width padding above,under, left and right to the scrollbars
|
||||
* else:
|
||||
* - horizontal and vertical scrollbars can overlap on the corners
|
||||
|
||||
@@ -40,7 +40,7 @@ typedef enum
|
||||
/*Data of page*/
|
||||
typedef struct
|
||||
{
|
||||
lv_cont_ext_t bg_rect; /*Ext. of ancestor*/
|
||||
lv_cont_ext_t bg; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * scrl; /*The scrollable object on the background*/
|
||||
lv_action_t rel_action; /*Function to call when the page is released*/
|
||||
@@ -89,6 +89,27 @@ void lv_page_set_rel_action(lv_obj_t * page, lv_action_t rel_action);
|
||||
*/
|
||||
void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action);
|
||||
|
||||
/**
|
||||
* Set the scroll bar width on a page
|
||||
* @param page pointer to a page object
|
||||
* @param sb_width the new scroll bar width in pixels
|
||||
*/
|
||||
void lv_page_set_sb_width(lv_obj_t * page, cord_t sb_width);
|
||||
|
||||
/**
|
||||
* Set the scroll bar mode on a page
|
||||
* @param page pointer to a page object
|
||||
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_page_sb_mode_t sb_mode);
|
||||
|
||||
/**
|
||||
* Set a new style for the scroll bars object on the page
|
||||
* @param page pointer to a page object
|
||||
* @param style pointer to a style for the scroll bars
|
||||
*/
|
||||
void lv_page_set_style_sb(lv_obj_t * page, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Glue the object to the page. After it the page can be moved (dragged) with this object too.
|
||||
* @param obj pointer to an object on a page
|
||||
@@ -96,9 +117,6 @@ void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action);
|
||||
*/
|
||||
void lv_page_glue_obj(lv_obj_t * obj, bool glue);
|
||||
|
||||
void lv_page_set_sb_width(lv_obj_t * page, cord_t sb_width);
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_page_sb_mode_t sb_mode);
|
||||
void lv_page_set_style_sb(lv_obj_t * page, lv_style_t * style);
|
||||
/**
|
||||
* Focus on an object. It ensures that the object will be visible on the page.
|
||||
* @param page pointer to a page object
|
||||
@@ -110,10 +128,15 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en);
|
||||
/**
|
||||
* Get the scrollable object of a page-
|
||||
* @param page pointer to page object
|
||||
* @return pointer to container which is the scrollable part of the page
|
||||
* @return pointer to a container which is the scrollable part of the page
|
||||
*/
|
||||
lv_obj_t * lv_page_get_scrl(lv_obj_t * page);
|
||||
|
||||
/**
|
||||
* Get the scroll bar width on a page
|
||||
* @param page pointer to a page object
|
||||
* @return the scroll bar width in pixels
|
||||
*/
|
||||
cord_t lv_page_get_sb_width(lv_obj_t * page);
|
||||
|
||||
/**
|
||||
@@ -123,6 +146,11 @@ cord_t lv_page_get_sb_width(lv_obj_t * page);
|
||||
*/
|
||||
lv_page_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
|
||||
|
||||
/**
|
||||
* Set a new style for the scroll bars object on the page
|
||||
* @param page pointer to a page object
|
||||
* @return pointer to a style for the scroll bars
|
||||
*/
|
||||
lv_style_t * lv_page_get_style_sb(lv_obj_t * page);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -63,7 +63,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->cb = NULL;
|
||||
ext->tmp_value = ext->bar.min_value;
|
||||
ext->style_knob = lv_style_get(LV_STYLE_PRETTY_COLOR, NULL);
|
||||
ext->style_knob = lv_style_get(LV_STYLE_PRETTY, NULL);
|
||||
|
||||
/* Save the bar design function.
|
||||
* It will be used in the sllider design function*/
|
||||
@@ -76,6 +76,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new slider slider*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_slider, true);
|
||||
lv_slider_set_style_knob(new_slider, ext->style_knob);
|
||||
}
|
||||
/*Copy an existing slider*/
|
||||
else {
|
||||
@@ -108,17 +109,15 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext(slider);
|
||||
// lv_bars_t * style = lv_obj_get_style(slider);
|
||||
point_t p;
|
||||
cord_t w = lv_obj_get_width(slider);
|
||||
cord_t h = lv_obj_get_height(slider);
|
||||
int16_t tmp;
|
||||
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_PRESSED:
|
||||
if(sign == LV_SIGNAL_PRESSED) {
|
||||
ext->tmp_value = lv_bar_get_value(slider);
|
||||
break;
|
||||
case LV_SIGNAL_PRESSING:
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
lv_dispi_get_point(param, &p);
|
||||
if(w > h) {
|
||||
p.x -= slider->cords.x1 + h / 2; /*Modify the point to shift with half knob (important on the start and end)*/
|
||||
@@ -130,18 +129,26 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
lv_bar_set_value(slider, tmp);
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_PRESS_LOST:
|
||||
}
|
||||
else if (sign == LV_SIGNAL_PRESS_LOST) {
|
||||
lv_bar_set_value(slider, ext->tmp_value);
|
||||
break;
|
||||
case LV_SIGNAL_RELEASED:
|
||||
}
|
||||
else if (sign == LV_SIGNAL_RELEASED) {
|
||||
ext->tmp_value = lv_bar_get_value(slider);
|
||||
lv_bar_set_value(slider, ext->tmp_value);
|
||||
if(ext->cb != NULL) ext->cb(slider, param);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
/* The knob size depends on slider size.
|
||||
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
|
||||
if(lv_obj_get_width(slider) != area_get_width(param) ||
|
||||
lv_obj_get_height(slider) != area_get_height(param)) {
|
||||
slider->signal_f(slider, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
cord_t x = MATH_MIN(w, h);
|
||||
if(slider->ext_size < x) slider->ext_size = x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,10 +175,13 @@ void lv_slider_set_action(lv_obj_t * slider, lv_action_t cb)
|
||||
* @param slider pointer to slider object
|
||||
* @param style pointer the new knob style
|
||||
*/
|
||||
void lv_slider_set_sytle_knob(lv_obj_t * slider, lv_style_t * style)
|
||||
void lv_slider_set_style_knob(lv_obj_t * slider, lv_style_t * style)
|
||||
{
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext(slider);
|
||||
ext->style_knob = style;
|
||||
|
||||
slider->signal_f(slider, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
|
||||
lv_obj_inv(slider);
|
||||
}
|
||||
|
||||
@@ -195,7 +205,7 @@ lv_action_t lv_slider_get_action(lv_obj_t * slider)
|
||||
* @param slider pointer to slider object
|
||||
* @return pointer the new knob style
|
||||
*/
|
||||
lv_style_t * lv_slider_get_sytle_knob(lv_obj_t * slider)
|
||||
lv_style_t * lv_slider_get_style_knob(lv_obj_t * slider)
|
||||
{
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext(slider);
|
||||
return ext->style_knob;
|
||||
@@ -220,50 +230,66 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design_f(slider, mask, mode);
|
||||
return false;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_style_t * style_slider = lv_obj_get_style(slider);
|
||||
lv_style_t * style_knob = lv_slider_get_style_knob(slider);
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(slider);
|
||||
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext(slider);
|
||||
area_t area_bar;
|
||||
|
||||
area_cpy(&area_bar, &slider->cords);
|
||||
area_bar.x1 += style_knob->hpad;
|
||||
area_bar.x2 -= style_knob->hpad;
|
||||
area_bar.y1 += style_knob->vpad;
|
||||
area_bar.y2 -= style_knob->vpad;
|
||||
lv_draw_rect(&area_bar, mask, style_slider);
|
||||
|
||||
cord_t w = lv_obj_get_width(slider);
|
||||
cord_t h = lv_obj_get_height(slider);
|
||||
area_t area_indic;
|
||||
area_cpy(&area_indic, &area_bar);
|
||||
area_indic.x1 += style_indic->hpad;
|
||||
area_indic.x2 -= style_indic->hpad;
|
||||
area_indic.y1 += style_indic->vpad;
|
||||
area_indic.y2 -= style_indic->vpad;
|
||||
|
||||
/*Modify the bar act_value to keep until the farer edge of knob*/
|
||||
int16_t tmp;
|
||||
int16_t range = ext->bar.max_value - ext->bar.min_value;
|
||||
if(w >= h) {
|
||||
int16_t knob_value = (int32_t)((int32_t)h * range) / w;
|
||||
tmp = (int32_t)((int32_t)(range - (ext->bar.act_value - ext->bar.min_value)) * knob_value) / range;
|
||||
ext->bar.act_value +=tmp;
|
||||
cord_t slider_w = area_get_width(&slider->cords);
|
||||
cord_t slider_h = area_get_height(&slider->cords);
|
||||
cord_t act_value = lv_bar_get_value(slider);
|
||||
cord_t min_value = lv_bar_get_min_value(slider);
|
||||
cord_t max_value = lv_bar_get_max_value(slider);
|
||||
|
||||
if(slider_w >= slider_h) {
|
||||
area_indic.x2 = (int32_t) ((int32_t)area_get_width(&area_indic) * act_value) / (max_value - min_value);
|
||||
area_indic.x2 += area_indic.x1;
|
||||
} else {
|
||||
int16_t knob_value = (int32_t)((int32_t)w * range) / h;
|
||||
tmp = (int32_t)((int32_t)(range - (ext->bar.act_value - ext->bar.min_value)) * knob_value) / range;
|
||||
ext->bar.act_value +=tmp;
|
||||
|
||||
area_indic.y1 = (int32_t) ((int32_t)area_get_height(&area_indic) * act_value) / (max_value - min_value);
|
||||
area_indic.y1 = area_indic.y2 - area_indic.y1;
|
||||
}
|
||||
|
||||
ancestor_design_f(slider, mask, mode);
|
||||
ext->bar.act_value -=tmp;
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&area_indic, mask, style_indic);
|
||||
|
||||
area_t knob_area;
|
||||
area_cpy(&knob_area, &slider->cords);
|
||||
|
||||
if(w >= h) {
|
||||
knob_area.x2 = (int32_t) ((int32_t)(w - h) * ext->bar.act_value) / range;
|
||||
knob_area.x2 += knob_area.x1;
|
||||
knob_area.x2 += h;
|
||||
knob_area.x1 = knob_area.x2 - h;
|
||||
} else {
|
||||
if(slider_w >= slider_h) {
|
||||
knob_area.x1 = area_indic.x2 - slider_h / 2;
|
||||
knob_area.x2 = knob_area.x1 + slider_h;
|
||||
|
||||
knob_area.y1 = slider->cords.y1;
|
||||
knob_area.y2 = slider->cords.y2;
|
||||
} else {
|
||||
knob_area.y1 = area_indic.y1 - slider_w / 2;
|
||||
knob_area.y2 = knob_area.y1 + slider_w;
|
||||
|
||||
knob_area.x1 = slider->cords.x1;
|
||||
knob_area.x2 = slider->cords.x2;
|
||||
|
||||
knob_area.y1 = (int32_t) ((int32_t)(h - w) * ext->bar.act_value) / range;
|
||||
knob_area.y1 = knob_area.y2 - knob_area.y1;
|
||||
knob_area.y1 -= w;
|
||||
knob_area.y2 = knob_area.y1 + w;
|
||||
}
|
||||
|
||||
lv_draw_rect(&knob_area, mask, ext->style_knob);
|
||||
lv_draw_rect(&knob_area, mask, style_knob);
|
||||
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef struct
|
||||
lv_bar_ext_t bar; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_action_t cb; /*Function to call when a new value is set*/
|
||||
int16_t tmp_value; /*Store temporal value during press until release (Handled by the library)*/
|
||||
lv_style_t * style_knob; /*Styée of the knob*/
|
||||
lv_style_t * style_knob; /*Style of the knob*/
|
||||
int16_t tmp_value; /*Store a temporal value during press until release (Handled by the library)*/
|
||||
}lv_slider_ext_t;
|
||||
|
||||
/*Built-in styles of slider*/
|
||||
@@ -59,6 +59,33 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
*/
|
||||
bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set a function which will be called when a new value is set on the slider
|
||||
* @param slider pointer to slider object
|
||||
* @param cb a callback function
|
||||
*/
|
||||
void lv_slider_set_action(lv_obj_t * slider, lv_action_t cb);
|
||||
|
||||
/**
|
||||
* Set the style of knob on a slider
|
||||
* @param slider pointer to slider object
|
||||
* @param style pointer the new knob style
|
||||
*/
|
||||
void lv_slider_set_style_knob(lv_obj_t * slider, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the slider callback function
|
||||
* @param slider pointer to slider object
|
||||
* @return the callback function
|
||||
*/
|
||||
lv_action_t lv_slider_get_action(lv_obj_t * slider);
|
||||
|
||||
/**
|
||||
* Get the style of knob on a slider
|
||||
* @param slider pointer to slider object
|
||||
* @return pointer the new knob style
|
||||
*/
|
||||
lv_style_t * lv_slider_get_style_knob(lv_obj_t * slider);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if USE_LV_TA != 0
|
||||
|
||||
#include "lv_ta.h"
|
||||
#include "lvgl/lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
/*********************
|
||||
@@ -38,7 +38,7 @@
|
||||
**********************/
|
||||
static bool lv_ta_design(lv_obj_t * ta, const area_t * mask, lv_design_mode_t mode);
|
||||
static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_ta_hide_cursor(lv_obj_t * ta, uint8_t hide);
|
||||
static void lv_ta_hide_cursor_anim(lv_obj_t * ta, uint8_t hide);
|
||||
static void lv_ta_save_valid_cursor_x(lv_obj_t * ta);
|
||||
|
||||
/**********************
|
||||
@@ -74,7 +74,8 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_ta_ext_t * ext = lv_obj_alloc_ext(new_ta, sizeof(lv_ta_ext_t));
|
||||
dm_assert(ext);
|
||||
ext->cur_hide = 0;
|
||||
ext->cursor_show = 1;
|
||||
ext->cursor_state = 0;
|
||||
ext->cursor_pos = 0;
|
||||
ext->cursor_valid_x = 0;
|
||||
ext->label = NULL;
|
||||
@@ -113,7 +114,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Create a cursor blinker animation*/
|
||||
anim_t a;
|
||||
a.var = new_ta;
|
||||
a.fp = (anim_fp_t)lv_ta_hide_cursor;
|
||||
a.fp = (anim_fp_t)lv_ta_hide_cursor_anim;
|
||||
a.time = LV_TA_CUR_BLINK_TIME;
|
||||
a.act_time = 0;
|
||||
a.end_cb = NULL;
|
||||
@@ -325,7 +326,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
}
|
||||
|
||||
/*Check the bottom*/
|
||||
cord_t font_h = font_get_height(font_p) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
|
||||
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->vpad > ta_cords.y2) {
|
||||
lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) +
|
||||
font_h + 2 * style_scrl->vpad));
|
||||
@@ -380,7 +381,7 @@ void lv_ta_cursor_down(lv_obj_t * ta)
|
||||
/*Increment the y with one line and keep the valid x*/
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->label);
|
||||
const font_t * font_p = label_style->font;
|
||||
cord_t font_h = font_get_height(font_p) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
|
||||
pos.y += font_h + label_style->line_space + 1;
|
||||
pos.x = ext->cursor_valid_x;
|
||||
|
||||
@@ -407,7 +408,7 @@ void lv_ta_cursor_up(lv_obj_t * ta)
|
||||
/*Decrement the y with one line and keep the valid x*/
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->label);
|
||||
const font_t * font = label_style->font;
|
||||
cord_t font_h = font_get_height(font) >> LV_FONT_ANTIALIAS;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
pos.y -= font_h + label_style->line_space - 1;
|
||||
pos.x = ext->cursor_valid_x;
|
||||
|
||||
@@ -416,6 +417,17 @@ void lv_ta_cursor_up(lv_obj_t * ta)
|
||||
lv_ta_set_cursor_pos(ta, new_cur_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current cursor visibility.
|
||||
* @param ta pointer to a text area object
|
||||
* @return show true: show the cursor and blink it, false: hide cursor
|
||||
*/
|
||||
void lv_ta_set_cursor_show(lv_obj_t * ta, bool show)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext(ta);
|
||||
ext->cursor_show = show == false ? 0 : 1;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -442,6 +454,17 @@ uint16_t lv_ta_get_cursor_pos(lv_obj_t * ta)
|
||||
return ext->cursor_pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current cursor visibility.
|
||||
* @param ta pointer to a text area object
|
||||
* @return true: the cursor is drawn, false: the cursor is hidden
|
||||
*/
|
||||
bool lv_ta_get_cursor_show(lv_obj_t * ta)
|
||||
{
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext(ta);
|
||||
return ext->cursor_show;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -497,7 +520,7 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des
|
||||
lv_ta_ext_t * ta_ext = lv_obj_get_ext(ta);
|
||||
lv_style_t * ta_style = lv_obj_get_style(ta);
|
||||
|
||||
if(ta_ext->cursor_show != 0 && ta_ext->cur_hide == 0) {
|
||||
if(ta_ext->cursor_show != 0 && ta_ext->cursor_state == 0) {
|
||||
uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
|
||||
point_t letter_pos;
|
||||
lv_label_get_letter_pos(ta_ext->label, cur_pos, &letter_pos);
|
||||
@@ -507,7 +530,7 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->cords.x1;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->cords.y1;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->cords.x1 + LV_DOWNSCALE ;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + (font_get_height(labels_p->font) >> LV_FONT_ANTIALIAS);
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->cords.y1 + (font_get_height(labels_p->font) >> FONT_ANTIALIAS);
|
||||
|
||||
lv_style_t cur_rects;
|
||||
lv_style_get(LV_STYLE_PLAIN, &cur_rects);
|
||||
@@ -524,16 +547,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrling, const area_t * mask, lv_des
|
||||
|
||||
|
||||
/**
|
||||
* Set the cursor visibility to make a blinking cursor
|
||||
* Called to blink the cursor
|
||||
* @param ta pointer to a text area
|
||||
* @param hide 1: hide the cursor, 0: draw it
|
||||
* @param hide 1: hide the cursor, 0: show it
|
||||
*/
|
||||
static void lv_ta_hide_cursor(lv_obj_t * ta, uint8_t hide)
|
||||
static void lv_ta_hide_cursor_anim(lv_obj_t * ta, uint8_t hide)
|
||||
{
|
||||
lv_ta_ext_t * ta_ext = lv_obj_get_ext(ta);
|
||||
if(hide != ta_ext->cur_hide) {
|
||||
ta_ext->cur_hide = hide == 0 ? 0 : 1;
|
||||
lv_obj_inv(ta);
|
||||
if(hide != ta_ext->cursor_state) {
|
||||
ta_ext->cursor_state = hide == 0 ? 0 : 1;
|
||||
if(ta_ext->cursor_show != 0) lv_obj_inv(ta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ typedef struct
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * label; /*Label of the text area*/
|
||||
cord_t cursor_valid_x; /*Used when stepping up/down in text area. Handled by the library*/
|
||||
uint16_t cursor_pos; /*The current cursor position (0: before 1. letter, 1: before 2. letter etc.)*/
|
||||
uint8_t cur_hide :1; /*Indicates that the cursor is visible now or not*/
|
||||
uint8_t cursor_show :1; /*Flag to indicate the cursor is now being shown or not (Handled by the library)*/
|
||||
cord_t cursor_valid_x; /*Used when stepping up/down in text area when stepping to a shorter line. (Handled by the library)*/
|
||||
uint16_t cursor_pos; /*The current cursor position (0: before 1. letter; 1: before 2. letter etc.)*/
|
||||
uint8_t cursor_show :1; /*Show or hide cursor */
|
||||
uint8_t cursor_state :1; /*Indicates that the cursor is visible now or not (Handled by the library)*/
|
||||
}lv_ta_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -127,6 +127,13 @@ void lv_ta_cursor_down(lv_obj_t * ta);
|
||||
*/
|
||||
void lv_ta_cursor_up(lv_obj_t * ta);
|
||||
|
||||
/**
|
||||
* Get the current cursor visibility.
|
||||
* @param ta pointer to a text area object
|
||||
* @return show true: show the cursor and blink it, false: hide cursor
|
||||
*/
|
||||
void lv_ta_set_cursor_show(lv_obj_t * ta, bool show);
|
||||
|
||||
/**
|
||||
* Get the text of the i the text area
|
||||
* @param ta obj pointer to a text area object
|
||||
@@ -141,6 +148,14 @@ const char * lv_ta_get_txt(lv_obj_t * ta);
|
||||
*/
|
||||
uint16_t lv_ta_get_cursor_pos(lv_obj_t * ta);
|
||||
|
||||
/**
|
||||
* Get the current cursor visibility.
|
||||
* @param ta pointer to a text area object
|
||||
* @return true: the cursor is drawn, false: the cursor is hidden
|
||||
*/
|
||||
bool lv_ta_get_cursor_show(lv_obj_t * ta);
|
||||
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -75,7 +75,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
ext->page = lv_page_create(new_win, NULL);
|
||||
lv_obj_set_protect(ext->page, LV_PROTECT_PARENT);
|
||||
lv_obj_set_style(ext->page, lv_style_get(LV_STYLE_TRANSP, NULL));
|
||||
lv_obj_set_style(ext->page, lv_style_get(LV_STYLE_PLAIN, NULL));
|
||||
lv_page_set_sb_mode(ext->page, LV_PAGE_SB_MODE_AUTO);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
|
||||
@@ -271,19 +271,18 @@ void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size)
|
||||
/**
|
||||
* Set the style of the window control buttons in a given state
|
||||
* @param win pointer to a window object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @param style pointer to style
|
||||
* @param rel spointer to the style in released state
|
||||
* @param pr pointer to the style in pressed state
|
||||
*/
|
||||
void lv_win_set_style_cbtn(lv_obj_t * win, lv_btn_state_t state, lv_style_t * style)
|
||||
void lv_win_set_style_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext(win);
|
||||
if(state == LV_BTN_STATE_REL) ext->style_cbtn_rel = style;
|
||||
if(state == LV_BTN_STATE_PR) ext->style_cbtn_pr = style;
|
||||
ext->style_cbtn_rel = rel;
|
||||
ext->style_cbtn_pr = pr;
|
||||
lv_obj_t * cbtn;
|
||||
cbtn = lv_obj_get_child(ext->btnh, NULL);
|
||||
while(cbtn != NULL) {
|
||||
lv_btn_set_styles(cbtn, ext->style_cbtn_rel, ext->style_cbtn_pr, NULL, NULL, NULL);
|
||||
|
||||
cbtn = lv_obj_get_child(ext->btnh, cbtn);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#if USE_LV_WIN != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_win: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_BTN == 0
|
||||
#error "lv_win: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#endif
|
||||
@@ -29,9 +25,6 @@
|
||||
#error "lv_win: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_PAGE == 0
|
||||
#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_PAGE == 0
|
||||
#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
|
||||
@@ -57,7 +50,7 @@ typedef struct
|
||||
{
|
||||
/*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * page;
|
||||
lv_obj_t * page; /*Pointer to a page which holds the content*/
|
||||
lv_obj_t * header; /*Pointer to the header container of the window*/
|
||||
lv_obj_t * title; /*Pointer to the title label of the window*/
|
||||
lv_obj_t * btnh; /*Pointer to the control button holder container of the window*/
|
||||
@@ -101,7 +94,7 @@ lv_obj_t * lv_win_add_ctrl_btn(lv_obj_t * win, const char * img_path, lv_action_
|
||||
* A release action which can be assigned to a window control button to close it
|
||||
* @param btn pointer to the released button
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return always false because the button is deleted with the window
|
||||
* @return always LV_ACTION_RES_INV because the button is deleted with the window
|
||||
*/
|
||||
lv_action_res_t lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
|
||||
@@ -112,6 +105,21 @@ lv_action_res_t lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
*/
|
||||
void lv_win_set_title(lv_obj_t * win, const char * title);
|
||||
|
||||
/**
|
||||
* Set the control button size of a window
|
||||
* @param win pointer to a window object
|
||||
* @return control button size
|
||||
*/
|
||||
void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size);
|
||||
|
||||
/**
|
||||
* Set the style of the window control buttons in a given state
|
||||
* @param win pointer to a window object
|
||||
* @param rel spointer to the style in released state
|
||||
* @param pr pointer to the style in pressed state
|
||||
*/
|
||||
void lv_win_set_style_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr);
|
||||
|
||||
/**
|
||||
* Get the title of a window
|
||||
* @param win pointer to a window object
|
||||
@@ -119,10 +127,32 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
|
||||
*/
|
||||
const char * lv_win_get_title(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
* Get the page of a window
|
||||
* @param win pointer to a window object
|
||||
* @return page pointer to the page object of the window
|
||||
*/
|
||||
lv_obj_t * lv_win_get_page(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
* Get the s window header
|
||||
* @param win pointer to a window object
|
||||
* @return pointer to the window header object (lv_rect)
|
||||
*/
|
||||
lv_obj_t * lv_win_get_header(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
* Get the control button size of a window
|
||||
* @param win pointer to a window object
|
||||
* @return control button size
|
||||
*/
|
||||
cord_t lv_win_get_cbtn_size(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
* Get width of the content area (page scrollable) of the window
|
||||
* @param win pointer to a window object
|
||||
* @return the width of the contetn area
|
||||
*/
|
||||
cord_t lv_win_get_width(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user