menu_config.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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_list.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 list used by menus.
27  gfx::FontList font_list;
28
29  // Color for the arrow to scroll bookmarks.
30  SkColor arrow_color;
31
32  // Menu border sizes.
33  int menu_vertical_border_size;
34  int menu_horizontal_border_size;
35
36  // Submenu horizontal inset with parent menu. This is the horizontal overlap
37  // between the submenu and its parent menu, not including the borders of
38  // submenu and parent menu.
39  int submenu_horizontal_inset;
40
41  // Margins between the top of the item and the label.
42  int item_top_margin;
43
44  // Margins between the bottom of the item and the label.
45  int item_bottom_margin;
46
47  // Margins used if the menu doesn't have icons.
48  int item_no_icon_top_margin;
49  int item_no_icon_bottom_margin;
50
51  // Margins between the left of the item and the icon.
52  int item_left_margin;
53
54  // Padding between the label and submenu arrow.
55  int label_to_arrow_padding;
56
57  // Padding between the arrow and the edge.
58  int arrow_to_edge_padding;
59
60  // Padding between the icon and label.
61  int icon_to_label_padding;
62
63  // Padding between the gutter and label.
64  int gutter_to_label;
65
66  // Size of the check.
67  int check_width;
68  int check_height;
69
70  // Size of the radio bullet.
71  int radio_width;
72  int radio_height;
73
74  // Size of the submenu arrow.
75  int arrow_height;
76  int arrow_width;
77
78  // Width of the gutter. Only used if render_gutter is true.
79  int gutter_width;
80
81  // Height of a normal separator (ui::NORMAL_SEPARATOR).
82  int separator_height;
83
84  // Height of a ui::UPPER_SEPARATOR.
85  int separator_upper_height;
86
87  // Height of a ui::LOWER_SEPARATOR.
88  int separator_lower_height;
89
90  // Height of a ui::SPACING_SEPARATOR.
91  int separator_spacing_height;
92
93  // Whether or not the gutter should be rendered. The gutter is specific to
94  // Vista.
95  bool render_gutter;
96
97  // Are mnemonics shown?
98  bool show_mnemonics;
99
100  // Height of the scroll arrow.
101  int scroll_arrow_height;
102
103  // Padding between the label and minor text. Only used if there is an
104  // accelerator or sublabel.
105  int label_to_minor_text_padding;
106
107  // Minimum height of menu item.
108  int item_min_height;
109
110  // Whether the keyboard accelerators are visible.
111  bool show_accelerators;
112
113  // True if icon to label padding is always added with or without icon.
114  bool always_use_icon_to_label_padding;
115
116  // True if submenu arrow and shortcut right edge should be aligned.
117  bool align_arrow_and_shortcut;
118
119  // True if the context menu's should be offset from the cursor position.
120  bool offset_context_menus;
121
122  const ui::NativeTheme* native_theme;
123
124  // Delay, in ms, between when menus are selected or moused over and the menu
125  // appears.
126  int show_delay;
127
128  // Radius of the rounded corners of the menu border. Must be >= 0.
129  int corner_radius;
130
131 private:
132  // Configures a MenuConfig as appropriate for the current platform.
133  void Init(const ui::NativeTheme* theme);
134
135  // TODO: temporary until we standardize.
136  void InitAura(const ui::NativeTheme* theme);
137};
138
139}  // namespace views
140
141#endif  // UI_VIEWS_CONTROLS_MENU_MENU_CONFIG_H_
142