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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
11 | 11 |
12 namespace app_list { | 12 namespace app_list { |
13 | 13 |
14 class ContentsView; | 14 class ContentsView; |
15 | 15 |
16 // A view that contains buttons to switch the displayed view in the given | 16 // A view that contains buttons to switch the displayed view in the given |
17 // ContentsView. | 17 // ContentsView. |
18 class ContentsSwitcherView : public views::View, public views::ButtonListener { | 18 class ContentsSwitcherView : public views::View, public views::ButtonListener { |
19 public: | 19 public: |
20 explicit ContentsSwitcherView(ContentsView* contents_view); | 20 explicit ContentsSwitcherView(ContentsView* contents_view); |
21 virtual ~ContentsSwitcherView(); | 21 virtual ~ContentsSwitcherView(); |
22 | 22 |
| 23 ContentsView* contents_view() const { return contents_view_; } |
| 24 |
23 private: | 25 private: |
24 // Adds a switcher button using |resource_id| as the button's image and |tag| | 26 // Adds a switcher button using |resource_id| as the button's image and |tag| |
25 // as the button's id. | 27 // as the button's id. |
26 void AddSwitcherButton(int resource_id, int tag); | 28 void AddSwitcherButton(int resource_id, int tag); |
27 | 29 |
28 // Overridden from views::View: | 30 // Overridden from views::View: |
29 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 31 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
30 virtual void Layout() OVERRIDE; | 32 virtual void Layout() OVERRIDE; |
31 | 33 |
32 // Overridden from views::ButtonListener: | 34 // Overridden from views::ButtonListener: |
33 virtual void ButtonPressed(views::Button* sender, | 35 virtual void ButtonPressed(views::Button* sender, |
34 const ui::Event& event) OVERRIDE; | 36 const ui::Event& event) OVERRIDE; |
35 | 37 |
36 ContentsView* contents_view_; // Owned by views hierarchy. | 38 ContentsView* contents_view_; // Owned by views hierarchy. |
37 views::View* buttons_; // Owned by views hierarchy. | 39 views::View* buttons_; // Owned by views hierarchy. |
38 | 40 |
39 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); | 41 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); |
40 }; | 42 }; |
41 | 43 |
42 } // namespace app_list | 44 } // namespace app_list |
43 | 45 |
44 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 46 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
OLD | NEW |