OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_APP_LIST_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 virtual ~AppListItemView(); | 41 virtual ~AppListItemView(); |
42 | 42 |
43 void SetIconSize(const gfx::Size& size); | 43 void SetIconSize(const gfx::Size& size); |
44 | 44 |
45 void Prerender(); | 45 void Prerender(); |
46 | 46 |
47 AppListItemModel* model() const { return model_; } | 47 AppListItemModel* model() const { return model_; } |
48 | 48 |
49 const views::Label* title() const { return title_; } | 49 const views::Label* title() const { return title_; } |
50 | 50 |
| 51 gfx::ImageSkia GetDragImage(); |
| 52 |
51 private: | 53 private: |
52 enum UIState { | 54 enum UIState { |
53 UI_STATE_NORMAL, // Normal UI (icon + label) | 55 UI_STATE_NORMAL, // Normal UI (icon + label) |
54 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) | 56 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) |
55 }; | 57 }; |
56 | 58 |
57 // Get icon from model and schedule background processing. | 59 // Get icon from model and schedule background processing. |
58 void UpdateIcon(); | 60 void UpdateIcon(); |
59 | 61 |
60 void SetUIState(UIState state); | 62 void SetUIState(UIState state); |
(...skipping 23 matching lines...) Expand all Loading... |
84 ui::MenuSourceType source_type) OVERRIDE; | 86 ui::MenuSourceType source_type) OVERRIDE; |
85 | 87 |
86 // views::CustomButton overrides: | 88 // views::CustomButton overrides: |
87 virtual void StateChanged() OVERRIDE; | 89 virtual void StateChanged() OVERRIDE; |
88 virtual bool ShouldEnterPushedState(const ui::Event& event) OVERRIDE; | 90 virtual bool ShouldEnterPushedState(const ui::Event& event) OVERRIDE; |
89 | 91 |
90 // views::View overrides: | 92 // views::View overrides: |
91 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 93 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
92 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 94 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
93 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 95 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
94 virtual void OnMouseCaptureLost() OVERRIDE; | |
95 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 96 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
96 | 97 |
97 // ui::EventHandler overrides: | 98 // ui::EventHandler overrides: |
98 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 99 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
99 | 100 |
100 AppListItemModel* model_; // Owned by AppListModel::Apps. | 101 AppListItemModel* model_; // Owned by AppListModel::Apps. |
101 | 102 |
102 AppsGridView* apps_grid_view_; // Owned by views hierarchy. | 103 AppsGridView* apps_grid_view_; // Owned by views hierarchy. |
103 views::ImageView* icon_; // Owned by views hierarchy. | 104 views::ImageView* icon_; // Owned by views hierarchy. |
104 CachedLabel* title_; // Owned by views hierarchy. | 105 CachedLabel* title_; // Owned by views hierarchy. |
(...skipping 10 matching lines...) Expand all Loading... |
115 | 116 |
116 // A timer to defer showing drag UI when mouse is pressed. | 117 // A timer to defer showing drag UI when mouse is pressed. |
117 base::OneShotTimer<AppListItemView> mouse_drag_timer_; | 118 base::OneShotTimer<AppListItemView> mouse_drag_timer_; |
118 | 119 |
119 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 120 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
120 }; | 121 }; |
121 | 122 |
122 } // namespace app_list | 123 } // namespace app_list |
123 | 124 |
124 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 125 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
OLD | NEW |