| OLD | NEW |
| 1 // Copyright (c) 2011 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_SCROLL_VIEW_CONTAINER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 | 12 |
| 13 class SubmenuView; | 13 class SubmenuView; |
| 14 | 14 |
| 15 // MenuScrollViewContainer contains the SubmenuView (through a MenuScrollView) | 15 // MenuScrollViewContainer contains the SubmenuView (through a MenuScrollView) |
| 16 // and two scroll buttons. The scroll buttons are only visible and enabled if | 16 // and two scroll buttons. The scroll buttons are only visible and enabled if |
| 17 // the preferred height of the SubmenuView is bigger than our bounds. | 17 // the preferred height of the SubmenuView is bigger than our bounds. |
| 18 class MenuScrollViewContainer : public View { | 18 class MenuScrollViewContainer : public View { |
| 19 public: | 19 public: |
| 20 explicit MenuScrollViewContainer(SubmenuView* content_view); | 20 explicit MenuScrollViewContainer(SubmenuView* content_view); |
| 21 | 21 |
| 22 // Returns the buttons for scrolling up/down. | 22 // Returns the buttons for scrolling up/down. |
| 23 View* scroll_down_button() const { return scroll_down_button_; } | 23 View* scroll_down_button() const { return scroll_down_button_; } |
| 24 View* scroll_up_button() const { return scroll_up_button_; } | 24 View* scroll_up_button() const { return scroll_up_button_; } |
| 25 | 25 |
| 26 // View overrides. | 26 // View overrides. |
| 27 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 27 virtual void OnPaintBackground(gfx::CanvasSkia* canvas) OVERRIDE; |
| 28 virtual void Layout() OVERRIDE; | 28 virtual void Layout() OVERRIDE; |
| 29 virtual gfx::Size GetPreferredSize() OVERRIDE; | 29 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 30 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 30 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 // View override. | 33 // View override. |
| 34 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 34 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 class MenuScrollView; | 37 class MenuScrollView; |
| 38 | 38 |
| 39 // The scroll buttons. | 39 // The scroll buttons. |
| 40 View* scroll_up_button_; | 40 View* scroll_up_button_; |
| 41 View* scroll_down_button_; | 41 View* scroll_down_button_; |
| 42 | 42 |
| 43 // The scroll view. | 43 // The scroll view. |
| 44 MenuScrollView* scroll_view_; | 44 MenuScrollView* scroll_view_; |
| 45 | 45 |
| 46 // The content view. | 46 // The content view. |
| 47 SubmenuView* content_view_; | 47 SubmenuView* content_view_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(MenuScrollViewContainer); | 49 DISALLOW_COPY_AND_ASSIGN(MenuScrollViewContainer); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace views | 52 } // namespace views |
| 53 | 53 |
| 54 #endif // UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_ | 54 #endif // UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_ |
| OLD | NEW |