call widget_invalidate in some set function

This commit is contained in:
xianjimli 2018-11-26 17:09:10 +08:00
parent a1e2ac2ca9
commit 3ab0f41ac7
8 changed files with 27 additions and 25 deletions

View File

@ -285,7 +285,7 @@
#include "assets/inc/images/3.data"
#include "assets/inc/images/arrow_left_n.data"
#include "assets/inc/images/edit_clear_p.data"
#endif/*WITH_STB_IMAGE*/
#endif /*WITH_STB_IMAGE*/
#ifdef WITH_VGCANVAS
#include "assets/inc/images/pointer_4.bsvg"
#include "assets/inc/images/china.bsvg"
@ -299,17 +299,17 @@
#include "assets/inc/images/pointer.bsvg"
#include "assets/inc/images/pointer_red.bsvg"
#include "assets/inc/images/girl.bsvg"
#endif/*WITH_VGCANVAS*/
#endif /*WITH_VGCANVAS*/
#ifdef WITH_STB_FONT
#ifdef WITH_MINI_FONT
#include "assets/inc/fonts/default.mini.res"
#else/*WITH_MINI_FONT*/
#else /*WITH_MINI_FONT*/
#include "assets/inc/fonts/default.res"
#endif/*WITH_MINI_FONT*/
#else/*WITH_STB_FONT*/
#endif /*WITH_MINI_FONT*/
#else /*WITH_STB_FONT*/
#include "assets/inc/fonts/default.data"
#endif/*WITH_STB_FONT*/
#endif/*WITH_FS_RES*/
#endif /*WITH_STB_FONT*/
#endif /*WITH_FS_RES*/
ret_t assets_init(void) {
assets_manager_t* rm = assets_manager();
@ -517,7 +517,7 @@ ret_t assets_init(void) {
assets_manager_add(rm, image_pointer);
assets_manager_add(rm, image_pointer_red);
assets_manager_add(rm, image_girl);
#endif/*WITH_VGCANVAS*/
#endif /*WITH_VGCANVAS*/
#endif
tk_init_assets();

View File

@ -125,7 +125,7 @@ ret_t image_set_draw_type(widget_t* widget, image_draw_type_t draw_type) {
image->draw_type = draw_type;
return RET_OK;
return widget_invalidate(widget, NULL);
}
widget_t* image_cast(widget_t* widget) {

2
src/base/image_base.c Executable file → Normal file
View File

@ -153,7 +153,7 @@ ret_t image_set_image(widget_t* widget, const char* name) {
image->image = tk_str_copy(image->image, name);
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t image_set_rotation(widget_t* widget, float_t rotation) {

View File

@ -155,7 +155,7 @@ ret_t progress_bar_set_vertical(widget_t* widget, bool_t vertical) {
progress_bar->vertical = vertical;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_bar_set_show_text(widget_t* widget, bool_t show_text) {
@ -164,7 +164,7 @@ ret_t progress_bar_set_show_text(widget_t* widget, bool_t show_text) {
progress_bar->show_text = show_text;
return RET_OK;
return widget_invalidate(widget, NULL);
}
static ret_t progress_bar_get_prop(widget_t* widget, const char* name, value_t* v) {

View File

@ -241,6 +241,7 @@ static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_t
slider->value = value;
widget_invalidate(widget, NULL);
widget_dispatch(widget, &evt);
widget_invalidate(widget, NULL);
}
return RET_OK;
@ -266,7 +267,7 @@ ret_t slider_set_min(widget_t* widget, uint16_t min) {
slider->min = min;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t slider_set_max(widget_t* widget, uint16_t max) {
@ -275,7 +276,7 @@ ret_t slider_set_max(widget_t* widget, uint16_t max) {
slider->max = max;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t slider_set_step(widget_t* widget, uint16_t step) {
@ -284,7 +285,7 @@ ret_t slider_set_step(widget_t* widget, uint16_t step) {
slider->step = step;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t slider_set_vertical(widget_t* widget, bool_t vertical) {
@ -293,7 +294,7 @@ ret_t slider_set_vertical(widget_t* widget, bool_t vertical) {
slider->vertical = vertical;
return RET_OK;
return widget_invalidate(widget, NULL);
}
static ret_t slider_get_prop(widget_t* widget, const char* name, value_t* v) {

View File

@ -107,7 +107,7 @@ ret_t progress_circle_set_max(widget_t* widget, uint32_t max) {
progress_circle->max = max;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_circle_set_line_width(widget_t* widget, uint32_t line_width) {
@ -116,7 +116,7 @@ ret_t progress_circle_set_line_width(widget_t* widget, uint32_t line_width) {
progress_circle->line_width = line_width;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_circle_set_start_angle(widget_t* widget, int32_t start_angle) {
@ -125,7 +125,7 @@ ret_t progress_circle_set_start_angle(widget_t* widget, int32_t start_angle) {
progress_circle->start_angle = start_angle;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_circle_set_unit(widget_t* widget, const char* unit) {
@ -134,7 +134,7 @@ ret_t progress_circle_set_unit(widget_t* widget, const char* unit) {
progress_circle->unit = tk_str_copy(progress_circle->unit, unit);
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_circle_set_show_text(widget_t* widget, bool_t show_text) {
@ -143,7 +143,7 @@ ret_t progress_circle_set_show_text(widget_t* widget, bool_t show_text) {
progress_circle->show_text = show_text;
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t progress_circle_set_counter_clock_wise(widget_t* widget, bool_t counter_clock_wise) {
@ -152,7 +152,7 @@ ret_t progress_circle_set_counter_clock_wise(widget_t* widget, bool_t counter_cl
progress_circle->counter_clock_wise = counter_clock_wise;
return RET_OK;
return widget_invalidate(widget, NULL);
}
static ret_t progress_circle_get_prop(widget_t* widget, const char* name, value_t* v) {

View File

@ -205,6 +205,7 @@ ret_t switch_set_value(widget_t* widget, bool_t value) {
aswitch->value = value;
e = event_init(EVT_VALUE_CHANGED, widget);
widget_dispatch(widget, &e);
widget_invalidate(widget, NULL);
}
if (value) {

View File

@ -441,7 +441,7 @@ ret_t text_selector_append_option(widget_t* widget, int32_t value, const char* t
text_selector->option_items = option;
}
return RET_OK;
return widget_invalidate(widget, NULL);
}
int32_t text_selector_count_options(widget_t* widget) {
@ -530,7 +530,7 @@ ret_t text_selector_set_selected_index(widget_t* widget, uint32_t index) {
text_selector_set_selected_index_only(text_selector, index);
text_selector_sync_yoffset_with_selected_index(text_selector);
return RET_OK;
return widget_invalidate(widget, NULL);
}
ret_t text_selector_set_visible_nr(widget_t* widget, uint32_t visible_nr) {
@ -540,7 +540,7 @@ ret_t text_selector_set_visible_nr(widget_t* widget, uint32_t visible_nr) {
text_selector->visible_nr = visible_nr == 3 ? 3 : 5;
text_selector_sync_yoffset_with_selected_index(text_selector);
return RET_OK;
return widget_invalidate(widget, NULL);
}
int32_t text_selector_get_value(widget_t* widget) {