OLD | NEW |
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_config.h" | 5 #include "ui/views/controls/menu/menu_config.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "ui/base/layout.h" | 8 #include "ui/base/layout.h" |
9 #include "ui/base/native_theme/native_theme_aura.h" | 9 #include "ui/base/native_theme/native_theme_aura.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
11 #include "ui/gfx/image/image.h" | 11 #include "ui/gfx/image/image.h" |
12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 // static | 16 void MenuConfig::Init() { |
17 MenuConfig* MenuConfig::Create() { | 17 text_color = ui::NativeTheme::instance()->GetSystemColor( |
18 MenuConfig* config = new MenuConfig(); | |
19 config->text_color = ui::NativeTheme::instance()->GetSystemColor( | |
20 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); | 18 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
21 config->submenu_horizontal_margin_size = 0; | 19 submenu_horizontal_margin_size = 0; |
22 config->submenu_vertical_margin_size = 0; | 20 submenu_vertical_margin_size = 0; |
23 config->submenu_horizontal_inset = 1; | 21 submenu_horizontal_inset = 1; |
24 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 22 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
25 config->arrow_to_edge_padding = 20; | 23 arrow_to_edge_padding = 20; |
26 config->icon_to_label_padding = 4; | 24 icon_to_label_padding = 4; |
27 config->arrow_width = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia()->width(); | 25 arrow_width = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia()->width(); |
28 const gfx::ImageSkia* check = rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia(); | 26 const gfx::ImageSkia* check = rb.GetImageNamed(IDR_MENU_CHECK).ToImageSkia(); |
29 // Add 4 to force some padding between check and label. | 27 // Add 4 to force some padding between check and label. |
30 config->check_width = check->width() + 4; | 28 check_width = check->width() + 4; |
31 config->check_height = check->height(); | 29 check_height = check->height(); |
32 config->item_left_margin = 4; | 30 item_left_margin = 4; |
33 config->item_min_height = 29; | 31 item_min_height = 29; |
34 config->separator_height = 15; | 32 separator_height = 15; |
35 config->separator_spacing_height = 7; | 33 separator_spacing_height = 7; |
36 config->separator_lower_height = 8; | 34 separator_lower_height = 8; |
37 config->separator_upper_height = 8; | 35 separator_upper_height = 8; |
38 config->font = rb.GetFont(ResourceBundle::BaseFont); | 36 font = rb.GetFont(ResourceBundle::BaseFont); |
39 config->label_to_arrow_padding = 20; | 37 label_to_arrow_padding = 20; |
40 config->label_to_accelerator_padding = 20; | 38 label_to_accelerator_padding = 20; |
41 config->always_use_icon_to_label_padding = true; | 39 always_use_icon_to_label_padding = true; |
42 config->align_arrow_and_shortcut = true; | 40 align_arrow_and_shortcut = true; |
43 config->offset_context_menus = true; | 41 offset_context_menus = true; |
44 | |
45 return config; | |
46 } | 42 } |
47 | 43 |
48 } // namespace views | 44 } // namespace views |
OLD | NEW |