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 /views/controls | |
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 'views/controls')
-rw-r--r-- | views/controls/menu/menu_item_view.h | 6 | ||||
-rw-r--r-- | views/controls/menu/menu_item_view_win.cc | 19 |
2 files changed, 19 insertions, 6 deletions
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index baa3461..e6ed28b 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -12,6 +12,10 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "views/view.h" +#if defined(OS_WIN) +#include "gfx/native_theme_win.h" +#endif + namespace views { class MenuButton; @@ -304,7 +308,7 @@ class MenuItemView : public View { // native theme drawing routines. void PaintCheck(HDC dc, int part_id, - bool render_selection, + gfx::NativeTheme::ControlState control_state, int icon_width, int icon_height); #endif diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc index 30a8982e..049a443 100644 --- a/views/controls/menu/menu_item_view_win.cc +++ b/views/controls/menu/menu_item_view_win.cc @@ -35,6 +35,14 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { int state = render_selection ? MPI_HOT : (IsEnabled() ? MPI_NORMAL : MPI_DISABLED); HDC dc = canvas->BeginPlatformPaint(); + NativeTheme::ControlState control_state; + + if (!IsEnabled()) { + control_state = NativeTheme::CONTROL_DISABLED; + } else { + control_state = render_selection ? NativeTheme::CONTROL_HIGHLIGHTED : + NativeTheme::CONTROL_NORMAL; + } // The gutter is rendered before the background. if (config.render_gutter && !for_drag) { @@ -63,10 +71,10 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) { PaintCheck(dc, IsEnabled() ? MC_CHECKMARKNORMAL : MC_CHECKMARKDISABLED, - render_selection, config.check_height, config.check_width); + control_state, config.check_height, config.check_width); } else if (type_ == RADIO && GetDelegate()->IsItemChecked(GetCommand())) { PaintCheck(dc, IsEnabled() ? MC_BULLETNORMAL : MC_BULLETDISABLED, - render_selection, config.radio_height, config.radio_width); + control_state, config.radio_height, config.radio_width); } // Render the foreground. @@ -129,13 +137,14 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { RECT arrow_rect = arrow_bounds.ToRECT(); NativeTheme::instance()->PaintMenuArrow( NativeTheme::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect, - arrow_direction, render_selection); + arrow_direction, control_state); } canvas->EndPlatformPaint(); } + void MenuItemView::PaintCheck(HDC dc, int state_id, - bool render_selection, + NativeTheme::ControlState control_state, int icon_width, int icon_height) { int top_margin = GetTopMargin(); @@ -157,7 +166,7 @@ void MenuItemView::PaintCheck(HDC dc, RECT icon_rect = icon_bounds.ToRECT(); NativeTheme::instance()->PaintMenuCheck( NativeTheme::MENU, dc, MENU_POPUPCHECK, state_id, &icon_rect, - render_selection); + control_state); } } // namespace views |