Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/controls/menu/menu_item_view.h

Issue 250943008: Move enum MenuAnchorPosition to reduce deps on menu_item_view.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // menus that is only used internally. 76 // menus that is only used internally.
77 enum Type { 77 enum Type {
78 NORMAL, 78 NORMAL,
79 SUBMENU, 79 SUBMENU,
80 CHECKBOX, 80 CHECKBOX,
81 RADIO, 81 RADIO,
82 SEPARATOR, 82 SEPARATOR,
83 EMPTY 83 EMPTY
84 }; 84 };
85 85
86 // Where the menu should be anchored to for non-RTL languages. The
87 // opposite position will be used if base::i18n:IsRTL() is true.
88 // The BUBBLE flags are used when the menu should get enclosed by a bubble.
89 // Note that BUBBLE flags should only be used with menus which have no
90 // children.
91 enum AnchorPosition {
92 TOPLEFT,
93 TOPRIGHT,
94 BOTTOMCENTER,
95 BUBBLE_LEFT,
96 BUBBLE_RIGHT,
97 BUBBLE_ABOVE,
98 BUBBLE_BELOW
99 };
100
tapted 2014/04/29 11:53:14 <link to interesting bit>
101 // Where the menu should be drawn, above or below the bounds (when 86 // Where the menu should be drawn, above or below the bounds (when
102 // the bounds is non-empty). POSITION_BEST_FIT (default) positions 87 // the bounds is non-empty). POSITION_BEST_FIT (default) positions
103 // the menu below the bounds unless the menu does not fit on the 88 // the menu below the bounds unless the menu does not fit on the
104 // screen and the re is more space above. 89 // screen and the re is more space above.
105 enum MenuPosition { 90 enum MenuPosition {
106 POSITION_BEST_FIT, 91 POSITION_BEST_FIT,
107 POSITION_ABOVE_BOUNDS, 92 POSITION_ABOVE_BOUNDS,
108 POSITION_BELOW_BOUNDS 93 POSITION_BELOW_BOUNDS
109 }; 94 };
110 95
(...skipping 25 matching lines...) Expand all
136 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; 121 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
137 122
138 // Returns the preferred height of menu items. This is only valid when the 123 // Returns the preferred height of menu items. This is only valid when the
139 // menu is about to be shown. 124 // menu is about to be shown.
140 static int pref_menu_height() { return pref_menu_height_; } 125 static int pref_menu_height() { return pref_menu_height_; }
141 126
142 // X-coordinate of where the label starts. 127 // X-coordinate of where the label starts.
143 static int label_start() { return label_start_; } 128 static int label_start() { return label_start_; }
144 129
145 // Returns if a given |anchor| is a bubble or not. 130 // Returns if a given |anchor| is a bubble or not.
146 static bool IsBubble(MenuItemView::AnchorPosition anchor); 131 static bool IsBubble(ui::MenuAnchorPosition anchor);
147 132
148 // Returns the accessible name to be used with screen readers. Mnemonics are 133 // Returns the accessible name to be used with screen readers. Mnemonics are
149 // removed and the menu item accelerator text is appended. 134 // removed and the menu item accelerator text is appended.
150 static base::string16 GetAccessibleNameForMenuItem( 135 static base::string16 GetAccessibleNameForMenuItem(
151 const base::string16& item_text, const base::string16& accelerator_text); 136 const base::string16& item_text, const base::string16& accelerator_text);
152 137
153 // Hides and cancels the menu. This does nothing if the menu is not open. 138 // Hides and cancels the menu. This does nothing if the menu is not open.
154 void Cancel(); 139 void Cancel();
155 140
156 // Add an item to the menu at a specified index. ChildrenChanged() should 141 // Add an item to the menu at a specified index. ChildrenChanged() should
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 // If set to false, the right margin will be removed for menu lines 510 // If set to false, the right margin will be removed for menu lines
526 // containing other elements. 511 // containing other elements.
527 bool use_right_margin_; 512 bool use_right_margin_;
528 513
529 DISALLOW_COPY_AND_ASSIGN(MenuItemView); 514 DISALLOW_COPY_AND_ASSIGN(MenuItemView);
530 }; 515 };
531 516
532 } // namespace views 517 } // namespace views
533 518
534 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ 519 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698