diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:59:52 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:59:52 +0000 |
commit | 32455eb425aa485f6f815197920ef529c4459e26 (patch) | |
tree | 6861495d33c1732002757ba0607257e1f09f6a2c /views/controls/menu/menu_item_view_win.cc | |
parent | ac512ec99f9eb1d0aa829013651c9f653a931fb3 (diff) | |
download | chromium_src-32455eb425aa485f6f815197920ef529c4459e26.zip chromium_src-32455eb425aa485f6f815197920ef529c4459e26.tar.gz chromium_src-32455eb425aa485f6f815197920ef529c4459e26.tar.bz2 |
Makes it so child views of menuitemview can be traversed with the
keyboard. Because I don't want the menu to actually get focus I'm
using SetHotTracked when traversing and AcceleratorPressed from
enter/return.
BUG=45734
TEST=none
Review URL: http://codereview.chromium.org/2741004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_item_view_win.cc')
-rw-r--r-- | views/controls/menu/menu_item_view_win.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc index cb956cb..4a90c28 100644 --- a/views/controls/menu/menu_item_view_win.cc +++ b/views/controls/menu/menu_item_view_win.cc @@ -22,7 +22,8 @@ namespace views { gfx::Size MenuItemView::GetPreferredSize() { const gfx::Font& font = MenuConfig::instance().font; return gfx::Size( - font.GetStringWidth(title_) + label_start_ + item_right_margin_, + font.GetStringWidth(title_) + label_start_ + item_right_margin_ + + GetChildPreferredWidth(), font.height() + GetBottomMargin() + GetTopMargin()); } @@ -30,7 +31,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { const MenuConfig& config = MenuConfig::instance(); bool render_selection = (!for_drag && IsSelected() && - parent_menu_item_->GetSubmenu()->GetShowSelection(this)); + parent_menu_item_->GetSubmenu()->GetShowSelection(this) && + GetChildViewCount() == 0); int state = render_selection ? MPI_HOT : (IsEnabled() ? MPI_NORMAL : MPI_DISABLED); HDC dc = canvas->beginPlatformPaint(); @@ -94,7 +96,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color); int width = this->width() - item_right_margin_ - label_start_; - const gfx::Font& font = MenuConfig::instance().font; + const gfx::Font& font = GetChildViewCount() > 0 ? + MenuConfig::instance().font_with_controls : MenuConfig::instance().font; gfx::Rect text_bounds(label_start_, top_margin, width, font.height()); text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); if (for_drag) { |