minor fixes

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-25 19:59:23 +01:00
parent 35c55291e3
commit 63bc72e53a
10 changed files with 54 additions and 37 deletions

View File

@@ -1,11 +1,11 @@
//#include "../../../lvgl.h" #include "../../../lvgl.h"
//#if LV_USE_BAR && LV_BUILD_EXAMPLES #if LV_USE_BAR && LV_BUILD_EXAMPLES
//
//static void set_value(void *bar, int32_t v) //static void set_value(void *bar, int32_t v)
//{ //{
// lv_bar_set_value(bar, v, LV_ANIM_OFF); // lv_bar_set_value(bar, v, LV_ANIM_OFF);
//} //}
//
//static void event_cb(lv_obj_t * obj, lv_event_t e) //static void event_cb(lv_obj_t * obj, lv_event_t e)
//{ //{
// if(e == LV_EVENT_DRAW_POST_END) { // if(e == LV_EVENT_DRAW_POST_END) {
@@ -42,12 +42,12 @@
// lv_draw_label(&txt_area, clip_area, &dsc, buf, NULL); // lv_draw_label(&txt_area, clip_area, &dsc, buf, NULL);
// } // }
//} //}
//
///** /**
// * Custom drawer on bar to display the current value * Custom drawer on bar to display the current value
// */ */
//void lv_example_bar_6(void) void lv_example_bar_6(void)
//{ {
// static lv_style_t style_bg; // static lv_style_t style_bg;
// lv_style_init(&style_bg); // lv_style_init(&style_bg);
// lv_style_set_content_ofs_y(&style_bg, -3); // lv_style_set_content_ofs_y(&style_bg, -3);
@@ -67,7 +67,7 @@
// lv_anim_set_playback_time(&a, 2000); // lv_anim_set_playback_time(&a, 2000);
// lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); // lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
// lv_anim_start(&a); // lv_anim_start(&a);
//
//} }
//
//#endif #endif

View File

@@ -33,5 +33,6 @@ void lv_example_btn_1(void)
label = lv_label_create(btn2); label = lv_label_create(btn2);
lv_label_set_text(label, "Toggle"); lv_label_set_text(label, "Toggle");
lv_obj_center(label); lv_obj_center(label);
lv_label_set_text(label, "Togglasdasasdasdase");
} }
#endif #endif

View File

@@ -1,4 +1,4 @@
//#include "../../../lvgl.h" #include "../../../lvgl.h"
//#if LV_USE_SLIDER && LV_BUILD_EXAMPLES //#if LV_USE_SLIDER && LV_BUILD_EXAMPLES
// //
//static void slider_event_cb(lv_obj_t * slider, lv_event_t event); //static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
@@ -9,8 +9,8 @@
///** ///**
// * Show the current value when the slider if pressed using a fancy style transition. // * Show the current value when the slider if pressed using a fancy style transition.
// */ // */
//void lv_example_slider_2(void) void lv_example_slider_2(void)
//{ {
// lv_style_init(&style_def); // lv_style_init(&style_def);
// lv_style_set_content_opa(&style_def, LV_OPA_TRANSP); // lv_style_set_content_opa(&style_def, LV_OPA_TRANSP);
// lv_style_set_content_align(&style_def, LV_ALIGN_OUT_TOP_MID); // lv_style_set_content_align(&style_def, LV_ALIGN_OUT_TOP_MID);
@@ -27,7 +27,7 @@
// //
// lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_DEFAULT, &style_def); // lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_DEFAULT, &style_def);
// lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style_pr); // lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style_pr);
//} }
// //
//static void slider_event_cb(lv_obj_t * slider, lv_event_t event) //static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
//{ //{

View File

@@ -1,4 +1,4 @@
//#include "../../../lvgl.h" #include "../../../lvgl.h"
//#if LV_USE_SLIDER && LV_BUILD_EXAMPLES //#if LV_USE_SLIDER && LV_BUILD_EXAMPLES
// //
//static void slider_event_cb(lv_obj_t * slider, lv_event_t event); //static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
@@ -7,8 +7,8 @@
// * Show the current value when the slider if pressed (using only styles). // * Show the current value when the slider if pressed (using only styles).
// * // *
// */ // */
//void lv_example_slider_3(void) void lv_example_slider_3(void)
//{ {
// /*Create a slider in the center of the display*/ // /*Create a slider in the center of the display*/
// lv_obj_t * slider; // lv_obj_t * slider;
// slider = lv_slider_create(lv_scr_act()); // slider = lv_slider_create(lv_scr_act());
@@ -25,7 +25,7 @@
// //
// /*To update the value text*/ // /*To update the value text*/
// lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL); // lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
//} }
// //
//static void slider_event_cb(lv_obj_t * slider, lv_event_t event) //static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
//{ //{

