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

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

Issue 6452011: Rework tree APIs to reflect Google style and more const-correctness.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
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 <uxtheme.h> 7 #include <uxtheme.h>
8 #include <Vssym32.h> 8 #include <Vssym32.h>
9 9
10 #include "grit/app_strings.h" 10 #include "grit/app_strings.h"
(...skipping 12 matching lines...) Expand all
23 font.GetStringWidth(title_) + label_start_ + item_right_margin_ + 23 font.GetStringWidth(title_) + label_start_ + item_right_margin_ +
24 GetChildPreferredWidth(), 24 GetChildPreferredWidth(),
25 font.GetHeight() + GetBottomMargin() + GetTopMargin()); 25 font.GetHeight() + GetBottomMargin() + GetTopMargin());
26 } 26 }
27 27
28 void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) { 28 void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
29 const MenuConfig& config = MenuConfig::instance(); 29 const MenuConfig& config = MenuConfig::instance();
30 bool render_selection = 30 bool render_selection =
31 (!for_drag && IsSelected() && 31 (!for_drag && IsSelected() &&
32 parent_menu_item_->GetSubmenu()->GetShowSelection(this) && 32 parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
33 GetChildViewCount() == 0); 33 !has_children());
34 int state = render_selection ? MPI_HOT : 34 int state = render_selection ? MPI_HOT :
35 (IsEnabled() ? MPI_NORMAL : MPI_DISABLED); 35 (IsEnabled() ? MPI_NORMAL : MPI_DISABLED);
36 HDC dc = canvas->BeginPlatformPaint(); 36 HDC dc = canvas->BeginPlatformPaint();
37 NativeTheme::ControlState control_state; 37 NativeTheme::ControlState control_state;
38 38
39 if (!IsEnabled()) { 39 if (!IsEnabled()) {
40 control_state = NativeTheme::CONTROL_DISABLED; 40 control_state = NativeTheme::CONTROL_DISABLED;
41 } else { 41 } else {
42 control_state = render_selection ? NativeTheme::CONTROL_HIGHLIGHTED : 42 control_state = render_selection ? NativeTheme::CONTROL_HIGHLIGHTED :
43 NativeTheme::CONTROL_NORMAL; 43 NativeTheme::CONTROL_NORMAL;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // And the check. 162 // And the check.
163 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); 163 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height);
164 AdjustBoundsForRTLUI(&icon_bounds); 164 AdjustBoundsForRTLUI(&icon_bounds);
165 RECT icon_rect = icon_bounds.ToRECT(); 165 RECT icon_rect = icon_bounds.ToRECT();
166 NativeTheme::instance()->PaintMenuCheck( 166 NativeTheme::instance()->PaintMenuCheck(
167 NativeTheme::MENU, dc, MENU_POPUPCHECK, state_id, &icon_rect, 167 NativeTheme::MENU, dc, MENU_POPUPCHECK, state_id, &icon_rect,
168 control_state); 168 control_state);
169 } 169 }
170 170
171 } // namespace views 171 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698