Index: ui/aura_shell/app_list/results_view.h |
diff --git a/ui/aura_shell/app_list/results_view.h b/ui/aura_shell/app_list/results_view.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..32573eae536e05b6c731ae9ce33f1001c90a4b15 |
--- /dev/null |
+++ b/ui/aura_shell/app_list/results_view.h |
@@ -0,0 +1,82 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ |
+#define UI_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ |
+#pragma once |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "ui/aura_shell/aura_shell_export.h" |
+#include "ui/base/models/list_model_observer.h" |
+#include "ui/views/controls/button/button.h" |
+#include "ui/views/view.h" |
+ |
+namespace views { |
+class BoundsAnimator; |
+} |
+ |
+namespace aura_shell { |
+ |
+class AppListModel; |
+class TilesPageView; |
+ |
+// 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.
|
+// 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
|
+// If there are more than one group, a button strip is displayed to allow |
+// user switching between pages. |
+class AURA_SHELL_EXPORT ResultsView : public views::View, |
+ public views::ButtonListener, |
+ public ui::ListModelObserver { |
+ public: |
+ explicit ResultsView(AppListModel* model); |
+ virtual ~ResultsView(); |
+ |
+ // Gets current focused tile. |
+ views::View* GetFocusedTile() const; |
+ |
+ private: |
+ // Updates from model. |
+ void Update(); |
+ |
+ // Adds a result group page. |
+ void AddPage(const std::string& title, TilesPageView* page); |
+ |
+ // Gets preferred number of tiles per row. |
+ int GetPreferredTilesPerRow() const; |
+ |
+ // Gets current result page. |
+ TilesPageView* GetCurrentPageView() const; |
+ |
+ // Sets current result page. |
+ void SetCurrentPage(int page); |
+ |
+ // Overridden from views::View: |
+ virtual void Layout() OVERRIDE; |
+ virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
+ |
+ // Overridden from views::ButtonListener: |
+ virtual void ButtonPressed(views::Button* sender, |
+ const views::Event& event) OVERRIDE; |
+ |
+ // Overridden from ListModelObserver: |
+ virtual void ListItemsAdded(int start, int count) OVERRIDE; |
+ virtual void ListItemsRemoved(int start, int count) OVERRIDE; |
+ virtual void ListItemsChanged(int start, int count) OVERRIDE; |
+ |
+ AppListModel* model_; // Owned by parent AppListView. |
+ |
+ std::vector<TilesPageView*> pages_; |
+ views::View* page_buttons_; |
+ int current_page_; |
+ |
+ scoped_ptr<views::BoundsAnimator> animator_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ResultsView); |
+}; |
+ |
+} // namespace aura_shell |
+ |
+#endif // UI_AURA_SHELL_APP_LIST_RESULTS_VIEW_H_ |