Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / views / contents_switcher_view.h
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
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_
6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_
7
8 #include "base/basictypes.h"
9 #include "ui/app_list/pagination_model_observer.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/view.h"
12
13 namespace app_list {
14
15 class ContentsView;
16
17 // A view that contains buttons to switch the displayed view in the given
18 // ContentsView.
19 class ContentsSwitcherView : public views::View,
20                              public views::ButtonListener,
21                              public PaginationModelObserver {
22  public:
23   explicit ContentsSwitcherView(ContentsView* contents_view);
24   virtual ~ContentsSwitcherView();
25
26   ContentsView* contents_view() const { return contents_view_; }
27
28   // Adds a switcher button using |resource_id| as the button's image, which
29   // opens the page with index |page_index| in the ContentsView. |resource_id|
30   // is ignored if it is 0.
31   void AddSwitcherButton(int resource_id, int page_index);
32
33  private:
34   // Overridden from views::ButtonListener:
35   virtual void ButtonPressed(views::Button* sender,
36                              const ui::Event& event) OVERRIDE;
37
38   // Overridden from PaginationModelObserver:
39   virtual void TotalPagesChanged() OVERRIDE;
40   virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
41   virtual void TransitionStarted() OVERRIDE;
42   virtual void TransitionChanged() OVERRIDE;
43
44   ContentsView* contents_view_;  // Owned by views hierarchy.
45
46   // Stores Views owned by views hierarchy.
47   std::vector<views::View*> page_active_indicators_;
48
49   DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView);
50 };
51
52 }  // namespace app_list
53
54 #endif  // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_