summaryrefslogtreecommitdiff
path: root/rtgui/widgets/widget.c
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-01-08 00:02:24 +0000
committerbernard.xiong <[email protected]>2010-01-08 00:02:24 +0000
commit5939b5f6ac3e2afccece4ec5649598d23ae6d98e (patch)
treebe1470182a389b37f325f786031dd72aeac8efb5 /rtgui/widgets/widget.c
parente0f0d6da6a143b263790c527bfdb2c218984b23c (diff)
add more widgets.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@291 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui/widgets/widget.c')
-rw-r--r--rtgui/widgets/widget.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/rtgui/widgets/widget.c b/rtgui/widgets/widget.c
index 7b0a606e27..dbdf4f22c3 100644
--- a/rtgui/widgets/widget.c
+++ b/rtgui/widgets/widget.c
@@ -293,7 +293,7 @@ void rtgui_widget_unfocus(rtgui_widget_t *widget)
widget->flag &= ~RTGUI_WIDGET_FLAG_FOCUS;
- if (!widget->toplevel || !RTGUI_WIDGET_IS_FOCUS(widget))
+ if (!widget->toplevel || !RTGUI_WIDGET_IS_FOCUSED(widget))
return;
#ifndef RTGUI_USING_SMALL_SIZE
@@ -480,6 +480,38 @@ void rtgui_widget_hide(rtgui_widget_t* widget)
rtgui_widget_update_clip(widget->parent);
}
+rtgui_color_t rtgui_widget_get_parent_foreground(rtgui_widget_t* widget)
+{
+ rtgui_widget_t* parent;
+
+ /* get parent widget */
+ parent = widget->parent;
+ while (parent->parent != RT_NULL && (RTGUI_WIDGET_FLAG(parent) & RTGUI_WIDGET_FLAG_TRANSPARENT))
+ parent = parent->parent;
+
+ /* get parent's color */
+ if (parent != RT_NULL)
+ return RTGUI_WIDGET_FOREGROUND(parent);
+
+ return RTGUI_WIDGET_FOREGROUND(widget);
+}
+
+rtgui_color_t rtgui_widget_get_parent_background(rtgui_widget_t* widget)
+{
+ rtgui_widget_t* parent;
+
+ /* get parent widget */
+ parent = widget->parent;
+ while (parent->parent != RT_NULL && (RTGUI_WIDGET_FLAG(parent) & RTGUI_WIDGET_FLAG_TRANSPARENT))
+ parent = parent->parent;
+
+ /* get parent's color */
+ if (parent != RT_NULL)
+ return RTGUI_WIDGET_BACKGROUND(parent);
+
+ return RTGUI_WIDGET_BACKGROUND(widget);
+}
+
void rtgui_widget_update(rtgui_widget_t* widget)
{
struct rtgui_event_paint paint;