rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui_event* event) { struct rtgui_combobox *box; RTGUI_WIDGET_EVENT_HANDLER_PREPARE box = RTGUI_COMBOBOX(object); switch (event->type) { case RTGUI_EVENT_PAINT: #ifndef RTGUI_USING_SMALL_SIZE if (widget->on_draw != RT_NULL) widget->on_draw(RTGUI_OBJECT(widget), event); else #endif rtgui_combobox_ondraw(box); break; case RTGUI_EVENT_MOUSE_BUTTON: return rtgui_combobox_onmouse_button(box, (struct rtgui_event_mouse*)event); case RTGUI_EVENT_FOCUSED: { /* item focused */ struct rtgui_event_focused* focused; focused = (struct rtgui_event_focused*) event; if (focused->widget != RT_NULL) { /* hide pull down window */ rtgui_win_hiden(RTGUI_WIN(box->pd_win)); rtgui_combobox_ondraw(box); } } break; default: return rtgui_widget_event_handler(object, event); } return RT_FALSE; }
rt_bool_t rtgui_combobox_event_handler(struct rtgui_widget* widget, struct rtgui_event* event) { struct rtgui_combobox* box = (struct rtgui_combobox*)widget; switch (event->type) { case RTGUI_EVENT_PAINT: #ifndef RTGUI_USING_SMALL_SIZE if (widget->on_draw != RT_NULL) widget->on_draw(widget, event); else #endif rtgui_combobox_ondraw(box); break; case RTGUI_EVENT_MOUSE_BUTTON: return rtgui_combobox_onmouse_button(box, (struct rtgui_event_mouse*)event); case RTGUI_EVENT_FOCUSED: { /* item focused */ struct rtgui_item* item; struct rtgui_event_focused* focused; focused = (struct rtgui_event_focused*) event; item = (struct rtgui_item*) (focused->widget); if (item != RT_NULL) { /* hide pull down window */ rtgui_win_hiden(RTGUI_WIN(box->pd_win)); rtgui_combobox_ondraw(box); } } break; } return RT_FALSE; }