From 0c817b1d16c2edb745704955005e71448caded5e Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Mon, 25 Jan 2010 23:38:47 +0000 Subject: [PATCH] move the onbutton call back to the end of event handler in button widget. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@337 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- rtgui/common/rtgui_theme.c | 5 ++--- rtgui/include/rtgui/rtgui_config.h | 2 +- rtgui/widgets/button.c | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c index 15f9b301a3..28d5215573 100644 --- a/rtgui/common/rtgui_theme.c +++ b/rtgui/common/rtgui_theme.c @@ -282,10 +282,9 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win) { RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(win->title)) = RTGUI_RGB(212, 208, 200); } - // rtgui_dc_fill_rect(dc, &rect); rect.x1 += 4; - rect.y1 += 2; + rect.y1 += 2; rect.y2 = rect.y1 + WINTITLE_CB_HEIGHT; rtgui_dc_draw_text(dc, rtgui_wintitle_get_title(win->title), &rect); if (win->flag & WINTITLE_CLOSEBOX) @@ -321,7 +320,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn) /* get widget rect */ rtgui_widget_get_rect(RTGUI_WIDGET(btn), &rect); - /* get forecolor */ + /* get foreground color */ fc = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)); /* fill button rect with background color */ diff --git a/rtgui/include/rtgui/rtgui_config.h b/rtgui/include/rtgui/rtgui_config.h index ea990c2486..65e6c40b90 100644 --- a/rtgui/include/rtgui/rtgui_config.h +++ b/rtgui/include/rtgui/rtgui_config.h @@ -18,7 +18,7 @@ /* RTGUI options */ /* name length of RTGUI object */ -#define RTGUI_NAME_MAX 32 +#define RTGUI_NAME_MAX 16 /* #define RTGUI_USING_MOUSE_CURSOR */ diff --git a/rtgui/widgets/button.c b/rtgui/widgets/button.c index a68e0771e1..45db6239fb 100644 --- a/rtgui/widgets/button.c +++ b/rtgui/widgets/button.c @@ -165,18 +165,18 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_widget* widget, struct rtgui_e #endif rtgui_theme_draw_button(btn); - if (!(btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL)) - { - /* call on button handler */ - btn->on_button(widget, event); - } - #ifndef RTGUI_USING_SMALL_SIZE /* invokes call back */ if (widget->on_mouseclick != RT_NULL && emouse->button & RTGUI_MOUSE_BUTTON_UP) return widget->on_mouseclick(widget, event); #endif + + if (!(btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL)) + { + /* call on button handler */ + btn->on_button(widget, event); + } } }