| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 class ApplicationDragAndDropHost; | 45 class ApplicationDragAndDropHost; |
| 46 class AppListItemView; | 46 class AppListItemView; |
| 47 class AppsGridViewDelegate; | 47 class AppsGridViewDelegate; |
| 48 class PageSwitcher; | 48 class PageSwitcher; |
| 49 class PaginationModel; | 49 class PaginationModel; |
| 50 | 50 |
| 51 // AppsGridView displays a grid for AppListModel::Apps sub model. | 51 // AppsGridView displays a grid for AppListModel::Apps sub model. |
| 52 class APP_LIST_EXPORT AppsGridView : public views::View, | 52 class APP_LIST_EXPORT AppsGridView : public views::View, |
| 53 public views::ButtonListener, | 53 public views::ButtonListener, |
| 54 public ui::ListModelObserver, | |
| 55 public PaginationModelObserver, | 54 public PaginationModelObserver, |
| 56 public AppListModelObserver { | 55 public AppListModelObserver { |
| 57 public: | 56 public: |
| 58 enum Pointer { | 57 enum Pointer { |
| 59 NONE, | 58 NONE, |
| 60 MOUSE, | 59 MOUSE, |
| 61 TOUCH, | 60 TOUCH, |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 // Constructs the app icon grid view. |delegate| is the delegate of this | 63 // Constructs the app icon grid view. |delegate| is the delegate of this |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Updates from model. | 168 // Updates from model. |
| 170 void Update(); | 169 void Update(); |
| 171 | 170 |
| 172 // Updates page splits for item views. | 171 // Updates page splits for item views. |
| 173 void UpdatePaging(); | 172 void UpdatePaging(); |
| 174 | 173 |
| 175 // Updates the number of pulsing block views based on AppListModel status and | 174 // Updates the number of pulsing block views based on AppListModel status and |
| 176 // number of apps. | 175 // number of apps. |
| 177 void UpdatePulsingBlockViews(); | 176 void UpdatePulsingBlockViews(); |
| 178 | 177 |
| 179 views::View* CreateViewForItemAtIndex(size_t index); | 178 views::View* CreateViewForItemAtIndex(size_t page_idx, size_t item_idx); |
| 180 | 179 |
| 181 // Convert between the model index and the visual index. The model index | 180 // Convert between the model index and the visual index. The model index |
| 182 // is the index of the item in AppListModel. The visual index is the Index | 181 // is the index of the item in AppListModel. The visual index is the Index |
| 183 // struct above with page/slot info of where to display the item. | 182 // struct above with page/slot info of where to display the item. |
| 184 Index GetIndexFromModelIndex(int model_index) const; | 183 Index GetIndexFromModelIndex(int model_index) const; |
| 185 int GetModelIndexFromIndex(const Index& index) const; | 184 int GetModelIndexFromIndex(const Index& index) const; |
| 186 | 185 |
| 187 void SetSelectedItemByIndex(const Index& index); | 186 void SetSelectedItemByIndex(const Index& index); |
| 188 bool IsValidIndex(const Index& index) const; | 187 bool IsValidIndex(const Index& index) const; |
| 189 | 188 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // buffer area surrounding it. | 242 // buffer area surrounding it. |
| 244 bool IsPointWithinDragBuffer(const gfx::Point& point) const; | 243 bool IsPointWithinDragBuffer(const gfx::Point& point) const; |
| 245 | 244 |
| 246 // Handles start page layout and transition animation. | 245 // Handles start page layout and transition animation. |
| 247 void LayoutStartPage(); | 246 void LayoutStartPage(); |
| 248 | 247 |
| 249 // Overridden from views::ButtonListener: | 248 // Overridden from views::ButtonListener: |
| 250 virtual void ButtonPressed(views::Button* sender, | 249 virtual void ButtonPressed(views::Button* sender, |
| 251 const ui::Event& event) OVERRIDE; | 250 const ui::Event& event) OVERRIDE; |
| 252 | 251 |
| 253 // Overridden from ListModelObserver: | |
| 254 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; | |
| 255 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; | |
| 256 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; | |
| 257 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; | |
| 258 | |
| 259 // Overridden from PaginationModelObserver: | 252 // Overridden from PaginationModelObserver: |
| 260 virtual void TotalPagesChanged() OVERRIDE; | 253 virtual void TotalPagesChanged() OVERRIDE; |
| 261 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; | 254 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; |
| 262 virtual void TransitionStarted() OVERRIDE; | 255 virtual void TransitionStarted() OVERRIDE; |
| 263 virtual void TransitionChanged() OVERRIDE; | 256 virtual void TransitionChanged() OVERRIDE; |
| 264 | 257 |
| 265 // Overridden from AppListModelObserver: | 258 // Overridden from AppListModelObserver: |
| 266 virtual void OnAppListModelStatusChanged() OVERRIDE; | 259 virtual void OnAppListModelStatusChanged() OVERRIDE; |
| 260 virtual void OnListItemsAdded(size_t page_index, |
| 261 size_t start, size_t count) OVERRIDE; |
| 262 virtual void OnListItemsRemoved(size_t page_index, |
| 263 size_t start, size_t count) OVERRIDE; |
| 264 virtual void OnListItemMoved(size_t page_index, |
| 265 size_t index, size_t target_index) OVERRIDE; |
| 267 | 266 |
| 268 // Hide a given view temporarily without losing (mouse) events and / or | 267 // Hide a given view temporarily without losing (mouse) events and / or |
| 269 // changing the size of it. If |immediate| is set the change will be | 268 // changing the size of it. If |immediate| is set the change will be |
| 270 // immediately applied - otherwise it will change gradually. | 269 // immediately applied - otherwise it will change gradually. |
| 271 // If |hide| is set the view will get hidden, otherwise it gets shown. | 270 // If |hide| is set the view will get hidden, otherwise it gets shown. |
| 272 void SetViewHidden(views::View* view, bool hide, bool immediate); | 271 void SetViewHidden(views::View* view, bool hide, bool immediate); |
| 273 | 272 |
| 274 AppListModel* model_; // Owned by AppListView. | 273 AppListModel* model_; // Owned by AppListView. |
| 275 AppsGridViewDelegate* delegate_; | 274 AppsGridViewDelegate* delegate_; |
| 276 PaginationModel* pagination_model_; // Owned by AppListController. | 275 PaginationModel* pagination_model_; // Owned by AppListController. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 int page_flip_delay_in_ms_; | 332 int page_flip_delay_in_ms_; |
| 334 | 333 |
| 335 views::BoundsAnimator bounds_animator_; | 334 views::BoundsAnimator bounds_animator_; |
| 336 | 335 |
| 337 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 336 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
| 338 }; | 337 }; |
| 339 | 338 |
| 340 } // namespace app_list | 339 } // namespace app_list |
| 341 | 340 |
| 342 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 341 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| OLD | NEW |