Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ | |
| 6 #define UI_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "ui/aura_shell/aura_shell_export.h" | |
| 13 #include "ui/base/models/list_model_observer.h" | |
| 14 #include "ui/views/controls/button/button.h" | |
| 15 #include "ui/views/view.h" | |
| 16 | |
| 17 namespace views { | |
| 18 class BoundsAnimator; | |
| 19 } | |
| 20 | |
| 21 namespace aura_shell { | |
| 22 | |
| 23 class AppListModel; | |
| 24 class TilesPageView; | |
| 25 | |
| 26 // ResultView displays UI for AppListModel. Each group is displayed in a | |
|
sky
2011/12/14 16:51:33
displays the UI for an
xiyuan
2011/12/20 00:14:42
Done.
| |
| 27 // page (TilesPageView) and each item is displayed in a tile (TileView). | |
|
sky
2011/12/14 16:51:33
It would be nice if these names matched your model
xiyuan
2011/12/20 00:14:42
Done.
ResultsView -> AppListGroupsView
TilesPageV
| |
| 28 // If there are more than one group, a button strip is displayed to allow | |
| 29 // user switching between pages. | |
| 30 class AURA_SHELL_EXPORT ResultsView : public views::View, | |
| 31 public views::ButtonListener, | |
| 32 public ui::ListModelObserver { | |
| 33 public: | |
| 34 explicit ResultsView(AppListModel* model); | |
| 35 virtual ~ResultsView(); | |
| 36 | |
| 37 // Gets current focused tile. | |
| 38 views::View* GetFocusedTile() const; | |
| 39 | |
| 40 private: | |
| 41 // Updates from model. | |
| 42 void Update(); | |
| 43 | |
| 44 // Adds a result group page. | |
| 45 void AddPage(const std::string& title, TilesPageView* page); | |
| 46 | |
| 47 // Gets preferred number of tiles per row. | |
| 48 int GetPreferredTilesPerRow() const; | |
| 49 | |
| 50 // Gets current result page. | |
| 51 TilesPageView* GetCurrentPageView() const; | |
| 52 | |
| 53 // Sets current result page. | |
| 54 void SetCurrentPage(int page); | |
| 55 | |
| 56 // Overridden from views::View: | |
| 57 virtual void Layout() OVERRIDE; | |
| 58 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | |
| 59 | |
| 60 // Overridden from views::ButtonListener: | |
| 61 virtual void ButtonPressed(views::Button* sender, | |
| 62 const views::Event& event) OVERRIDE; | |
| 63 | |
| 64 // Overridden from ListModelObserver: | |
| 65 virtual void ListItemsAdded(int start, int count) OVERRIDE; | |
| 66 virtual void ListItemsRemoved(int start, int count) OVERRIDE; | |
| 67 virtual void ListItemsChanged(int start, int count) OVERRIDE; | |
| 68 | |
| 69 AppListModel* model_; // Owned by parent AppListView. | |
| 70 | |
| 71 std::vector<TilesPageView*> pages_; | |
| 72 views::View* page_buttons_; | |
| 73 int current_page_; | |
| 74 | |
| 75 scoped_ptr<views::BoundsAnimator> animator_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(ResultsView); | |
| 78 }; | |
| 79 | |
| 80 } // namespace aura_shell | |
| 81 | |
| 82 #endif // UI_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ | |
| OLD | NEW |