diff options
| author | bernard.xiong <[email protected]> | 2010-02-03 10:28:11 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-02-03 10:28:11 +0000 |
| commit | b22642e934fd3d6efe2ace1498da5e478756c7bb (patch) | |
| tree | 85f0fc161145420c248849759f9a257af41c3849 /rtgui/common/rtgui_theme.c | |
| parent | 4f949216e353bf4f1ce3cafaf144d0d36837ac32 (diff) | |
add focus option to checkbox.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@368 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui/common/rtgui_theme.c')
| -rw-r--r-- | rtgui/common/rtgui_theme.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c index 8ac4fce891..e2c0dd95ce 100644 --- a/rtgui/common/rtgui_theme.c +++ b/rtgui/common/rtgui_theme.c @@ -252,6 +252,16 @@ void rtgui_theme_draw_button(rtgui_button_t* btn) } } + if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(btn))) + { + /* re-set foreground and get default rect */ + rtgui_widget_get_rect(RTGUI_WIDGET(btn), &rect); + rtgui_rect_inflate(&rect, -2); + + RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = black; + rtgui_dc_draw_focus_rect(dc, &rect); + } + /* set forecolor */ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)) = bc; RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = fc; @@ -412,8 +422,10 @@ void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox) /* fill rect */ rtgui_dc_fill_rect(dc, &rect); - if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(checkbox)) == RT_TRUE) + if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(checkbox))) { + RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = black; + /* draw focused border */ rtgui_rect_inflate(&rect, -1); rtgui_dc_draw_focus_rect(dc, &rect); @@ -427,6 +439,7 @@ void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox) box_rect.x2 = CHECK_BOX_W; box_rect.y2 = CHECK_BOX_H; rtgui_rect_moveto_align(&rect, &box_rect, RTGUI_ALIGN_CENTER_VERTICAL); + box_rect.x1 += 2; box_rect.x2 += 2; rtgui_dc_draw_border(dc, &box_rect, RTGUI_BORDER_BOX); rtgui_rect_inflate(&box_rect, -1); |
