| OLD | NEW |
| 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_SUBMENU_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/views/animation/scroll_animator.h" | 12 #include "ui/views/animation/scroll_animator.h" |
| 13 #include "ui/views/controls/menu/menu_delegate.h" | 13 #include "ui/views/controls/menu/menu_delegate.h" |
| 14 #include "ui/views/controls/prefix_delegate.h" | 14 #include "ui/views/controls/prefix_delegate.h" |
| 15 #include "ui/views/controls/prefix_selector.h" | 15 #include "ui/views/controls/prefix_selector.h" |
| 16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 | 19 |
| 20 class MenuHost; | 20 class MenuHost; |
| 21 class MenuItemView; | 21 class MenuItemView; |
| 22 class MenuScrollViewContainer; | 22 class MenuScrollViewContainer; |
| 23 | 23 |
| 24 namespace test { |
| 25 class MenuControllerTest; |
| 26 } // test |
| 27 |
| 24 // SubmenuView is the parent of all menu items. | 28 // SubmenuView is the parent of all menu items. |
| 25 // | 29 // |
| 26 // SubmenuView has the following responsibilities: | 30 // SubmenuView has the following responsibilities: |
| 27 // . It positions and sizes all child views (any type of View may be added, | 31 // . It positions and sizes all child views (any type of View may be added, |
| 28 // not just MenuItemViews). | 32 // not just MenuItemViews). |
| 29 // . Forwards the appropriate events to the MenuController. This allows the | 33 // . Forwards the appropriate events to the MenuController. This allows the |
| 30 // MenuController to update the selection as the user moves the mouse around. | 34 // MenuController to update the selection as the user moves the mouse around. |
| 31 // . Renders the drop indicator during a drop operation. | 35 // . Renders the drop indicator during a drop operation. |
| 32 // . Shows and hides the window (a NativeWidget) when the menu is shown on | 36 // . Shows and hides the window (a NativeWidget) when the menu is shown on |
| 33 // screen. | 37 // screen. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Overridden from View: | 165 // Overridden from View: |
| 162 const char* GetClassName() const override; | 166 const char* GetClassName() const override; |
| 163 | 167 |
| 164 // View method. Overridden to schedule a paint. We do this so that when | 168 // View method. Overridden to schedule a paint. We do this so that when |
| 165 // scrolling occurs, everything is repainted correctly. | 169 // scrolling occurs, everything is repainted correctly. |
| 166 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 170 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 167 | 171 |
| 168 void ChildPreferredSizeChanged(View* child) override; | 172 void ChildPreferredSizeChanged(View* child) override; |
| 169 | 173 |
| 170 private: | 174 private: |
| 175 friend class test::MenuControllerTest; |
| 176 |
| 171 void SchedulePaintForDropIndicator(MenuItemView* item, | 177 void SchedulePaintForDropIndicator(MenuItemView* item, |
| 172 MenuDelegate::DropPosition position); | 178 MenuDelegate::DropPosition position); |
| 173 | 179 |
| 174 // Calculates the location of th edrop indicator. | 180 // Calculates the location of th edrop indicator. |
| 175 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, | 181 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, |
| 176 MenuDelegate::DropPosition position); | 182 MenuDelegate::DropPosition position); |
| 177 | 183 |
| 178 // Implementation of ScrollDelegate | 184 // Implementation of ScrollDelegate |
| 179 bool OnScroll(float dx, float dy) override; | 185 bool OnScroll(float dx, float dy) override; |
| 180 | 186 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 float roundoff_error_; | 220 float roundoff_error_; |
| 215 | 221 |
| 216 PrefixSelector prefix_selector_; | 222 PrefixSelector prefix_selector_; |
| 217 | 223 |
| 218 DISALLOW_COPY_AND_ASSIGN(SubmenuView); | 224 DISALLOW_COPY_AND_ASSIGN(SubmenuView); |
| 219 }; | 225 }; |
| 220 | 226 |
| 221 } // namespace views | 227 } // namespace views |
| 222 | 228 |
| 223 #endif // UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ | 229 #endif // UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ |
| OLD | NEW |