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

Side by Side Diff: views/controls/menu/menu_item_view_gtk.cc

Issue 2833013: Tweaks for the merged menu: (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « views/controls/menu/menu_config_win.cc ('k') | views/controls/menu/menu_item_view_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "gfx/canvas.h" 8 #include "gfx/canvas.h"
9 #include "gfx/favicon_size.h" 9 #include "gfx/favicon_size.h"
10 #include "grit/app_resources.h" 10 #include "grit/app_resources.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 // Render the foreground. 67 // Render the foreground.
68 #if defined(OS_CHROMEOS) 68 #if defined(OS_CHROMEOS)
69 SkColor fg_color = 69 SkColor fg_color =
70 IsEnabled() ? SK_ColorBLACK : SkColorSetRGB(0x80, 0x80, 0x80); 70 IsEnabled() ? SK_ColorBLACK : SkColorSetRGB(0x80, 0x80, 0x80);
71 #else 71 #else
72 SkColor fg_color = 72 SkColor fg_color =
73 IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor; 73 IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor;
74 #endif 74 #endif
75 const gfx::Font& font = GetChildViewCount() > 0 ? 75 const gfx::Font& font = MenuConfig::instance().font;
76 MenuConfig::instance().font_with_controls : MenuConfig::instance().font;
77 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); 76 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
78 int width = this->width() - item_right_margin_ - label_start_ - accel_width; 77 int width = this->width() - item_right_margin_ - label_start_ - accel_width;
79 gfx::Rect text_bounds(label_start_, top_margin + 78 gfx::Rect text_bounds(label_start_, top_margin +
80 (available_height - font.height()) / 2, width, 79 (available_height - font.height()) / 2, width,
81 font.height()); 80 font.height());
82 text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); 81 text_bounds.set_x(MirroredLeftPointForRect(text_bounds));
83 canvas->DrawStringInt(GetTitle(), font, fg_color, 82 canvas->DrawStringInt(GetTitle(), font, fg_color,
84 text_bounds.x(), text_bounds.y(), text_bounds.width(), 83 text_bounds.x(), text_bounds.y(), text_bounds.width(),
85 text_bounds.height(), 84 text_bounds.height(),
86 GetRootMenuItem()->GetDrawStringFlags()); 85 GetRootMenuItem()->GetDrawStringFlags());
(...skipping 19 matching lines...) Expand all
106 config.arrow_width) / 2, 105 config.arrow_width) / 2,
107 config.arrow_width, height()); 106 config.arrow_width, height());
108 AdjustBoundsForRTLUI(&arrow_bounds); 107 AdjustBoundsForRTLUI(&arrow_bounds);
109 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 108 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
110 canvas->DrawBitmapInt(*rb.GetBitmapNamed(IDR_MENU_ARROW), 109 canvas->DrawBitmapInt(*rb.GetBitmapNamed(IDR_MENU_ARROW),
111 arrow_bounds.x(), arrow_bounds.y()); 110 arrow_bounds.x(), arrow_bounds.y());
112 } 111 }
113 } 112 }
114 113
115 } // namespace views 114 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_config_win.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