OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ui/app_list/pagination_model_observer.h" | 11 #include "ui/app_list/pagination_model_observer.h" |
12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
14 | 14 |
15 namespace app_list { | 15 namespace app_list { |
16 | 16 |
17 class ContentsView; | 17 class ContentsView; |
18 | 18 |
19 // A view that contains buttons to switch the displayed view in the given | 19 // A view that contains buttons to switch the displayed view in the given |
20 // ContentsView. | 20 // ContentsView. |
21 class ContentsSwitcherView : public views::View, | 21 class ContentsSwitcherView : public views::View, |
22 public views::ButtonListener, | 22 public views::ButtonListener, |
23 public PaginationModelObserver { | 23 public PaginationModelObserver { |
24 public: | 24 public: |
25 explicit ContentsSwitcherView(ContentsView* contents_view); | 25 explicit ContentsSwitcherView(ContentsView* contents_view); |
26 virtual ~ContentsSwitcherView(); | 26 ~ContentsSwitcherView() override; |
27 | 27 |
28 ContentsView* contents_view() const { return contents_view_; } | 28 ContentsView* contents_view() const { return contents_view_; } |
29 | 29 |
30 // Adds a switcher button using |resource_id| as the button's image, which | 30 // Adds a switcher button using |resource_id| as the button's image, which |
31 // opens the page with index |page_index| in the ContentsView. | 31 // opens the page with index |page_index| in the ContentsView. |
32 void AddSwitcherButton(int resource_id, int page_index); | 32 void AddSwitcherButton(int resource_id, int page_index); |
33 | 33 |
34 private: | 34 private: |
35 // Overridden from views::ButtonListener: | 35 // Overridden from views::ButtonListener: |
36 virtual void ButtonPressed(views::Button* sender, | 36 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
37 const ui::Event& event) override; | |
38 | 37 |
39 // Overridden from PaginationModelObserver: | 38 // Overridden from PaginationModelObserver: |
40 virtual void TotalPagesChanged() override; | 39 void TotalPagesChanged() override; |
41 virtual void SelectedPageChanged(int old_selected, int new_selected) override; | 40 void SelectedPageChanged(int old_selected, int new_selected) override; |
42 virtual void TransitionStarted() override; | 41 void TransitionStarted() override; |
43 virtual void TransitionChanged() override; | 42 void TransitionChanged() override; |
44 | 43 |
45 ContentsView* contents_view_; // Owned by views hierarchy. | 44 ContentsView* contents_view_; // Owned by views hierarchy. |
46 | 45 |
47 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); | 46 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); |
48 }; | 47 }; |
49 | 48 |
50 } // namespace app_list | 49 } // namespace app_list |
51 | 50 |
52 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 51 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
OLD | NEW |