Browse Source

remove NOT small size definition.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1311 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 14 years ago
parent
commit
71421510fc

+ 0 - 15
components/rtgui/common/rtgui_system.c

@@ -140,21 +140,6 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
 
 
 			if(info->wid != RT_NULL)
 			if(info->wid != RT_NULL)
 				rt_kprintf("win: %s", info->wid->title);
 				rt_kprintf("win: %s", info->wid->title);
-#ifdef RTGUI_USING_SMALL_SIZE
-			rt_kprintf(" clip no. %d", info->num_rect);
-#else
-			{
-				rtgui_rect_t *rect;
-				rt_uint32_t index;
-
-				rect = (rtgui_rect_t*)(info + 1);
-				for (index = 0; index < info->num_rect; index ++)
-				{
-					rt_kprintf(" (x1:%d, y1:%d, x2:%d, y2:%d)", rect->x1, rect->y1, rect->x2, rect->y2);
-					rect ++;
-				}
-			}
-#endif
 		}
 		}
 		break;
 		break;
 
 

+ 5 - 21
components/rtgui/widgets/container.c

@@ -84,13 +84,18 @@ rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, str
 {
 {
 	/* handle in child widget */
 	/* handle in child widget */
 	struct rtgui_list_node* node;
 	struct rtgui_list_node* node;
+	rtgui_widget_t *focus;
 
 
+	/* get focus widget on toplevel */
+	focus = RTGUI_CONTAINER(RTGUI_WIDGET(container)->toplevel)->focused;
 	rtgui_list_foreach(node, &(container->children))
 	rtgui_list_foreach(node, &(container->children))
 	{
 	{
 		struct rtgui_widget* w;
 		struct rtgui_widget* w;
 		w = rtgui_list_entry(node, struct rtgui_widget, sibling);
 		w = rtgui_list_entry(node, struct rtgui_widget, sibling);
 		if (rtgui_rect_contains_point(&(w->extent), event->x, event->y) == RT_EOK)
 		if (rtgui_rect_contains_point(&(w->extent), event->x, event->y) == RT_EOK)
 		{
 		{
+			if ((focus != w) && RTGUI_WIDGET_IS_FOCUSABLE(w))
+				rtgui_widget_focus(w);
 			if (w->event_handler(w, (rtgui_event_t*)event) == RT_TRUE) return RT_TRUE;
 			if (w->event_handler(w, (rtgui_event_t*)event) == RT_TRUE) return RT_TRUE;
 		}
 		}
 	}
 	}
@@ -105,24 +110,10 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
 	switch (event->type)
 	switch (event->type)
 	{
 	{
 	case RTGUI_EVENT_PAINT:
 	case RTGUI_EVENT_PAINT:
-#ifndef RTGUI_USING_SMALL_SIZE	
-		if (widget->on_draw != RT_NULL)
-		{
-			return widget->on_draw(widget, event);
-		}
-#endif
-
 		rtgui_container_dispatch_event(container, event);
 		rtgui_container_dispatch_event(container, event);
 		break;
 		break;
 
 
 	case RTGUI_EVENT_KBD:
 	case RTGUI_EVENT_KBD:
-#ifndef RTGUI_USING_SMALL_SIZE
-		if (widget->on_key != RT_NULL)
-		{
-			return widget->on_key(widget, event);
-		}
-		else
-#endif
 		{
 		{
 			/* let parent to handle keyboard event */
 			/* let parent to handle keyboard event */
 			if (widget->parent != RT_NULL && widget->parent != widget->toplevel)
 			if (widget->parent != RT_NULL && widget->parent != widget->toplevel)
@@ -137,13 +128,6 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
 		if (rtgui_container_dispatch_mouse_event(container,
 		if (rtgui_container_dispatch_mouse_event(container,
 			(struct rtgui_event_mouse*)event) == RT_FALSE)
 			(struct rtgui_event_mouse*)event) == RT_FALSE)
 		{
 		{
-#ifndef RTGUI_USING_SMALL_SIZE
-			/* handle event in current widget */
-			if (widget->on_mouseclick != RT_NULL)
-			{
-				return widget->on_mouseclick(widget, event);
-			}
-#endif
 		}
 		}
 		else return RT_TRUE;
 		else return RT_TRUE;
 		break;
 		break;

+ 0 - 4
components/rtgui/widgets/view.c

@@ -71,10 +71,6 @@ rt_bool_t rtgui_view_event_handler(struct rtgui_widget* widget, struct rtgui_eve
 	switch (event->type)
 	switch (event->type)
 	{
 	{
 	case RTGUI_EVENT_PAINT:
 	case RTGUI_EVENT_PAINT:
-#ifndef RTGUI_USING_SMALL_SIZE		
-		if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
-		else
-#endif
 		{
 		{
 			struct rtgui_dc* dc;
 			struct rtgui_dc* dc;
 			struct rtgui_rect rect;
 			struct rtgui_rect rect;