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_APPS_GRID_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" |
15 #include "ui/app_list/app_list_model.h" | 15 #include "ui/app_list/app_list_model.h" |
16 #include "ui/app_list/app_list_model_observer.h" | 16 #include "ui/app_list/app_list_model_observer.h" |
17 #include "ui/app_list/pagination_model_observer.h" | 17 #include "ui/app_list/pagination_model_observer.h" |
| 18 #include "ui/base/dragdrop/os_exchange_data.h" |
18 #include "ui/base/models/list_model_observer.h" | 19 #include "ui/base/models/list_model_observer.h" |
19 #include "ui/compositor/layer_animation_observer.h" | 20 #include "ui/compositor/layer_animation_observer.h" |
20 #include "ui/gfx/image/image_skia_operations.h" | 21 #include "ui/gfx/image/image_skia_operations.h" |
21 #include "ui/views/animation/bounds_animator.h" | 22 #include "ui/views/animation/bounds_animator.h" |
22 #include "ui/views/controls/button/button.h" | 23 #include "ui/views/controls/button/button.h" |
23 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
24 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
25 #include "ui/views/view_model.h" | 26 #include "ui/views/view_model.h" |
26 | 27 |
27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 public PaginationModelObserver, | 63 public PaginationModelObserver, |
63 public AppListModelObserver, | 64 public AppListModelObserver, |
64 public ui::ImplicitAnimationObserver { | 65 public ui::ImplicitAnimationObserver { |
65 public: | 66 public: |
66 enum Pointer { | 67 enum Pointer { |
67 NONE, | 68 NONE, |
68 MOUSE, | 69 MOUSE, |
69 TOUCH, | 70 TOUCH, |
70 }; | 71 }; |
71 | 72 |
| 73 static const char kViewClassName[]; |
| 74 |
72 // Constructs the app icon grid view. |delegate| is the delegate of this | 75 // Constructs the app icon grid view. |delegate| is the delegate of this |
73 // view, which usually is the hosting AppListView. |pagination_model| is | 76 // view, which usually is the hosting AppListView. |pagination_model| is |
74 // the paging info shared within the launcher UI. | 77 // the paging info shared within the launcher UI. |
75 AppsGridView(AppsGridViewDelegate* delegate, | 78 AppsGridView(AppsGridViewDelegate* delegate, |
76 PaginationModel* pagination_model); | 79 PaginationModel* pagination_model); |
77 virtual ~AppsGridView(); | 80 virtual ~AppsGridView(); |
78 | 81 |
79 // Sets fixed layout parameters. After setting this, CalculateLayout below | 82 // Sets fixed layout parameters. After setting this, CalculateLayout below |
80 // is no longer called to dynamically choosing those layout params. | 83 // is no longer called to dynamically choosing those layout params. |
81 void SetLayout(int icon_size, int cols, int rows_per_page); | 84 void SetLayout(int icon_size, int cols, int rows_per_page); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void SetDragAndDropHostOfCurrentAppList( | 128 void SetDragAndDropHostOfCurrentAppList( |
126 ApplicationDragAndDropHost* drag_and_drop_host); | 129 ApplicationDragAndDropHost* drag_and_drop_host); |
127 | 130 |
128 // Prerenders the icons on and around |page_index|. | 131 // Prerenders the icons on and around |page_index|. |
129 void Prerender(int page_index); | 132 void Prerender(int page_index); |
130 | 133 |
131 bool has_dragged_view() const { return drag_view_ != NULL; } | 134 bool has_dragged_view() const { return drag_view_ != NULL; } |
132 bool dragging() const { return drag_pointer_ != NONE; } | 135 bool dragging() const { return drag_pointer_ != NONE; } |
133 | 136 |
134 // Overridden from views::View: | 137 // Overridden from views::View: |
| 138 virtual const char* GetClassName() const OVERRIDE; |
135 virtual gfx::Size GetPreferredSize() OVERRIDE; | 139 virtual gfx::Size GetPreferredSize() OVERRIDE; |
136 virtual void Layout() OVERRIDE; | 140 virtual void Layout() OVERRIDE; |
137 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 141 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
138 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 142 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
139 virtual void ViewHierarchyChanged( | 143 virtual void ViewHierarchyChanged( |
140 const ViewHierarchyChangedDetails& details) OVERRIDE; | 144 const ViewHierarchyChangedDetails& details) OVERRIDE; |
141 virtual bool GetDropFormats( | 145 virtual bool GetDropFormats( |
142 int* formats, | 146 int* formats, |
143 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 147 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
144 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; | 148 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; |
145 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 149 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
146 | 150 |
147 // Stops the timer that triggers a page flip during a drag. | 151 // Stops the timer that triggers a page flip during a drag. |
148 void StopPageFlipTimer(); | 152 void StopPageFlipTimer(); |
149 | 153 |
150 // Returns the item view of the item at |index|. | 154 // Returns the item view of the item at |index|. |
151 AppListItemView* GetItemViewAt(int index) const; | 155 AppListItemView* GetItemViewAt(int index) const; |
152 | 156 |
153 // Show or hide the top item views. | 157 // Show or hide the top item views. |
154 void SetTopItemViewsVisible(bool visible); | 158 void SetTopItemViewsVisible(bool visible); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 bool dragging_for_reparent_item_; | 539 bool dragging_for_reparent_item_; |
536 | 540 |
537 base::WeakPtrFactory<AppsGridView> weak_factory_; | 541 base::WeakPtrFactory<AppsGridView> weak_factory_; |
538 | 542 |
539 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 543 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
540 }; | 544 }; |
541 | 545 |
542 } // namespace app_list | 546 } // namespace app_list |
543 | 547 |
544 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 548 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |