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

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

Issue 7491083: Implemented nicer battery status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « views/controls/menu/menu_item_view_gtk.cc ('k') | views/controls/menu/submenu_view.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <uxtheme.h> 7 #include <uxtheme.h>
8 #include <Vssym32.h> 8 #include <Vssym32.h>
9 9
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
11 #include "ui/gfx/canvas_skia.h" 11 #include "ui/gfx/canvas_skia.h"
12 #include "ui/gfx/native_theme_win.h" 12 #include "ui/gfx/native_theme_win.h"
13 #include "views/controls/menu/menu_config.h" 13 #include "views/controls/menu/menu_config.h"
14 #include "views/controls/menu/submenu_view.h" 14 #include "views/controls/menu/submenu_view.h"
15 15
16 using gfx::NativeTheme; 16 using gfx::NativeTheme;
17 17
18 namespace views { 18 namespace views {
19 19
20 gfx::Size MenuItemView::CalculatePreferredSize() { 20 gfx::Size MenuItemView::CalculatePreferredSize() {
21 gfx::Size child_size = GetChildPreferredSize(); 21 gfx::Size child_size = GetChildPreferredSize();
22 if (child_count() == 1 && title_.empty()) {
23 return gfx::Size(
24 child_size.width(),
25 child_size.height() + GetBottomMargin() + GetTopMargin());
26 }
27
22 const gfx::Font& font = GetFont(); 28 const gfx::Font& font = GetFont();
23 return gfx::Size( 29 return gfx::Size(
24 font.GetStringWidth(title_) + label_start_ + item_right_margin_ + 30 font.GetStringWidth(title_) + label_start_ + item_right_margin_ +
25 child_size.width(), 31 child_size.width(),
26 std::max(child_size.height(), font.GetHeight()) + GetBottomMargin() + 32 std::max(child_size.height(), font.GetHeight()) + GetBottomMargin() +
27 GetTopMargin()); 33 GetTopMargin());
28 } 34 }
29 35
30 void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { 36 void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
31 const MenuConfig& config = MenuConfig::instance(); 37 const MenuConfig& config = MenuConfig::instance();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); 178 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra);
173 179
174 // And the check. 180 // And the check.
175 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); 181 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height);
176 AdjustBoundsForRTLUI(&icon_bounds); 182 AdjustBoundsForRTLUI(&icon_bounds);
177 NativeTheme::instance()->Paint(canvas->AsCanvasSkia(), 183 NativeTheme::instance()->Paint(canvas->AsCanvasSkia(),
178 NativeTheme::kMenuCheck, state, bg_bounds, extra); 184 NativeTheme::kMenuCheck, state, bg_bounds, extra);
179 } 185 }
180 186
181 } // namespace views 187 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_item_view_gtk.cc ('k') | views/controls/menu/submenu_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698