| 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_APP_LIST_PAGE_SWITCHER_H_ | 5 #ifndef UI_APP_LIST_PAGE_SWITCHER_H_ |
| 6 #define UI_APP_LIST_PAGE_SWITCHER_H_ | 6 #define UI_APP_LIST_PAGE_SWITCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "ui/app_list/pagination_model_observer.h" | 10 #include "ui/app_list/pagination_model_observer.h" |
| 11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace app_list { | 14 namespace app_list { |
| 15 | 15 |
| 16 class PaginationModel; | 16 class PaginationModel; |
| 17 | 17 |
| 18 // PageSwitcher represents its underlying PaginationModel with a button strip. | 18 // PageSwitcher represents its underlying PaginationModel with a button strip. |
| 19 // Each page in the PageinationModel has a button in the strip and when the | 19 // Each page in the PageinationModel has a button in the strip and when the |
| 20 // button is clicked, the corresponding page becomes selected. | 20 // button is clicked, the corresponding page becomes selected. |
| 21 class PageSwitcher : public views::View, | 21 class PageSwitcher : public views::View, |
| 22 public views::ButtonListener, | 22 public views::ButtonListener, |
| 23 public PaginationModelObserver { | 23 public PaginationModelObserver { |
| 24 public: | 24 public: |
| 25 explicit PageSwitcher(PaginationModel* model); | 25 explicit PageSwitcher(PaginationModel* model); |
| 26 virtual ~PageSwitcher(); | 26 virtual ~PageSwitcher(); |
| 27 | 27 |
| 28 private: | |
| 29 // Overridden from views::View: | 28 // Overridden from views::View: |
| 30 virtual gfx::Size GetPreferredSize() OVERRIDE; | 29 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 31 virtual void Layout() OVERRIDE; | 30 virtual void Layout() OVERRIDE; |
| 32 | 31 |
| 32 private: |
| 33 // Overridden from views::ButtonListener: | 33 // Overridden from views::ButtonListener: |
| 34 virtual void ButtonPressed(views::Button* sender, | 34 virtual void ButtonPressed(views::Button* sender, |
| 35 const views::Event& event) OVERRIDE; | 35 const views::Event& event) OVERRIDE; |
| 36 | 36 |
| 37 // Overridden from PaginationModelObserver: | 37 // Overridden from PaginationModelObserver: |
| 38 virtual void TotalPagesChanged() OVERRIDE; | 38 virtual void TotalPagesChanged() OVERRIDE; |
| 39 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; | 39 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; |
| 40 | 40 |
| 41 PaginationModel* model_; // Owned by parent AppListView. | 41 PaginationModel* model_; // Owned by parent AppListView. |
| 42 views::View* buttons_; // Owned by views hierarchy. | 42 views::View* buttons_; // Owned by views hierarchy. |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(PageSwitcher); | 44 DISALLOW_COPY_AND_ASSIGN(PageSwitcher); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace app_list | 47 } // namespace app_list |
| 48 | 48 |
| 49 #endif // UI_APP_LIST_PAGE_SWITCHER_H_ | 49 #endif // UI_APP_LIST_PAGE_SWITCHER_H_ |
| OLD | NEW |