OLD | NEW |
1 // Copyright (c) 2006-2008 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 |
11 namespace views { | 11 namespace views { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // The selection is NOT shown during drag and drop when the drop is over | 111 // The selection is NOT shown during drag and drop when the drop is over |
112 // the menu. | 112 // the menu. |
113 bool GetShowSelection(MenuItemView* item); | 113 bool GetShowSelection(MenuItemView* item); |
114 | 114 |
115 // Returns the container for the SubmenuView. | 115 // Returns the container for the SubmenuView. |
116 MenuScrollViewContainer* GetScrollViewContainer(); | 116 MenuScrollViewContainer* GetScrollViewContainer(); |
117 | 117 |
118 // Returns the NativeWindow host of the menu, or NULL if not showing. | 118 // Returns the NativeWindow host of the menu, or NULL if not showing. |
119 gfx::NativeWindow native_window() const; | 119 gfx::NativeWindow native_window() const; |
120 | 120 |
| 121 // Invoked if the menu is prematurely destroyed. This can happen if the window |
| 122 // closes while the menu is shown. If invoked the SubmenuView must drop all |
| 123 // references to the MenuHost as the MenuHost is about to be deleted. |
| 124 void MenuHostDestroyed(); |
| 125 |
121 // Padding around the edges of the submenu. | 126 // Padding around the edges of the submenu. |
122 static const int kSubmenuBorderSize; | 127 static const int kSubmenuBorderSize; |
123 | 128 |
124 private: | 129 private: |
125 // Paints the drop indicator. This is only invoked if item is non-NULL and | 130 // Paints the drop indicator. This is only invoked if item is non-NULL and |
126 // position is not DROP_NONE. | 131 // position is not DROP_NONE. |
127 void PaintDropIndicator(gfx::Canvas* canvas, | 132 void PaintDropIndicator(gfx::Canvas* canvas, |
128 MenuItemView* item, | 133 MenuItemView* item, |
129 MenuDelegate::DropPosition position); | 134 MenuDelegate::DropPosition position); |
130 | 135 |
131 void SchedulePaintForDropIndicator(MenuItemView* item, | 136 void SchedulePaintForDropIndicator(MenuItemView* item, |
132 MenuDelegate::DropPosition position); | 137 MenuDelegate::DropPosition position); |
133 | 138 |
134 // Calculates the location of th edrop indicator. | 139 // Calculates the location of th edrop indicator. |
135 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, | 140 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, |
136 MenuDelegate::DropPosition position); | 141 MenuDelegate::DropPosition position); |
137 | 142 |
138 // Parent menu item. | 143 // Parent menu item. |
139 MenuItemView* parent_menu_item_; | 144 MenuItemView* parent_menu_item_; |
140 | 145 |
141 // Widget subclass used to show the children. | 146 // Widget subclass used to show the children. This is deleted when we invoke |
| 147 // |DestroyMenuHost|, or |MenuHostDestroyed| is invoked back on us. |
142 MenuHost* host_; | 148 MenuHost* host_; |
143 | 149 |
144 // If non-null, indicates a drop is in progress and drop_item is the item | 150 // If non-null, indicates a drop is in progress and drop_item is the item |
145 // the drop is over. | 151 // the drop is over. |
146 MenuItemView* drop_item_; | 152 MenuItemView* drop_item_; |
147 | 153 |
148 // Position of the drop. | 154 // Position of the drop. |
149 MenuDelegate::DropPosition drop_position_; | 155 MenuDelegate::DropPosition drop_position_; |
150 | 156 |
151 // Ancestor of the SubmenuView, lazily created. | 157 // Ancestor of the SubmenuView, lazily created. |
152 MenuScrollViewContainer* scroll_view_container_; | 158 MenuScrollViewContainer* scroll_view_container_; |
153 | 159 |
154 DISALLOW_COPY_AND_ASSIGN(SubmenuView); | 160 DISALLOW_COPY_AND_ASSIGN(SubmenuView); |
155 }; | 161 }; |
156 | 162 |
157 } // namespace views | 163 } // namespace views |
158 | 164 |
159 #endif // VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 165 #endif // VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
OLD | NEW |