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

Side by Side Diff: ui/views/controls/menu/menu_separator_views.cc

Issue 11026076: Added MenuConfig setter to MenuItemView, updated rest of the code to use set MenuConfig if it avail… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_separator.h" 5 #include "ui/views/controls/menu/menu_separator.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "ui/base/native_theme/native_theme.h" 8 #include "ui/base/native_theme/native_theme.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/controls/menu/menu_config.h" 10 #include "ui/views/controls/menu/menu_config.h"
(...skipping 19 matching lines...) Expand all
30 default: 30 default:
31 pos = height() / 2; 31 pos = height() / 2;
32 break; 32 break;
33 } 33 }
34 canvas->FillRect(gfx::Rect(0, pos, width(), kSeparatorHeight), 34 canvas->FillRect(gfx::Rect(0, pos, width(), kSeparatorHeight),
35 ui::NativeTheme::instance()->GetSystemColor( 35 ui::NativeTheme::instance()->GetSystemColor(
36 ui::NativeTheme::kColorId_MenuSeparatorColor)); 36 ui::NativeTheme::kColorId_MenuSeparatorColor));
37 } 37 }
38 38
39 gfx::Size MenuSeparator::GetPreferredSize() { 39 gfx::Size MenuSeparator::GetPreferredSize() {
40 int height = MenuConfig::instance().separator_height; 40 const MenuConfig& menu_config = parent_menu_item_->GetMenuConfig();
41 int height = menu_config.separator_height;
41 switch(type_) { 42 switch(type_) {
42 case ui::SPACING_SEPARATOR: 43 case ui::SPACING_SEPARATOR:
43 height = MenuConfig::instance().separator_spacing_height; 44 height = menu_config.separator_spacing_height;
44 break; 45 break;
45 case ui::LOWER_SEPARATOR: 46 case ui::LOWER_SEPARATOR:
46 height = MenuConfig::instance().separator_lower_height; 47 height = menu_config.separator_lower_height;
47 break; 48 break;
48 case ui::UPPER_SEPARATOR: 49 case ui::UPPER_SEPARATOR:
49 height = MenuConfig::instance().separator_upper_height; 50 height = menu_config.separator_upper_height;
50 break; 51 break;
51 default: 52 default:
52 height = MenuConfig::instance().separator_height; 53 height = menu_config.separator_height;
53 break; 54 break;
54 } 55 }
55 return gfx::Size(10, // Just in case we're the only item in a menu. 56 return gfx::Size(10, // Just in case we're the only item in a menu.
56 height); 57 height);
57 } 58 }
58 59
59 } // namespace views 60 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698