menu_config.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org// Use of this source code is governed by a BSD-style license that can be 3cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org// found in the LICENSE file. 4cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 5cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org#ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_ 6cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org#define UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_ 7cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 8cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org#include "third_party/skia/include/core/SkColor.h" 9cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org#include "ui/gfx/font.h" 10cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org#include "ui/views/views_export.h" 11cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 12cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.orgnamespace ui { 13cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.orgclass NativeTheme; 14cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org} 15cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 16cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.orgnamespace views { 17cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 18cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org// Layout type information for menu items. Use the instance() method to obtain 19cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org// the MenuConfig for the current platform. 20cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.orgstruct VIEWS_EXPORT MenuConfig { 21cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org explicit MenuConfig(const ui::NativeTheme* theme); 22cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org ~MenuConfig(); 23cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 24cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org static const MenuConfig& instance(const ui::NativeTheme* theme); 25cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 26cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Font used by menus. 27cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org gfx::Font font; 28cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 29cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Normal text color. 30cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org SkColor text_color; 31cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 32cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Color for the arrow to scroll bookmarks. 33cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org SkColor arrow_color; 34cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 35cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Submenu horizontal margin size. 36cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int submenu_horizontal_margin_size; 37cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 38cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Submenu vertical margin size. 39cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int submenu_vertical_margin_size; 40cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 41cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Submenu horizontal inset with parent menu. This is the horizontal overlap 42cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // between the submenu and its parent menu, not including the borders of 43cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // submenu and parent menu. 44cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int submenu_horizontal_inset; 45cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 46cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Margins between the top of the item and the label. 47cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int item_top_margin; 48cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 49cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Margins between the bottom of the item and the label. 50cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int item_bottom_margin; 51cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 52cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Margins used if the menu doesn't have icons. 53cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int item_no_icon_top_margin; 54cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int item_no_icon_bottom_margin; 55cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 56cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Margins between the left of the item and the icon. 57cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int item_left_margin; 58cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 59cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Padding between the label and submenu arrow. 60cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int label_to_arrow_padding; 61cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 62cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Padding between the arrow and the edge. 63cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int arrow_to_edge_padding; 64cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 65cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Padding between the icon and label. 66cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int icon_to_label_padding; 67cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 68cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Padding between the gutter and label. 69cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int gutter_to_label; 70cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 71cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Size of the check. 72cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int check_width; 73cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int check_height; 74cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 75cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Size of the radio bullet. 76cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int radio_width; 77cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int radio_height; 78cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 79cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Size of the submenu arrow. 80cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int arrow_height; 81cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int arrow_width; 82cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 83cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Width of the gutter. Only used if render_gutter is true. 84cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int gutter_width; 85cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 86cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Height of a normal separator (ui::NORMAL_SEPARATOR). 87cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int separator_height; 88cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 89cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Height of a ui::UPPER_SEPARATOR. 90cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int separator_upper_height; 91cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 92cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Height of a ui::LOWER_SEPARATOR. 93cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int separator_lower_height; 94cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 95cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Height of a ui::SPACING_SEPARATOR. 96cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org int separator_spacing_height; 97cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 98cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Whether or not the gutter should be rendered. The gutter is specific to 99cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org // Vista. 100cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org bool render_gutter; 101cec079d8ed1f0920a0ea3dc9a3e81966013287c1whesse@chromium.org 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