diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 16:19:16 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 16:19:16 +0000 |
commit | 0e76c9c9a560fd966c8f06719331179502a350ce (patch) | |
tree | 3e0a5ffea043d7c3af88468180cef1ebad7af336 /gfx | |
parent | 18e093c1e4b8c875ff3f7332479b21f2eb466b95 (diff) | |
download | chromium_src-0e76c9c9a560fd966c8f06719331179502a350ce.zip chromium_src-0e76c9c9a560fd966c8f06719331179502a350ce.tar.gz chromium_src-0e76c9c9a560fd966c8f06719331179502a350ce.tar.bz2 |
Makes menu draw disabled arrow the correct color for classic windows.
BUG=48099
TEST=see bug
Review URL: http://codereview.chromium.org/2835033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/native_theme_win.cc | 40 | ||||
-rw-r--r-- | gfx/native_theme_win.h | 12 |
2 files changed, 37 insertions, 15 deletions
diff --git a/gfx/native_theme_win.cc b/gfx/native_theme_win.cc index 57a5c2f..5123739 100644 --- a/gfx/native_theme_win.cc +++ b/gfx/native_theme_win.cc @@ -177,7 +177,7 @@ HRESULT NativeTheme::PaintMenuArrow(ThemeName theme, int state_id, RECT* rect, MenuArrowDirection arrow_direction, - bool is_highlighted) const { + ControlState control_state) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) { if (arrow_direction == RIGHT_POINTING_ARROW) { @@ -216,7 +216,7 @@ HRESULT NativeTheme::PaintMenuArrow(ThemeName theme, state = DFCS_MENUARROW; else state = DFCS_MENUARROWRIGHT; - return PaintFrameControl(hdc, rect, DFC_MENU, state, is_highlighted); + return PaintFrameControl(hdc, rect, DFC_MENU, state, control_state); } HRESULT NativeTheme::PaintMenuBackground(ThemeName theme, @@ -253,12 +253,12 @@ HRESULT NativeTheme::PaintMenuCheck(ThemeName theme, int part_id, int state_id, RECT* rect, - bool is_highlighted) const { + ControlState control_state) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) { return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); } - return PaintFrameControl(hdc, rect, DFC_MENU, DFCS_MENUCHECK, is_highlighted); + return PaintFrameControl(hdc, rect, DFC_MENU, DFCS_MENUCHECK, control_state); } HRESULT NativeTheme::PaintMenuGutter(HDC hdc, @@ -687,7 +687,7 @@ HRESULT NativeTheme::PaintFrameControl(HDC hdc, RECT* rect, UINT type, UINT state, - bool is_highlighted) const { + ControlState control_state) const { const int width = rect->right - rect->left; const int height = rect->bottom - rect->top; @@ -706,13 +706,29 @@ HRESULT NativeTheme::PaintFrameControl(HDC hdc, // dc's text color for the black bits in the mask, and the dest dc's // background color for the white bits in the mask. DrawFrameControl draws the // check in black, and the background in white. - COLORREF old_bg_color = - SetBkColor(hdc, - GetSysColor(is_highlighted ? COLOR_HIGHLIGHT : COLOR_MENU)); - COLORREF old_text_color = - SetTextColor(hdc, - GetSysColor(is_highlighted ? COLOR_HIGHLIGHTTEXT : - COLOR_MENUTEXT)); + int bg_color_key; + int text_color_key; + switch (control_state) { + case CONTROL_HIGHLIGHTED: + bg_color_key = COLOR_HIGHLIGHT; + text_color_key = COLOR_HIGHLIGHTTEXT; + break; + case CONTROL_NORMAL: + bg_color_key = COLOR_MENU; + text_color_key = COLOR_MENUTEXT; + break; + case CONTROL_DISABLED: + bg_color_key = COLOR_MENU; + text_color_key = COLOR_GRAYTEXT; + break; + default: + NOTREACHED(); + bg_color_key = COLOR_MENU; + text_color_key = COLOR_MENUTEXT; + break; + } + COLORREF old_bg_color = SetBkColor(hdc, GetSysColor(bg_color_key)); + COLORREF old_text_color = SetTextColor(hdc, GetSysColor(text_color_key)); BitBlt(hdc, rect->left, rect->top, width, height, bitmap_dc, 0, 0, SRCCOPY); SetBkColor(hdc, old_bg_color); SetTextColor(hdc, old_text_color); diff --git a/gfx/native_theme_win.h b/gfx/native_theme_win.h index 6df247d..687bb65 100644 --- a/gfx/native_theme_win.h +++ b/gfx/native_theme_win.h @@ -54,6 +54,12 @@ class NativeTheme { RIGHT_POINTING_ARROW }; + enum ControlState { + CONTROL_NORMAL, + CONTROL_HIGHLIGHTED, + CONTROL_DISABLED + }; + typedef HRESULT (WINAPI* DrawThemeBackgroundPtr)(HANDLE theme, HDC hdc, int part_id, @@ -115,7 +121,7 @@ class NativeTheme { int state_id, RECT* rect, MenuArrowDirection arrow_direction, - bool is_highlighted) const; + ControlState state) const; HRESULT PaintMenuBackground(ThemeName theme, HDC hdc, @@ -128,7 +134,7 @@ class NativeTheme { int part_id, int state_id, RECT* rect, - bool is_highlighted) const; + ControlState state) const; HRESULT PaintMenuCheckBackground(ThemeName theme, HDC hdc, @@ -276,7 +282,7 @@ class NativeTheme { RECT* rect, UINT type, UINT state, - bool is_highlighted) const; + ControlState control_state) const; // Returns a handle to the theme data. HANDLE GetThemeHandle(ThemeName theme_name) const; |