improve stm32

This commit is contained in:
xianjimli 2018-03-17 07:40:02 +08:00
parent 727a571255
commit 37d844c918
2 changed files with 9 additions and 16 deletions

View File

@ -39,19 +39,19 @@ static ret_t on_show_dialog(void* ctx, event_t* e) {
widget_t* ok = NULL;
widget_t* label = NULL;
widget_t* cancel = NULL;
widget_t* win = dialog_create(NULL, 0, 0, 300, 240);
widget_t* win = dialog_create(NULL, 0, 0, 240, 160);
dialog_t* dialog = DIALOG(win);
widget_set_text(win, L"Dialog");
dialog_set_icon(win, "info");
ok = button_create(dialog->client, 60, 160, 80, 30);
ok = button_create(dialog->client, 20, 80, 80, 30);
widget_set_text(ok, L"Go");
cancel = button_create(dialog->client, 200, 160, 80, 30);
cancel = button_create(dialog->client, 140, 80, 80, 30);
widget_set_text(cancel, L"Cancel");
label = label_create(dialog->client, 10, 10, 200, 30);
label = label_create(dialog->client, 10, 30, 200, 30);
widget_set_text(label, L"Are you ready!");
widget_on(ok, EVT_CLICK, on_ok, dialog);

View File

@ -1,4 +1,4 @@
/**
/**
* File: window_manager.c
* Author: Li XianJing <xianjimli@hotmail.com>
* Brief: window manager
@ -54,7 +54,9 @@ ret_t window_manager_remove_child(widget_t* wm, widget_t* window) {
if (ret == RET_OK) {
widget_t* top = window_manager_get_top_window(wm);
if (top) {
widget_invalidate(top, NULL);
rect_t r;
rect_init(r, window->x, window->y, window->w, window->h);
widget_invalidate(top, &r);
}
}
@ -173,15 +175,7 @@ ret_t window_manager_on_paint_children(widget_t* widget, canvas_t* c) {
if (widget->children != NULL && widget->children->size > 0) {
nr = widget->children->size;
#ifdef FAST_MODE
for (i = nr - 1; i >= 0; i--) {
widget_t* iter = (widget_t*)(widget->children->elms[i]);
if (iter->visible) {
widget_paint(iter, c);
break;
}
}
#else
for (i = nr - 1; i >= 0; i--) {
widget_t* iter = (widget_t*)(widget->children->elms[i]);
if (iter->type == WIDGET_NORMAL_WINDOW) {
@ -199,7 +193,6 @@ ret_t window_manager_on_paint_children(widget_t* widget, canvas_t* c) {
widget_paint(iter, c);
}
}
#endif /*FAST_MODE*/
}
return RET_OK;