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 <map>
9
10#include "base/basictypes.h"
11#include "ui/app_list/pagination_model_observer.h"
12#include "ui/views/controls/button/button.h"
13#include "ui/views/view.h"
14
15namespace app_list {
16
17class ContentsView;
18
19// A view that contains buttons to switch the displayed view in the given
20// ContentsView.
21class ContentsSwitcherView : public views::View,
22                             public views::ButtonListener,
23                             public PaginationModelObserver {
24 public:
25  explicit ContentsSwitcherView(ContentsView* contents_view);
26  virtual ~ContentsSwitcherView();
27
28  ContentsView* contents_view() const { return contents_view_; }
29
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.
32  void AddSwitcherButton(int resource_id, int page_index);
33
34 private:
35  // Overridden from views::ButtonListener:
36  virtual void ButtonPressed(views::Button* sender,
37                             const ui::Event& event) OVERRIDE;
38
39  // Overridden from PaginationModelObserver:
40  virtual void TotalPagesChanged() OVERRIDE;
41  virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
42  virtual void TransitionStarted() OVERRIDE;
43  virtual void TransitionChanged() OVERRIDE;
44
45  ContentsView* contents_view_;  // Owned by views hierarchy.
46
47  DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView);
48};
49
50}  // namespace app_list
51
52#endif  // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_
53