summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 16:39:33 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 16:39:33 +0000
commit2dbe3b46526ed24c0dac17644cd3ae28bf4ef705 (patch)
treeedcc03a3dedc7e830e86fe63356f2a7376eaab5b /views/controls
parent863145ff033e1a3b43be8203afdd0cd160d389b6 (diff)
downloadchromium_src-2dbe3b46526ed24c0dac17644cd3ae28bf4ef705.zip
chromium_src-2dbe3b46526ed24c0dac17644cd3ae28bf4ef705.tar.gz
chromium_src-2dbe3b46526ed24c0dac17644cd3ae28bf4ef705.tar.bz2
Status menu change per chromium-os:5517
- Apply 10% white to selected menu button; - Remove the menu offset so that the menu is top aligned with toolbar; - Make all status area buttons derive from StatusAreaButton; - Move ClockMenuButton's text size logic into StatusAreaButton to share the logic with LanguageMenuButton; - Strip unused space from LanguageMenuButton so that it looks good with 10% white highlight; - Make LanguageMenuButton and ClockMenuButton center aligned; - Add 1-pixel padding at top when the vertical space is odd number so that text looks properly aligned with the icons; BUG=chromium-os:5517 TEST=Verify fix for chromium-os:5517. Review URL: http://codereview.chromium.org/3141019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/menu_button.cc9
-rw-r--r--views/controls/button/menu_button.h12
2 files changed, 19 insertions, 2 deletions
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index 2a63124..f09b2d4 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -31,6 +31,10 @@ static const int64 kMinimumTimeBetweenButtonClicks = 100;
static const int kMenuMarkerPaddingLeft = 3;
static const int kMenuMarkerPaddingRight = -1;
+// Default menu offset.
+static const int kDefaultMenuOffsetX = -2;
+static const int kDefaultMenuOffsetY = -4;
+
// static
const char MenuButton::kViewClassName[] = "views/MenuButton";
@@ -46,6 +50,7 @@ MenuButton::MenuButton(ButtonListener* listener,
bool show_menu_marker)
: TextButton(listener, text),
menu_visible_(false),
+ menu_offset_(kDefaultMenuOffsetX, kDefaultMenuOffsetY),
menu_delegate_(menu_delegate),
show_menu_marker_(show_menu_marker),
menu_marker_(ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -130,9 +135,9 @@ bool MenuButton::Activate() {
View::ConvertPointToScreen(this, &menu_position);
if (base::i18n::IsRTL())
- menu_position.Offset(2, -4);
+ menu_position.Offset(-menu_offset_.x(), menu_offset_.y());
else
- menu_position.Offset(-2, -4);
+ menu_position.Offset(menu_offset_.x(), menu_offset_.y());
int max_x_coordinate = GetMaximumScreenXCoordinate();
if (max_x_coordinate && max_x_coordinate <= menu_position.x())
diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h
index 74affeb..ac20b0f 100644
--- a/views/controls/button/menu_button.h
+++ b/views/controls/button/menu_button.h
@@ -66,10 +66,22 @@ class MenuButton : public TextButton {
// Returns views/MenuButton.
virtual std::string GetClassName() const;
+ // Accessors for menu_offset_.
+ const gfx::Point& menu_offset() const {
+ return menu_offset_;
+ }
+
+ void set_menu_offset(int x, int y) {
+ menu_offset_.SetPoint(x, y);
+ }
+
protected:
// True if the menu is currently visible.
bool menu_visible_;
+ // Offset of the associated menu position.
+ gfx::Point menu_offset_;
+
private:
friend class TextButtonBackground;