diff options
| author | bernard <[email protected]> | 2017-10-10 00:17:58 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-10-10 00:17:58 +0800 |
| commit | 01108b525294e1019fcab893dc991e8e17d1fa86 (patch) | |
| tree | f52214cb4f76cffaeb8f4f5cf3c22f5c90604684 /components/gui/src/container.c | |
| parent | f8a1bf6fd809be4ce53d17bde1a367aa6bae8187 (diff) | |
[GUI] Update GUI engine code and add Kconfig file.
Diffstat (limited to 'components/gui/src/container.c')
| -rw-r--r-- | components/gui/src/container.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/components/gui/src/container.c b/components/gui/src/container.c index d9f1e79719..5d1c2009ca 100644 --- a/components/gui/src/container.c +++ b/components/gui/src/container.c @@ -1,11 +1,21 @@ /* * File : container.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * This file is part of RT-Thread GUI Engine + * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes @@ -49,15 +59,41 @@ rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_eve { /* handle in child widget */ struct rtgui_list_node *node; + rtgui_event_t _event, save_event = *event; + rtgui_widget_t *widget = (rtgui_widget_t *)container; rtgui_list_foreach(node, &(container->children)) { struct rtgui_widget *w; w = rtgui_list_entry(node, struct rtgui_widget, sibling); + _event = save_event; + + if (RTGUI_EVENT_PAINT & _event.type) + { + if (widget->extent.x1 > w->extent.x2) + { + _event.type &= !RTGUI_EVENT_PAINT; + } + else if (widget->extent.x2 < w->extent.x1) + { + _event.type &= !RTGUI_EVENT_PAINT; + } + else if (widget->extent.y1 > w->extent.y2) + { + _event.type &= !RTGUI_EVENT_PAINT; + } + else if (widget->extent.y2 < w->extent.y1) + { + _event.type &= !RTGUI_EVENT_PAINT; + } + } + if (RTGUI_OBJECT(w)->event_handler && - RTGUI_OBJECT(w)->event_handler(RTGUI_OBJECT(w), event) == RT_TRUE) + RTGUI_OBJECT(w)->event_handler(RTGUI_OBJECT(w), &_event) == RT_TRUE) + { return RT_TRUE; + } } return RT_FALSE; @@ -140,7 +176,7 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object *object, struct rtgu /* paint on each child */ rtgui_container_dispatch_event(container, event); - rtgui_dc_end_drawing(dc); + rtgui_dc_end_drawing(dc, 1); } break; @@ -158,8 +194,8 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object *object, struct rtgu rtgui_container_dispatch_event(container, event); break; case RTGUI_EVENT_HIDE: - rtgui_widget_onhide(RTGUI_OBJECT(container), event); rtgui_container_dispatch_event(container, event); + rtgui_widget_onhide(RTGUI_OBJECT(container), event); break; case RTGUI_EVENT_COMMAND: rtgui_container_dispatch_event(container, event); |
