menu_config.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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 3// found in the LICENSE file. 4 5#ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_ 6#define UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_ 7 8#include "third_party/skia/include/core/SkColor.h" 9#include "ui/gfx/font.h" 10#include "ui/views/views_export.h" 11 12namespace ui { 13class NativeTheme; 14} 15 16namespace views { 17 18// Layout type information for menu items. Use the instance() method to obtain 19// the MenuConfig for the current platform. 20struct VIEWS_EXPORT MenuConfig { 21 explicit MenuConfig(const ui::NativeTheme* theme); 22 ~MenuConfig(); 23 24 static const MenuConfig& instance(const ui::NativeTheme* theme); 25 26 // Font used by menus. 27 gfx::Font font; 28 29 // Normal text color. 30 SkColor text_color; 31 32 // Color for the arrow to scroll bookmarks. 33 SkColor arrow_color; 34 35 // Submenu horizontal margin size. 36 int submenu_horizontal_margin_size; 37 38 // Submenu vertical margin size. 39 int submenu_vertical_margin_size; 40 41 // Submenu horizontal inset with parent menu. This is the horizontal overlap 42 // between the submenu and its parent menu, not including the borders of 43 // submenu and parent menu. 44 int submenu_horizontal_inset; 45 46 // Margins between the top of the item and the label. 47 int item_top_margin; 48 49 // Margins between the bottom of the item and the label. 50 int item_bottom_margin; 51 52 // Margins used if the menu doesn't have icons. 53 int item_no_icon_top_margin; 54 int item_no_icon_bottom_margin; 55 56 // Margins between the left of the item and the icon. 57 int item_left_margin; 58 59 // Padding between the label and submenu arrow. 60 int label_to_arrow_padding; 61 62 // Padding between the arrow and the edge. 63 int arrow_to_edge_padding; 64 65 // Padding between the icon and label. 66 int icon_to_label_padding; 67 68 // Padding between the gutter and label. 69 int gutter_to_label; 70 71 // Size of the check. 72 int check_width; 73 int check_height; 74 75 // Size of the radio bullet. 76 int radio_width; 77 int radio_height; 78 79 // Size of the submenu arrow. 80 int arrow_height; 81 int arrow_width; 82 83 // Width of the gutter. Only used if render_gutter is true. 84 int gutter_width; 85 86 // Height of a normal separator (ui::NORMAL_SEPARATOR). 87 int separator_height; 88 89 // Height of a ui::UPPER_SEPARATOR. 90 int separator_upper_height; 91 92 // Height of a ui::LOWER_SEPARATOR. 93 int separator_lower_height; 94 95 // Height of a ui::SPACING_SEPARATOR. 96 int separator_spacing_height; 97 98 // Whether or not the gutter should be rendered. The gutter is specific to 99 // Vista. 100 bool render_gutter; 101 102 // Are mnemonics shown? 103 bool show_mnemonics; 104 105 // Height of the scroll arrow. 106 int scroll_arrow_height; 107 108 // Padding between the label and accelerator. Only used if there is an 109 // accelerator. 110 int label_to_accelerator_padding; 111 112 // Minimum height of menu item. 113 int item_min_height; 114 115 // Whether the keyboard accelerators are visible. 116 bool show_accelerators; 117 118 // True if icon to label padding is always added with or without icon. 119 bool always_use_icon_to_label_padding; 120 121 // True if submenu arrow and shortcut right edge should be aligned. 122 bool align_arrow_and_shortcut; 123 124 // True if the context menu's should be offset from the cursor position. 125 bool offset_context_menus; 126 127 const ui::NativeTheme* native_theme; 128 129 private: 130 // Configures a MenuConfig as appropriate for the current platform. 131 void Init(const ui::NativeTheme* theme); 132 133 // TODO: temporary until we standardize. 134#if defined(USE_AURA) 135 void InitAura(); 136#endif 137}; 138 139} // namespace views 140 141#endif // UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_ 142