Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| 6 #define UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 6 #define UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
| 12 #include "ui/app_list/app_list_item.h" | 12 #include "ui/app_list/app_list_item.h" |
| 13 #include "ui/app_list/app_list_item_list_observer.h" | 13 #include "ui/app_list/app_list_item_list_observer.h" |
| 14 #include "ui/app_list/app_list_item_observer.h" | 14 #include "ui/app_list/app_list_item_observer.h" |
| 15 #include "ui/gfx/geometry/rect.h" | |
| 15 | 16 |
| 16 namespace app_list { | 17 namespace app_list { |
| 17 | 18 |
| 18 class AppListItemList; | 19 class AppListItemList; |
| 19 | 20 |
| 21 typedef std::vector<gfx::Rect> TopIconsBounds; | |
|
xiyuan
2014/01/16 01:46:48
nit: TopIconsBounds -> Rects
jennyz
2014/01/16 17:49:52
Done.
| |
| 22 | |
| 20 // AppListFolderItem implements the model/controller for folders. | 23 // AppListFolderItem implements the model/controller for folders. |
| 21 class APP_LIST_EXPORT AppListFolderItem : public AppListItem, | 24 class APP_LIST_EXPORT AppListFolderItem : public AppListItem, |
| 22 public AppListItemListObserver, | 25 public AppListItemListObserver, |
| 23 public AppListItemObserver { | 26 public AppListItemObserver { |
| 24 public: | 27 public: |
| 25 explicit AppListFolderItem(const std::string& id); | 28 explicit AppListFolderItem(const std::string& id); |
| 26 virtual ~AppListFolderItem(); | 29 virtual ~AppListFolderItem(); |
| 27 | 30 |
| 28 // Updates the folder's icon. | 31 // Updates the folder's icon. |
| 29 void UpdateIcon(); | 32 void UpdateIcon(); |
| 30 | 33 |
| 34 // Returns the icon of one of the top items with |item_index|. | |
| 35 const gfx::ImageSkia& GetTopIcon(size_t item_index); | |
| 36 | |
| 31 AppListItemList* item_list() { return item_list_.get(); } | 37 AppListItemList* item_list() { return item_list_.get(); } |
| 32 | 38 |
| 33 static const char kAppType[]; | 39 static const char kAppType[]; |
| 34 | 40 |
| 41 // Calculates the top item icons' bounds inside |folder_icon_bounds|. | |
| 42 // Returns the bounds of top item icons in sequence of top left, top right, | |
| 43 // bottom left, bottom right. | |
| 44 static TopIconsBounds GetTopIconsBounds(const gfx::Rect& folder_icon_bounds); | |
| 45 | |
| 35 private: | 46 private: |
| 36 // AppListItem | 47 // AppListItem |
| 37 virtual void Activate(int event_flags) OVERRIDE; | 48 virtual void Activate(int event_flags) OVERRIDE; |
| 38 virtual const char* GetAppType() const OVERRIDE; | 49 virtual const char* GetAppType() const OVERRIDE; |
| 39 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE; | 50 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE; |
| 40 | 51 |
| 41 // AppListItemObserver | 52 // AppListItemObserver |
| 42 virtual void ItemIconChanged() OVERRIDE; | 53 virtual void ItemIconChanged() OVERRIDE; |
| 43 virtual void ItemTitleChanged() OVERRIDE; | 54 virtual void ItemTitleChanged() OVERRIDE; |
| 44 virtual void ItemHighlightedChanged() OVERRIDE; | 55 virtual void ItemHighlightedChanged() OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 58 scoped_ptr<AppListItemList> item_list_; | 69 scoped_ptr<AppListItemList> item_list_; |
| 59 // Top items for generating folder icon. | 70 // Top items for generating folder icon. |
| 60 std::vector<AppListItem*> top_items_; | 71 std::vector<AppListItem*> top_items_; |
| 61 | 72 |
| 62 DISALLOW_COPY_AND_ASSIGN(AppListFolderItem); | 73 DISALLOW_COPY_AND_ASSIGN(AppListFolderItem); |
| 63 }; | 74 }; |
| 64 | 75 |
| 65 } // namespace app_list | 76 } // namespace app_list |
| 66 | 77 |
| 67 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 78 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| OLD | NEW |