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