diff options
| author | [email protected] <[email protected]> | 2011-06-11 06:18:46 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-06-11 06:18:46 +0000 |
| commit | 14c2f8c0399d2041d75fac43c42d87bf6a2e3b93 (patch) | |
| tree | a7a5de9eb33296b476eeb813be8df28baf4384ef /components/rtgui/common/rtgui_theme.c | |
| parent | e8d7220682b061846844f98eb0f8d891c89c0e37 (diff) | |
add rtgui_listbox_set_current_item function; fix draw rect issue on the border; fix progress bar drawing issue; fix on_item issue in menu if the sub_menu is shown;
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1488 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common/rtgui_theme.c')
| -rw-r--r-- | components/rtgui/common/rtgui_theme.c | 61 |
1 files changed, 6 insertions, 55 deletions
diff --git a/components/rtgui/common/rtgui_theme.c b/components/rtgui/common/rtgui_theme.c index 5e337482a7..b9e52b3a99 100644 --- a/components/rtgui/common/rtgui_theme.c +++ b/components/rtgui/common/rtgui_theme.c @@ -174,36 +174,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn) bc = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)); fc = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)); - 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); - rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2); - - RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(128, 128, 128); - rtgui_dc_draw_hline(dc, rect.x1, rect.x2 - 1, rect.y1 + 1); - rtgui_dc_draw_vline(dc, rect.x1 + 1, rect.y1 + 1, rect.y2 - 2); - - RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(255, 255, 255); - rtgui_dc_draw_hline(dc, rect.x1, rect.x2 + 1, rect.y2 - 1); - rtgui_dc_draw_vline(dc, rect.x2 - 1, rect.y1, rect.y2); - - if (btn->pressed_image != RT_NULL) - { - rtgui_rect_t image_rect; - image_rect.x1 = 0; image_rect.y1 = 0; - image_rect.x2 = btn->unpressed_image->w; - image_rect.y2 = btn->unpressed_image->h; - rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL); - - rtgui_image_blit(btn->pressed_image, dc, &image_rect); - } - } - else if (btn->flag & RTGUI_BUTTON_FLAG_PRESS) + if (btn->flag & RTGUI_BUTTON_FLAG_PRESS) { if (btn->pressed_image != RT_NULL) { @@ -218,16 +189,8 @@ 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); - - RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(128, 128, 128); - rect.x1 += 1; rect.y1 += 1; rect.x2 -= 1; rect.y2 -= 1; - rtgui_dc_draw_rect(dc, &rect); + rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SUNKEN); } } else @@ -246,19 +209,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn) { /* 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); - rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2); - - RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(0, 0, 0); - rtgui_dc_draw_hline(dc, rect.x1, rect.x2 + 1, rect.y2); - rtgui_dc_draw_vline(dc, rect.x2, rect.y1, rect.y2); - - RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(128, 128, 128); - rtgui_dc_draw_hline(dc, rect.x1 + 1, rect.x2, rect.y2 - 1); - rtgui_dc_draw_vline(dc, rect.x2 - 1, rect.y1 + 1, rect.y2 - 1); + rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_RAISE); } } @@ -930,10 +881,9 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar) rtgui_widget_get_rect(&(bar->parent), &rect); /* fill button rect with background color */ - bar->parent.gc.background = RTGUI_RGB(212, 208, 200); + RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(bar)) = RTGUI_RGB(212, 208, 200); /* draw border */ - rect.x2 --; rect.y2 --; rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SUNKEN); /* Nothing to draw */ @@ -946,7 +896,8 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar) rect.x2 ++; rect.y2 ++; left = max - pos; rtgui_rect_inflate(&rect, -2); - bar->parent.gc.background = RTGUI_RGB(0, 0, 255); + RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(bar)) = RTGUI_RGB(0, 0, 255); + rect.y2 --; rect.x2 --; if (bar->orient == RTGUI_VERTICAL) { |
