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

Side by Side Diff: views/controls/menu/menu_item_view_win.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_item_view_gtk.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <Vssym32.h> 9 #include <Vssym32.h>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 // Render the foreground. 90 // Render the foreground.
91 // Menu color is specific to Vista, fallback to classic colors if can't 91 // Menu color is specific to Vista, fallback to classic colors if can't
92 // get color. 92 // get color.
93 int default_sys_color = render_selection ? COLOR_HIGHLIGHTTEXT : 93 int default_sys_color = render_selection ? COLOR_HIGHLIGHTTEXT :
94 (IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT); 94 (IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
95 SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault( 95 SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault(
96 NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, 96 NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR,
97 default_sys_color); 97 default_sys_color);
98 const gfx::Font& font = GetChildViewCount() > 0 ? 98 const gfx::Font& font = MenuConfig::instance().font;
99 MenuConfig::instance().font_with_controls : MenuConfig::instance().font;
100 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); 99 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
101 int width = this->width() - item_right_margin_ - label_start_ - accel_width; 100 int width = this->width() - item_right_margin_ - label_start_ - accel_width;
102 gfx::Rect text_bounds(label_start_, top_margin, width, font.height()); 101 gfx::Rect text_bounds(label_start_, top_margin, width, font.height());
103 text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); 102 text_bounds.set_x(MirroredLeftPointForRect(text_bounds));
104 if (for_drag) { 103 if (for_drag) {
105 // With different themes, it's difficult to tell what the correct 104 // With different themes, it's difficult to tell what the correct
106 // foreground and background colors are for the text to draw the correct 105 // foreground and background colors are for the text to draw the correct
107 // halo. Instead, just draw black on white, which will look good in most 106 // halo. Instead, just draw black on white, which will look good in most
108 // cases. 107 // cases.
109 canvas->DrawStringWithHalo(GetTitle(), font, 0x00000000, 0xFFFFFFFF, 108 canvas->DrawStringWithHalo(GetTitle(), font, 0x00000000, 0xFFFFFFFF,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 146
148 RECT arrow_rect = arrow_bounds.ToRECT(); 147 RECT arrow_rect = arrow_bounds.ToRECT();
149 NativeTheme::instance()->PaintMenuArrow( 148 NativeTheme::instance()->PaintMenuArrow(
150 NativeTheme::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect, 149 NativeTheme::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect,
151 arrow_direction, render_selection); 150 arrow_direction, render_selection);
152 } 151 }
153 canvas->endPlatformPaint(); 152 canvas->endPlatformPaint();
154 } 153 }
155 154
156 } // namespace views 155 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_item_view_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698