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