diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 19:06:20 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 19:06:20 +0000 |
commit | c88e3df4344d2621f59cbe2899c5859ab1a4fd5d (patch) | |
tree | 6acf714ba261116020d52e283ed3270eb1ed5599 /chrome/browser/chromeos/compact_navigation_bar.cc | |
parent | d4281df8eff4a69740c98619920816dc16e43962 (diff) | |
download | chromium_src-c88e3df4344d2621f59cbe2899c5859ab1a4fd5d.zip chromium_src-c88e3df4344d2621f59cbe2899c5859ab1a4fd5d.tar.gz chromium_src-c88e3df4344d2621f59cbe2899c5859ab1a4fd5d.tar.bz2 |
Make sure the main menu is positioned right.
This is necessary because the chromeos window manager moves the window off the screen when in overview mode, and also
WM resize/relocate the chrome window when a panel is attached to the side.
Adjust the button layout so that back/forward button and main menu align nicely.
BUG=none
TEST=manual: open main menu, then preess F12 to switch to overview mode. quit the overview mode,
and main menu should work.
Review URL: http://codereview.chromium.org/600086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/compact_navigation_bar.cc')
-rw-r--r-- | chrome/browser/chromeos/compact_navigation_bar.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/compact_navigation_bar.cc b/chrome/browser/chromeos/compact_navigation_bar.cc index bee7a920..5cc51c0 100644 --- a/chrome/browser/chromeos/compact_navigation_bar.cc +++ b/chrome/browser/chromeos/compact_navigation_bar.cc @@ -32,8 +32,14 @@ namespace chromeos { // Padding inside each button around the image. static const int kInnerPadding = 1; -// Spacing between buttons. -static const int kHorizPadding = 3; +// Spacing between buttons (excluding left/right most margin) +static const int kHorizMargin = 3; + +// Left side margin of the back button to align with the main menu. +static const int kBackButtonLeftMargin = 10; + +// Right side margin of the forward button to align with the main menu. +static const int kForwardButtonRightMargin = 1; // Preferred height. static const int kPreferredHeight = 25; @@ -97,14 +103,13 @@ void CompactNavigationBar::Init() { } gfx::Size CompactNavigationBar::GetPreferredSize() { - int width = kHorizPadding; - width += back_->GetPreferredSize().width() + kHorizPadding + - kInnerPadding * 2; - width += bf_separator_->GetPreferredSize().width() + kHorizPadding; - width += forward_->GetPreferredSize().width() + kHorizPadding + - kInnerPadding * 2; - - width++; + int width = kBackButtonLeftMargin; + width += back_->GetPreferredSize().width() + kInnerPadding * 2; + width += kHorizMargin; + width += bf_separator_->GetPreferredSize().width(); + width += kHorizMargin; + width += forward_->GetPreferredSize().width() + kInnerPadding * 2; + width += kForwardButtonRightMargin; return gfx::Size(width, kPreferredHeight); } @@ -114,21 +119,20 @@ void CompactNavigationBar::Layout() { // Layout forward/back buttons after entry views as follows: // [Back]|[Forward] - int curx = 0; + int curx = kBackButtonLeftMargin; // "Back | Forward" section. gfx::Size button_size = back_->GetPreferredSize(); button_size.set_width(button_size.width() + kInnerPadding * 2); back_->SetBounds(curx, 0, button_size.width(), height()); - curx += button_size.width() + kHorizPadding; + curx += button_size.width() + kHorizMargin; button_size = bf_separator_->GetPreferredSize(); bf_separator_->SetBounds(curx, 0, button_size.width(), height()); - curx += button_size.width() + kHorizPadding; + curx += button_size.width() + kHorizMargin; button_size = forward_->GetPreferredSize(); button_size.set_width(button_size.width() + kInnerPadding * 2); forward_->SetBounds(curx, 0, button_size.width(), height()); - curx += button_size.width() + kHorizPadding; } void CompactNavigationBar::Paint(gfx::Canvas* canvas) { |