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