summaryrefslogtreecommitdiff
path: root/rtgui/common/rtgui_theme.c
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-01-29 10:08:27 +0000
committerbernard.xiong <[email protected]>2010-01-29 10:08:27 +0000
commitffffd2edcd561ebb7b3abb987c1c1b049fdceb0a (patch)
tree88be9937d65a19e9c2921a52e7f364495acdb3d8 /rtgui/common/rtgui_theme.c
parentb7e87ee78bb3f3910ce038a1b882c36e051d61b9 (diff)
add draw byte routine.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@348 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui/common/rtgui_theme.c')
-rw-r--r--rtgui/common/rtgui_theme.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c
index 75b084998e..36c21cbd56 100644
--- a/rtgui/common/rtgui_theme.c
+++ b/rtgui/common/rtgui_theme.c
@@ -312,7 +312,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
/* draw button */
struct rtgui_dc* dc;
struct rtgui_rect rect;
- rtgui_color_t fc;
+ rtgui_color_t bc, fc;
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(btn));
@@ -322,13 +322,14 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
rtgui_widget_get_rect(RTGUI_WIDGET(btn), &rect);
/* get foreground color */
+ bc = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn));
fc = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn));
- /* fill button rect with background color */
- rtgui_dc_fill_rect(dc, &rect);
-
if (btn->flag & RTGUI_BUTTON_TYPE_PUSH && btn->flag & RTGUI_BUTTON_FLAG_PRESS)
{
+ /* fill button rect with background color */
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(64, 64, 64);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
@@ -367,6 +368,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
else
{
+ /* fill button rect with background color */
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(0xff, 0xff, 0xff);
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(0, 0, 0);
rtgui_dc_draw_rect(dc, &rect);
@@ -390,6 +395,9 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
else
{
+ /* fill button rect with background color */
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(255, 255, 255);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
@@ -406,6 +414,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
/* set forecolor */
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)) = bc;
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = fc;
if (btn->pressed_image == RT_NULL)