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