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_APP_LIST_ITEM_VIEW_H_ | |
6 #define UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include "ui/aura_shell/app_list/app_list_item_model_observer.h" | |
10 #include "ui/aura_shell/aura_shell_export.h" | |
11 #include "ui/views/view.h" | |
12 | |
13 class SkBitmap; | |
14 | |
15 namespace views { | |
16 class ImageView; | |
17 class Label; | |
18 } | |
19 | |
20 namespace aura_shell { | |
21 | |
22 class AppListItemModel; | |
23 class AppListItemViewListener; | |
24 | |
25 class AURA_SHELL_EXPORT AppListItemView : public views::View, | |
26 public AppListItemModelObserver { | |
27 public: | |
28 AppListItemView(AppListItemModel* model, | |
29 AppListItemViewListener* listener); | |
30 virtual ~AppListItemView(); | |
31 | |
32 AppListItemModel* model() const { | |
33 return model_; | |
34 } | |
35 | |
36 // Tile size | |
37 static const int kTileSize = 180; | |
38 | |
39 // Preferred icon size. | |
40 static const int kIconSize = 128; | |
41 | |
42 protected: | |
43 // Notifies listener when activated. | |
44 void NotifyActivated(int event_flags); | |
45 | |
46 // AppListItemModelObserver overrides: | |
47 virtual void ItemIconChanged() OVERRIDE; | |
48 virtual void ItemTitleChanged() OVERRIDE; | |
49 | |
50 // views::View overrides: | |
51 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
52 virtual void Layout() OVERRIDE; | |
53 virtual void OnFocus() OVERRIDE; | |
54 virtual void OnBlur() OVERRIDE; | |
55 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | |
56 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | |
57 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | |
58 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | |
59 | |
60 private: | |
61 AppListItemModel* model_; | |
62 AppListItemViewListener* listener_; | |
63 | |
64 views::ImageView* icon_; | |
65 views::Label* title_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | |
68 }; | |
69 | |
70 } // namespace aura_shell | |
71 | |
72 #endif // UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_VIEW_H_ | |
OLD | NEW |