diff options
author | yefim@chromium.org <yefim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 06:55:58 +0000 |
---|---|---|
committer | yefim@chromium.org <yefim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 06:55:58 +0000 |
commit | cec2dd0b2d786a93d185a606e899fadae188d0ae (patch) | |
tree | 2c924796b0db3ab5af5b636c3c2fd88c4db26f9b /ui/native_theme | |
parent | eb72b66c329a1d94320678bcd28db8041f006e5f (diff) | |
download | chromium_src-cec2dd0b2d786a93d185a606e899fadae188d0ae.zip chromium_src-cec2dd0b2d786a93d185a606e899fadae188d0ae.tar.gz chromium_src-cec2dd0b2d786a93d185a606e899fadae188d0ae.tar.bz2 |
Added new menu check and radio button images and related code (images in a separate CL, 11569043).
BUG=157692
Review URL: https://chromiumcodereview.appspot.com/11578039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/native_theme')
-rw-r--r-- | ui/native_theme/common_theme.cc | 22 | ||||
-rw-r--r-- | ui/native_theme/common_theme.h | 21 | ||||
-rw-r--r-- | ui/native_theme/native_theme_win.cc | 5 |
3 files changed, 40 insertions, 8 deletions
diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc index ba9fe70..a4496a2 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc @@ -5,7 +5,10 @@ #include "ui/native_theme/common_theme.h" #include "base/logging.h" +#include "grit/ui_resources.h" #include "third_party/skia/include/core/SkCanvas.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/rect.h" #include "ui/gfx/skia_util.h" #include "ui/views/controls/menu/menu_config.h" @@ -53,6 +56,25 @@ bool CommonThemeGetSystemColor(NativeTheme::ColorId color_id, SkColor* color) { return true; } +gfx::Size CommonThemeGetPartSize(NativeTheme::Part part, + NativeTheme::State state, + const NativeTheme::ExtraParams& extra) { + gfx::Size size; + switch (part) { + case NativeTheme::kMenuCheck: { + const gfx::ImageSkia* check = + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_MENU_CHECK_CHECKED).ToImageSkia(); + size.SetSize(check->width(), check->height()); + break; + } + default: + break; + } + + return size; +} + void CommonThemePaintMenuSeparator( SkCanvas* canvas, const gfx::Rect& rect, diff --git a/ui/native_theme/common_theme.h b/ui/native_theme/common_theme.h index a3c00b9..c91f489 100644 --- a/ui/native_theme/common_theme.h +++ b/ui/native_theme/common_theme.h @@ -8,9 +8,6 @@ #include "ui/native_theme/native_theme.h" class SkCanvas; -namespace views { -struct MenuConfig; -} namespace ui { @@ -18,7 +15,13 @@ namespace ui { // Returns true and |color| if |color_id| is found, or false otherwise. bool NATIVE_THEME_EXPORT CommonThemeGetSystemColor( - NativeTheme::ColorId color_id, SkColor* color); + NativeTheme::ColorId color_id, + SkColor* color); + +gfx::Size NATIVE_THEME_EXPORT CommonThemeGetPartSize( + NativeTheme::Part part, + NativeTheme::State state, + const NativeTheme::ExtraParams& extra); void NATIVE_THEME_EXPORT CommonThemePaintMenuSeparator( SkCanvas* canvas, @@ -26,13 +29,15 @@ void NATIVE_THEME_EXPORT CommonThemePaintMenuSeparator( const NativeTheme::MenuSeparatorExtraParams& extra); void NATIVE_THEME_EXPORT CommonThemePaintMenuGutter(SkCanvas* canvas, - const gfx::Rect& rect); + const gfx::Rect& rect); void NATIVE_THEME_EXPORT CommonThemePaintMenuBackground(SkCanvas* canvas, - const gfx::Rect& rect); + const gfx::Rect& rect); -void NATIVE_THEME_EXPORT CommonThemePaintMenuItemBackground(SkCanvas* canvas, - NativeTheme::State state, const gfx::Rect& rect); +void NATIVE_THEME_EXPORT CommonThemePaintMenuItemBackground( + SkCanvas* canvas, + NativeTheme::State state, + const gfx::Rect& rect); } // namespace ui diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc index fbee205..a48fc05 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc @@ -209,6 +209,11 @@ NativeThemeWin* NativeThemeWin::instance() { gfx::Size NativeThemeWin::GetPartSize(Part part, State state, const ExtraParams& extra) const { + if (IsNewMenuStyleEnabled()) { + gfx::Size size = CommonThemeGetPartSize(part, state, extra); + if (!size.IsEmpty()) + return size; + } SIZE size; int part_id = GetWindowsPart(part, state, extra); int state_id = GetWindowsState(part, state, extra); |