mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
format code and fix slider
This commit is contained in:
parent
0216a4bfd8
commit
3dfa4409f3
@ -218,17 +218,17 @@
|
||||
#include "res/inc/images/unchecked.data"
|
||||
#include "res/inc/images/unmuted.data"
|
||||
#include "res/inc/images/warn.data"
|
||||
#endif/*WITH_STB_IMAGE*/
|
||||
#endif /*WITH_STB_IMAGE*/
|
||||
#ifdef WITH_STB_FONT
|
||||
#ifdef WITH_MINI_FONT
|
||||
#include "res/inc/fonts/default.mini.res"
|
||||
#else/*WITH_MINI_FONT*/
|
||||
#else /*WITH_MINI_FONT*/
|
||||
#include "res/inc/fonts/default.res"
|
||||
#endif/*WITH_MINI_FONT*/
|
||||
#else/*WITH_STB_FONT*/
|
||||
#endif /*WITH_MINI_FONT*/
|
||||
#else /*WITH_STB_FONT*/
|
||||
#include "res/inc/fonts/default.data"
|
||||
#endif/*WITH_STB_FONT*/
|
||||
#endif/*WITH_FS_RES*/
|
||||
#endif /*WITH_STB_FONT*/
|
||||
#endif /*WITH_FS_RES*/
|
||||
|
||||
ret_t resource_init(void) {
|
||||
resource_manager_t* rm = resource_manager();
|
||||
|
10
format.sh
10
format.sh
@ -1,6 +1,6 @@
|
||||
find src tools lua demos tests -name \*.c -exec clang-format -i {} \;
|
||||
find src tools lua demos tests -name \*.h -exec clang-format -i {} \;
|
||||
find src tools lua demos tests -name \*.cc -exec clang-format -i {} \;
|
||||
find src tools lua demos tests -name \*.cpp -exec clang-format -i {} \;
|
||||
find src tools lua demos tests -name \*.inc -exec clang-format -i {} \;
|
||||
find src tools demos tests -name \*.c -exec clang-format -i {} \;
|
||||
find src tools demos tests -name \*.h -exec clang-format -i {} \;
|
||||
find src tools demos tests -name \*.cc -exec clang-format -i {} \;
|
||||
find src tools demos tests -name \*.cpp -exec clang-format -i {} \;
|
||||
find src tools demos tests -name \*.inc -exec clang-format -i {} \;
|
||||
|
||||
|
2
src/base/locale.h
Executable file → Normal file
2
src/base/locale.h
Executable file → Normal file
@ -114,7 +114,7 @@ ret_t locale_change(tklocale_t* locale, const char* language, const char* countr
|
||||
/**
|
||||
* @method locale_on
|
||||
* 注册指定事件的处理函数。
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @param {tklocale_t*} locale 控件对象。
|
||||
* @param {event_type_t} type 事件类型,目前固定为EVT_LOCALE_CHANGED。
|
||||
* @param {event_func_t} on_event 事件处理函数。
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include "base/widget_vtable.h"
|
||||
#include "base/image_manager.h"
|
||||
|
||||
static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_type_t etype);
|
||||
static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_type_t etype,
|
||||
bool_t force);
|
||||
|
||||
static ret_t slider_get_dragger_rect(widget_t* widget, rect_t* r) {
|
||||
slider_t* slider = SLIDER(widget);
|
||||
@ -191,9 +192,7 @@ static ret_t slider_on_event(widget_t* widget, event_t* e) {
|
||||
fvalue = 1;
|
||||
}
|
||||
value = fvalue * (slider->max - slider->min) + slider->min;
|
||||
if (value != slider->value) {
|
||||
slider_set_value_internal(widget, value, EVT_VALUE_CHANGING);
|
||||
}
|
||||
slider_set_value_internal(widget, value, EVT_VALUE_CHANGING, FALSE);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -202,7 +201,7 @@ static ret_t slider_on_event(widget_t* widget, event_t* e) {
|
||||
if (slider->dragging) {
|
||||
slider->dragging = FALSE;
|
||||
widget_ungrab(widget->parent, widget);
|
||||
slider_set_value_internal(widget, slider->value, EVT_VALUE_CHANGED);
|
||||
slider_set_value_internal(widget, slider->value, EVT_VALUE_CHANGED, TRUE);
|
||||
}
|
||||
widget_set_state(widget, WIDGET_STATE_NORMAL);
|
||||
widget_invalidate(widget, NULL);
|
||||
@ -221,7 +220,8 @@ static ret_t slider_on_event(widget_t* widget, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_type_t etype) {
|
||||
static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_type_t etype,
|
||||
bool_t force) {
|
||||
event_t evt;
|
||||
uint16_t step = 0;
|
||||
uint16_t offset = 0;
|
||||
@ -236,7 +236,7 @@ static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_t
|
||||
value = slider->min + ((offset + (step >> 1) - 1) / step) * step;
|
||||
}
|
||||
|
||||
if (slider->value != value) {
|
||||
if (slider->value != value || force) {
|
||||
evt.type = etype;
|
||||
evt.target = widget;
|
||||
slider->value = value;
|
||||
@ -248,7 +248,7 @@ static ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_t
|
||||
}
|
||||
|
||||
ret_t slider_set_value(widget_t* widget, uint16_t value) {
|
||||
return slider_set_value_internal(widget, value, EVT_VALUE_CHANGED);
|
||||
return slider_set_value_internal(widget, value, EVT_VALUE_CHANGED, FALSE);
|
||||
}
|
||||
|
||||
ret_t slider_set_min(widget_t* widget, uint16_t min) {
|
||||
|
@ -194,7 +194,7 @@ ret_t widget_animator_set_reversed(widget_animator_t* animator, bool_t value);
|
||||
/**
|
||||
* @method widget_animator_on
|
||||
* 注册指定事件的处理函数。
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @param {widget_animator_t*} animator 动画对象本身。
|
||||
* @param {event_type_t} type
|
||||
* 事件类型。目前支持:EVT_ANIM_START,EVT_ANIM_STOP,EVT_ANIM_ONCE和EVT_ANIM_END。
|
||||
@ -209,7 +209,7 @@ uint32_t widget_animator_on(widget_animator_t* animator, event_type_t type, even
|
||||
/**
|
||||
* @method widget_animator_off
|
||||
* 注销指定事件的处理函数。
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @annotation ["scriptable:custom"]
|
||||
* @param {widget_animator_t*} animator 动画对象本身。
|
||||
* @param {uint32_t} id widget_animator_on返回的ID。
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
10699
tests/suggest_test.inc
10699
tests/suggest_test.inc
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user