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.
5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_
6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_
8 #include "base/basictypes.h"
9 #include "ui/views/controls/button/button.h"
10 #include "ui/views/view.h"
16 // A view that contains buttons to switch the displayed view in the given
18 class ContentsSwitcherView
: public views::View
, public views::ButtonListener
{
20 explicit ContentsSwitcherView(ContentsView
* contents_view
);
21 virtual ~ContentsSwitcherView();
23 ContentsView
* contents_view() const { return contents_view_
; }
25 // Adds a switcher button using |resource_id| as the button's image, which
26 // opens the page with index |page_index| in the ContentsView. |resource_id|
27 // is ignored if it is 0.
28 void AddSwitcherButton(int resource_id
, int page_index
);
31 // Overridden from views::View:
32 virtual gfx::Size
GetPreferredSize() const OVERRIDE
;
33 virtual void Layout() OVERRIDE
;
35 // Overridden from views::ButtonListener:
36 virtual void ButtonPressed(views::Button
* sender
,
37 const ui::Event
& event
) OVERRIDE
;
39 ContentsView
* contents_view_
; // Owned by views hierarchy.
40 views::View
* buttons_
; // Owned by views hierarchy.
42 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView
);
45 } // namespace app_list
47 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_