コード例 #1
0
rt_bool_t rtgui_textbox_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
	rtgui_widget_t *widget = RTGUI_WIDGET(object);
	rtgui_textbox_t *box = RTGUI_TEXTBOX(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_textbox_ondraw(box);
		break;

	case RTGUI_EVENT_MOUSE_BUTTON:
#ifndef RTGUI_USING_SMALL_SIZE
		if (widget->on_mouseclick != RT_NULL)
			widget->on_mouseclick(RTGUI_OBJECT(widget), event);
		else
#endif
			rtgui_textbox_onmouse(box, (struct rtgui_event_mouse *)event);
		return RT_TRUE;

	case RTGUI_EVENT_KBD:
#ifndef RTGUI_USING_SMALL_SIZE
		if (widget->on_key != RT_NULL)
			widget->on_key(RTGUI_OBJECT(widget), event);
		else
#endif
			rtgui_textbox_onkey(RTGUI_OBJECT(box), (struct rtgui_event *)event);
		return RT_TRUE;

	default:
		return rtgui_widget_event_handler(RTGUI_OBJECT(widget), event);
	}

	return RT_FALSE;
}
コード例 #2
0
ファイル: textbox.c プロジェクト: bbw2008good/RTGUI
rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
{
	struct rtgui_textbox* box;
	RTGUI_WIDGET_EVENT_HANDLER_PREPARE

	box = RTGUI_TEXTBOX(object);
	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_textbox(box);
		break;

	case RTGUI_EVENT_MOUSE_BUTTON:
		if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;

#ifndef RTGUI_USING_SMALL_SIZE
		if (widget->on_mouseclick != RT_NULL) widget->on_mouseclick(widget, event);
		else 
#endif
			rtgui_textbox_onmouse(box, (struct rtgui_event_mouse*)event);
		return RT_TRUE;

	case RTGUI_EVENT_KBD:
		if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;

#ifndef RTGUI_USING_SMALL_SIZE
		if (widget->on_key != RT_NULL) widget->on_key(widget, event);
		else 
#endif
			rtgui_textbox_onkey(box, (struct rtgui_event_kbd*)event);
		return RT_TRUE;
	}

	return RT_FALSE;
}