2018-06-11 17:36:54 +08:00
|
|
|
#include "base/timer.h"
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_timer(const timer_info_t* timer) {
|
2018-03-10 22:01:10 +08:00
|
|
|
widget_t* progress_bar = (widget_t*)timer->ctx;
|
2019-09-27 12:28:15 +08:00
|
|
|
float_t value = ((int)(PROGRESS_BAR(progress_bar)->value + 5)) % 100;
|
2018-03-10 22:01:10 +08:00
|
|
|
progress_bar_set_value(progress_bar, value);
|
|
|
|
|
|
|
|
return RET_REPEAT;
|
|
|
|
}
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_inc(void* ctx, event_t* e) {
|
2018-03-10 22:01:10 +08:00
|
|
|
widget_t* progress_bar = (widget_t*)ctx;
|
2019-09-27 12:28:15 +08:00
|
|
|
float_t value = ((int)(PROGRESS_BAR(progress_bar)->value + 10)) % 100;
|
2018-03-10 22:01:10 +08:00
|
|
|
progress_bar_set_value(progress_bar, value);
|
|
|
|
(void)e;
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_dec(void* ctx, event_t* e) {
|
2018-03-10 22:01:10 +08:00
|
|
|
widget_t* progress_bar = (widget_t*)ctx;
|
2019-09-27 12:28:15 +08:00
|
|
|
float_t value = ((int)(PROGRESS_BAR(progress_bar)->value + 90)) % 100;
|
2018-03-10 22:01:10 +08:00
|
|
|
progress_bar_set_value(progress_bar, value);
|
|
|
|
(void)e;
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_ok(void* ctx, event_t* e) {
|
2018-03-10 22:01:10 +08:00
|
|
|
widget_t* dialog = (widget_t*)ctx;
|
|
|
|
|
|
|
|
dialog_quit(dialog, 0);
|
|
|
|
(void)e;
|
2018-10-04 11:14:59 +08:00
|
|
|
tk_mem_dump();
|
2018-03-10 22:01:10 +08:00
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_close(void* ctx, event_t* e) {
|
2018-04-21 07:43:02 +08:00
|
|
|
widget_t* win = (widget_t*)ctx;
|
|
|
|
(void)e;
|
|
|
|
return window_close(win);
|
|
|
|
}
|
|
|
|
|
2019-07-05 07:13:23 +08:00
|
|
|
static inline ret_t on_cancel(void* ctx, event_t* e) {
|
2018-03-10 22:01:10 +08:00
|
|
|
widget_t* dialog = (widget_t*)ctx;
|
|
|
|
|
|
|
|
dialog_quit(dialog, 1);
|
|
|
|
(void)e;
|
2018-10-04 11:14:59 +08:00
|
|
|
tk_mem_dump();
|
2018-03-10 22:01:10 +08:00
|
|
|
return RET_OK;
|
|
|
|
}
|