Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: ui/app_list/page_switcher.h

Issue 11784034: Skeleton for app_list on OSX, and refactoring for enable_app_list=1 on OS=="mac". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for 175876 and 175961 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/contents_view.cc ('k') | ui/app_list/page_switcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_PAGE_SWITCHER_H_
6 #define UI_APP_LIST_PAGE_SWITCHER_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 PaginationModel;
16
17 // PageSwitcher represents its underlying PaginationModel with a button strip.
18 // Each page in the PageinationModel has a button in the strip and when the
19 // button is clicked, the corresponding page becomes selected.
20 class PageSwitcher : public views::View,
21 public views::ButtonListener,
22 public PaginationModelObserver {
23 public:
24 explicit PageSwitcher(PaginationModel* model);
25 virtual ~PageSwitcher();
26
27 // Returns the page index of the page switcher button under the point. If no
28 // page switcher button is under the point, -1 is return. |point| is in
29 // PageSwitcher's coordinates.
30 int GetPageForPoint(const gfx::Point& point) const;
31
32 // Shows hover for button under the point. |point| is in PageSwitcher's
33 // coordinates.
34 void UpdateUIForDragPoint(const gfx::Point& point);
35
36 // Overridden from views::View:
37 virtual gfx::Size GetPreferredSize() OVERRIDE;
38 virtual void Layout() OVERRIDE;
39
40 private:
41 void CalculateButtonWidthAndSpacing(int contents_width);
42
43 // Overridden from views::ButtonListener:
44 virtual void ButtonPressed(views::Button* sender,
45 const ui::Event& event) OVERRIDE;
46
47 // Overridden from PaginationModelObserver:
48 virtual void TotalPagesChanged() OVERRIDE;
49 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
50 virtual void TransitionChanged() OVERRIDE;
51
52 PaginationModel* model_; // Owned by parent AppListView.
53 views::View* buttons_; // Owned by views hierarchy.
54
55 DISALLOW_COPY_AND_ASSIGN(PageSwitcher);
56 };
57
58 } // namespace app_list
59
60 #endif // UI_APP_LIST_PAGE_SWITCHER_H_
OLDNEW
« no previous file with comments | « ui/app_list/contents_view.cc ('k') | ui/app_list/page_switcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698