Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: views/controls/menu/menu_item_view_gtk.cc

Issue 2742003: Adds support for showing accelerators in bookmark menus. (Closed)
Patch Set: Added GetAcceleratorText Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/menu/menu_item_view.cc ('k') | views/controls/menu/menu_item_view_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_item_view_gtk.cc
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index 3f0a830db541f336f4f1bee3836ad5272a05930d..74255d1f4c1bdeeb0cd6f588d545bcef7c289539 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -72,9 +72,10 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
SkColor fg_color =
IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor;
#endif
- int width = this->width() - item_right_margin_ - label_start_;
const gfx::Font& font = GetChildViewCount() > 0 ?
MenuConfig::instance().font_with_controls : MenuConfig::instance().font;
+ int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
+ int width = this->width() - item_right_margin_ - label_start_ - accel_width;
gfx::Rect text_bounds(label_start_, top_margin +
(available_height - font.height()) / 2, width,
font.height());
@@ -84,6 +85,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
text_bounds.height(),
GetRootMenuItem()->GetDrawStringFlags());
+ PaintAccelerator(canvas);
+
// Render the icon.
if (icon_.width() > 0) {
gfx::Rect icon_bounds(config.item_left_margin,
« no previous file with comments | « views/controls/menu/menu_item_view.cc ('k') | views/controls/menu/menu_item_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698