OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
6 #define VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 6 #define VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
7 | 7 |
8 #include "views/controls/menu/menu_delegate.h" | 8 #include "views/controls/menu/menu_delegate.h" |
9 #include "views/view.h" | 9 #include "views/view.h" |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 MenuScrollViewContainer* GetScrollViewContainer(); | 118 MenuScrollViewContainer* GetScrollViewContainer(); |
119 | 119 |
120 // Returns the NativeWindow host of the menu, or NULL if not showing. | 120 // Returns the NativeWindow host of the menu, or NULL if not showing. |
121 gfx::NativeWindow native_window() const; | 121 gfx::NativeWindow native_window() const; |
122 | 122 |
123 // Invoked if the menu is prematurely destroyed. This can happen if the window | 123 // Invoked if the menu is prematurely destroyed. This can happen if the window |
124 // closes while the menu is shown. If invoked the SubmenuView must drop all | 124 // closes while the menu is shown. If invoked the SubmenuView must drop all |
125 // references to the MenuHost as the MenuHost is about to be deleted. | 125 // references to the MenuHost as the MenuHost is about to be deleted. |
126 void MenuHostDestroyed(); | 126 void MenuHostDestroyed(); |
127 | 127 |
| 128 // Max width of accelerators in child menu items. This doesn't include |
| 129 // children's children, only direct children. |
| 130 int max_accelerator_width() const { return max_accelerator_width_; } |
| 131 |
128 // Padding around the edges of the submenu. | 132 // Padding around the edges of the submenu. |
129 static const int kSubmenuBorderSize; | 133 static const int kSubmenuBorderSize; |
130 | 134 |
131 private: | 135 private: |
132 // Paints the drop indicator. This is only invoked if item is non-NULL and | 136 // Paints the drop indicator. This is only invoked if item is non-NULL and |
133 // position is not DROP_NONE. | 137 // position is not DROP_NONE. |
134 void PaintDropIndicator(gfx::Canvas* canvas, | 138 void PaintDropIndicator(gfx::Canvas* canvas, |
135 MenuItemView* item, | 139 MenuItemView* item, |
136 MenuDelegate::DropPosition position); | 140 MenuDelegate::DropPosition position); |
137 | 141 |
(...skipping 14 matching lines...) Expand all Loading... |
152 // If non-null, indicates a drop is in progress and drop_item is the item | 156 // If non-null, indicates a drop is in progress and drop_item is the item |
153 // the drop is over. | 157 // the drop is over. |
154 MenuItemView* drop_item_; | 158 MenuItemView* drop_item_; |
155 | 159 |
156 // Position of the drop. | 160 // Position of the drop. |
157 MenuDelegate::DropPosition drop_position_; | 161 MenuDelegate::DropPosition drop_position_; |
158 | 162 |
159 // Ancestor of the SubmenuView, lazily created. | 163 // Ancestor of the SubmenuView, lazily created. |
160 MenuScrollViewContainer* scroll_view_container_; | 164 MenuScrollViewContainer* scroll_view_container_; |
161 | 165 |
| 166 // See description above getter. |
| 167 int max_accelerator_width_; |
| 168 |
162 DISALLOW_COPY_AND_ASSIGN(SubmenuView); | 169 DISALLOW_COPY_AND_ASSIGN(SubmenuView); |
163 }; | 170 }; |
164 | 171 |
165 } // namespace views | 172 } // namespace views |
166 | 173 |
167 #endif // VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 174 #endif // VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
OLD | NEW |