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
This commit is contained in:
bernard.xiong 2010-01-25 23:38:47 +00:00
parent 9fb4908710
commit 0c817b1d16
3 changed files with 9 additions and 10 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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);
}
}
}