View File

@@ -22,6 +22,7 @@
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../misc/lv_log.h" #include "../misc/lv_log.h"
#include "../hal/lv_hal.h" #include "../hal/lv_hal.h"
#include "../extra/layouts/lv_layouts.h"
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@@ -155,6 +156,9 @@ void lv_init(void)
LV_LOG_WARN("Log level is set the Trace which makes LVGL much slower") LV_LOG_WARN("Log level is set the Trace which makes LVGL much slower")
#endif #endif
lv_grid_init();
lv_flex_init();
lv_initialized = true; lv_initialized = true;
LV_LOG_TRACE("finished"); LV_LOG_TRACE("finished");
@@ -585,6 +589,11 @@ bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p)
return false; return false;
} }
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj)
{
return obj->class_p;
}
bool lv_obj_is_valid(const lv_obj_t * obj) bool lv_obj_is_valid(const lv_obj_t * obj)
{ {
lv_disp_t * disp = lv_disp_get_next(NULL); lv_disp_t * disp = lv_disp_get_next(NULL);

View File

@@ -483,13 +483,21 @@ lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj);
bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p); bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p);
/** /**
* Check if any object has a given type * Check if any object has a given class (type).
* It checks the ancestor classes too.
* @param obj pointer to an object * @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn") * @param class_p a class to check (e.g. `lv_slider_class`)
* @return true: valid * @return true: `obj` has the given class
*/ */
bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p); bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p);
/**
* Get the class (type) of the object
* @param obj pointer to an object
* @return the class (type) of the object
*/
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj);
/** /**
* Check if any object is still "alive", and part of the hierarchy * Check if any object is still "alive", and part of the hierarchy
* @param obj pointer to an object * @param obj pointer to an object

View File

@@ -165,21 +165,17 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
if(draw_dsc->bg_img_src) { if(draw_dsc->bg_img_src) {
draw_dsc->bg_img_opa = lv_obj_get_style_bg_img_opa(obj, part); draw_dsc->bg_img_opa = lv_obj_get_style_bg_img_opa(obj, part);
if(draw_dsc->bg_img_opa > LV_OPA_MIN) { if(draw_dsc->bg_img_opa > LV_OPA_MIN) {
draw_dsc->bg_img_tiled = lv_obj_get_style_bg_img_tiled(obj, part); if(lv_img_src_get_type(draw_dsc->bg_img_src) == LV_IMG_SRC_SYMBOL) {
draw_dsc->bg_img_symbol_font= lv_obj_get_style_text_font(obj, part);
draw_dsc->bg_img_recolor = lv_obj_get_style_text_color(obj, part);
} else {
draw_dsc->bg_img_recolor = lv_obj_get_style_bg_img_recolor(obj, part);
draw_dsc->bg_img_recolor_opa = lv_obj_get_style_bg_img_recolor_opa(obj, part);
draw_dsc->bg_img_tiled = lv_obj_get_style_bg_img_tiled(obj, part);
}
} }
} }
} }
draw_dsc->content_text = lv_obj_get_style_content_text(obj, part);
if(draw_dsc->content_text) {
draw_dsc->content_ofs_y = lv_obj_get_style_content_ofs_y(obj, part);
draw_dsc->content_ofs_x = lv_obj_get_style_content_ofs_x(obj, part);
draw_dsc->content_align = lv_obj_get_style_content_align(obj, part);
draw_dsc->content_font = lv_obj_get_style_content_font(obj, part);
draw_dsc->content_color = lv_obj_get_style_content_color_filtered(obj, part);
draw_dsc->content_letter_space = lv_obj_get_style_content_letter_space(obj, part);
draw_dsc->content_line_space = lv_obj_get_style_content_line_space(obj, part);
}
#endif #endif
} }

View File

@@ -65,6 +65,8 @@ extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE;
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
void lv_grid_init(void);
void lv_obj_set_grid_template(lv_obj_t * obj, const lv_coord_t * col_templ, const lv_coord_t * row_templ); void lv_obj_set_grid_template(lv_obj_t * obj, const lv_coord_t * col_templ, const lv_coord_t * row_templ);
void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place); void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place);

View File

@@ -6,6 +6,7 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <lvgl/src/core/lv_obj.h>
#include "lv_dropdown.h" #include "lv_dropdown.h"
#if LV_USE_DROPDOWN != 0 #if LV_USE_DROPDOWN != 0