summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 17:19:54 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 17:19:54 +0000
commite57bfaceecec2261a19970fe81b7a45663637dc7 (patch)
tree25e3b3113305d0eff3cd9364ab4275d921527b87 /views
parent219b4249b63fcb6e33f7c7beb2639c4f0b7ae36c (diff)
downloadchromium_src-e57bfaceecec2261a19970fe81b7a45663637dc7.zip
chromium_src-e57bfaceecec2261a19970fe81b7a45663637dc7.tar.gz
chromium_src-e57bfaceecec2261a19970fe81b7a45663637dc7.tar.bz2
Makes cut/copy/paste buttons centered with respect to the
separator. This proves a bit tricky as normally separators are closer to the bottom of the space provided. I've centered them now so that the buttons look centered too. BUG=50099 TEST=see bug Review URL: http://codereview.chromium.org/3072015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_config_win.cc3
-rw-r--r--views/controls/menu/menu_separator_win.cc15
2 files changed, 11 insertions, 7 deletions
diff --git a/views/controls/menu/menu_config_win.cc b/views/controls/menu/menu_config_win.cc
index 6f1e8fd4a..5adf9eb 100644
--- a/views/controls/menu/menu_config_win.cc
+++ b/views/controls/menu/menu_config_win.cc
@@ -85,7 +85,8 @@ MenuConfig* MenuConfig::Create() {
TS_TRUE, &separator_size) == S_OK) {
config->separator_height = separator_size.cy;
} else {
- config->separator_height = GetSystemMetrics(SM_CYMENU) / 2;
+ // -1 makes separator centered.
+ config->separator_height = GetSystemMetrics(SM_CYMENU) / 2 - 1;
}
ReleaseDC(NULL, dc);
diff --git a/views/controls/menu/menu_separator_win.cc b/views/controls/menu/menu_separator_win.cc
index 78331bb..3c74192 100644
--- a/views/controls/menu/menu_separator_win.cc
+++ b/views/controls/menu/menu_separator_win.cc
@@ -19,8 +19,11 @@ void MenuSeparator::Paint(gfx::Canvas* canvas) {
const MenuConfig& config = MenuConfig::instance();
// The gutter is rendered before the background.
int start_x = 0;
- int start_y = height() / 3;
+ int start_y = height() / 3 + 1; // +1 makes separator centered.
HDC dc = canvas->BeginPlatformPaint();
+ const gfx::NativeTheme* theme = gfx::NativeTheme::instance();
+ // Delta is needed for non-classic to move separator up slightly.
+ int delta = theme->IsClassicTheme(gfx::NativeTheme::MENU) ? 0 : 1;
if (config.render_gutter) {
// If render_gutter is true, we're on Vista and need to render the
// gutter, then indent the separator from the gutter.
@@ -28,13 +31,13 @@ void MenuSeparator::Paint(gfx::Canvas* canvas) {
config.gutter_to_label - config.gutter_width, 0, 0,
height() };
gutter_bounds.right = gutter_bounds.left + config.gutter_width;
- gfx::NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER,
- MPI_NORMAL, &gutter_bounds);
+ theme->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds);
start_x = gutter_bounds.left + config.gutter_width;
- start_y = 0;
+ start_y = -delta;
}
- RECT separator_bounds = { start_x, start_y, width(), height() };
- gfx::NativeTheme::instance()->PaintMenuSeparator(
+
+ RECT separator_bounds = { start_x, start_y, width(), height() - delta };
+ theme->PaintMenuSeparator(
dc, MENU_POPUPSEPARATOR, MPI_NORMAL, &separator_bounds);
canvas->EndPlatformPaint();
}