rt_bool_t rtgui_scrollbar_event_handler(rtgui_object_t *object, rtgui_event_t *event) { rtgui_widget_t *widget = RTGUI_WIDGET(object); rtgui_scrollbar_t* bar = RTGUI_SCROLLBAR(object); switch(event->type) { case RTGUI_EVENT_PAINT: #ifndef RTGUI_USING_SMALL_SIZE if(widget->on_draw != RT_NULL) widget->on_draw(object, event); else #endif { if(!RTGUI_WIDGET_IS_HIDE(bar)) rtgui_scrollbar_ondraw(bar); } break; case RTGUI_EVENT_MOUSE_BUTTON: if(RTGUI_WIDGET_IS_ENABLE(widget)) { #ifndef RTGUI_USING_SMALL_SIZE if(widget->on_mouseclick != RT_NULL) { widget->on_mouseclick(object, event); } else #endif { _rtgui_scrollbar_on_mouseclick(bar, event); } } break; case RTGUI_EVENT_MOUSE_MOTION: if(RTGUI_WIDGET_IS_ENABLE(widget)) { _rtgui_scrollbar_on_mousemotion(bar, event); } default: return rtgui_widget_event_handler(object, event); } return RT_FALSE; }
rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_widget * widget, struct rtgui_event * event) { struct rtgui_scrollbar* bar = (struct rtgui_scrollbar*)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_theme_draw_scrollbar(bar); } break; case RTGUI_EVENT_MOUSE_BUTTON: if (RTGUI_WIDGET_IS_ENABLE(widget) && !RTGUI_WIDGET_IS_HIDE(widget)) { #ifndef RTGUI_USING_SMALL_SIZE if (widget->on_mouseclick != RT_NULL) { widget->on_mouseclick(widget, event); } else #endif { _rtgui_scrollbar_on_mouseclick(widget, event); } } break; default: break; } return RT_FALSE; }