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_TILES_PAGE_VIEW_H_ |
| 6 #define UI_AURA_SHELL_APP_LIST_TILES_PAGE_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ui/aura_shell/aura_shell_export.h" |
| 10 #include "ui/base/models/list_model_observer.h" |
| 11 #include "ui/views/view.h" |
| 12 |
| 13 namespace aura_shell { |
| 14 |
| 15 class AppListItemGroupModel; |
| 16 |
| 17 // TilesPageView displays its children tiles in a grid. |
| 18 class AURA_SHELL_EXPORT TilesPageView : public views::View, |
| 19 public ui::ListModelObserver { |
| 20 public: |
| 21 explicit TilesPageView(AppListItemGroupModel* model); |
| 22 virtual ~TilesPageView(); |
| 23 |
| 24 // Sets tiles per row. |
| 25 void SetTilesPerRow(int tiles_per_row); |
| 26 |
| 27 // Gets currently focused tile. |
| 28 views::View* GetFocusedTile(); |
| 29 |
| 30 // Updates tiles page when a tile gets focus. |
| 31 void UpdateFocusedTile(views::View* tile); |
| 32 |
| 33 private: |
| 34 // Updates from model. |
| 35 void Update(); |
| 36 |
| 37 // Sets focused tile by index. |
| 38 void SetFocusedTileByIndex(int index); |
| 39 |
| 40 // Overridden from views::View: |
| 41 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 42 |
| 43 // Overridden from ListModelObserver: |
| 44 virtual void ListItemsAdded(int start, int count) OVERRIDE; |
| 45 virtual void ListItemsRemoved(int start, int count) OVERRIDE; |
| 46 virtual void ListItemsChanged(int start, int count) OVERRIDE; |
| 47 |
| 48 AppListItemGroupModel* model_; |
| 49 |
| 50 // Tiles per row. |
| 51 int tiles_per_row_; |
| 52 |
| 53 // Index of focused tile view. |
| 54 int focused_index_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(TilesPageView); |
| 57 }; |
| 58 |
| 59 } // namespace aura_shell |
| 60 |
| 61 #endif // UI_AURA_SHELL_APP_LIST_TILES_PAGE_VIEW_H_ |
OLD | NEW |