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 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 public: | 63 public: |
64 enum Pointer { | 64 enum Pointer { |
65 NONE, | 65 NONE, |
66 MOUSE, | 66 MOUSE, |
67 TOUCH, | 67 TOUCH, |
68 }; | 68 }; |
69 | 69 |
70 // Constructs the app icon grid view. |delegate| is the delegate of this | 70 // Constructs the app icon grid view. |delegate| is the delegate of this |
71 // view, which usually is the hosting AppListView. | 71 // view, which usually is the hosting AppListView. |
72 explicit AppsGridView(AppsGridViewDelegate* delegate); | 72 explicit AppsGridView(AppsGridViewDelegate* delegate); |
73 virtual ~AppsGridView(); | 73 ~AppsGridView() override; |
74 | 74 |
75 // Sets fixed layout parameters. After setting this, CalculateLayout below | 75 // Sets fixed layout parameters. After setting this, CalculateLayout below |
76 // is no longer called to dynamically choosing those layout params. | 76 // is no longer called to dynamically choosing those layout params. |
77 void SetLayout(int cols, int rows_per_page); | 77 void SetLayout(int cols, int rows_per_page); |
78 | 78 |
79 int cols() const { return cols_; } | 79 int cols() const { return cols_; } |
80 int rows_per_page() const { return rows_per_page_; } | 80 int rows_per_page() const { return rows_per_page_; } |
81 | 81 |
82 // This resets the grid view to a fresh state for showing the app list. | 82 // This resets the grid view to a fresh state for showing the app list. |
83 void ResetForShowApps(); | 83 void ResetForShowApps(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Return true if the |bounds_animator_| is animating |view|. | 120 // Return true if the |bounds_animator_| is animating |view|. |
121 bool IsAnimatingView(AppListItemView* view); | 121 bool IsAnimatingView(AppListItemView* view); |
122 | 122 |
123 bool has_dragged_view() const { return drag_view_ != NULL; } | 123 bool has_dragged_view() const { return drag_view_ != NULL; } |
124 bool dragging() const { return drag_pointer_ != NONE; } | 124 bool dragging() const { return drag_pointer_ != NONE; } |
125 | 125 |
126 // Gets the PaginationModel used for the grid view. | 126 // Gets the PaginationModel used for the grid view. |
127 PaginationModel* pagination_model() { return &pagination_model_; } | 127 PaginationModel* pagination_model() { return &pagination_model_; } |
128 | 128 |
129 // Overridden from views::View: | 129 // Overridden from views::View: |
130 virtual gfx::Size GetPreferredSize() const override; | 130 gfx::Size GetPreferredSize() const override; |
131 virtual void Layout() override; | 131 void Layout() override; |
132 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 132 bool OnKeyPressed(const ui::KeyEvent& event) override; |
133 virtual bool OnKeyReleased(const ui::KeyEvent& event) override; | 133 bool OnKeyReleased(const ui::KeyEvent& event) override; |
134 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 134 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
135 virtual void ViewHierarchyChanged( | 135 void ViewHierarchyChanged( |
136 const ViewHierarchyChangedDetails& details) override; | 136 const ViewHierarchyChangedDetails& details) override; |
137 virtual bool GetDropFormats( | 137 bool GetDropFormats( |
138 int* formats, | 138 int* formats, |
139 std::set<OSExchangeData::CustomFormat>* custom_formats) override; | 139 std::set<OSExchangeData::CustomFormat>* custom_formats) override; |
140 virtual bool CanDrop(const OSExchangeData& data) override; | 140 bool CanDrop(const OSExchangeData& data) override; |
141 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; | 141 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
142 | 142 |
143 // Overridden from ui::EventHandler: | 143 // Overridden from ui::EventHandler: |
144 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 144 void OnGestureEvent(ui::GestureEvent* event) override; |
145 virtual void OnScrollEvent(ui::ScrollEvent* event) override; | 145 void OnScrollEvent(ui::ScrollEvent* event) override; |
146 | 146 |
147 // Stops the timer that triggers a page flip during a drag. | 147 // Stops the timer that triggers a page flip during a drag. |
148 void StopPageFlipTimer(); | 148 void StopPageFlipTimer(); |
149 | 149 |
150 // Returns the item view of the item at |index|. | 150 // Returns the item view of the item at |index|. |
151 AppListItemView* GetItemViewAt(int index) const; | 151 AppListItemView* GetItemViewAt(int index) const; |
152 | 152 |
153 // Show or hide the top item views. | 153 // Show or hide the top item views. |
154 void SetTopItemViewsVisible(bool visible); | 154 void SetTopItemViewsVisible(bool visible); |
155 | 155 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 void CancelContextMenusOnCurrentPage(); | 361 void CancelContextMenusOnCurrentPage(); |
362 | 362 |
363 // Removes the AppListItemView at |index| in |view_model_| and deletes it. | 363 // Removes the AppListItemView at |index| in |view_model_| and deletes it. |
364 void DeleteItemViewAtIndex(int index); | 364 void DeleteItemViewAtIndex(int index); |
365 | 365 |
366 // Returns true if |point| lies within the bounds of this grid view plus a | 366 // Returns true if |point| lies within the bounds of this grid view plus a |
367 // buffer area surrounding it. | 367 // buffer area surrounding it. |
368 bool IsPointWithinDragBuffer(const gfx::Point& point) const; | 368 bool IsPointWithinDragBuffer(const gfx::Point& point) const; |
369 | 369 |
370 // Overridden from views::ButtonListener: | 370 // Overridden from views::ButtonListener: |
371 virtual void ButtonPressed(views::Button* sender, | 371 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
372 const ui::Event& event) override; | |
373 | 372 |
374 // Overridden from AppListItemListObserver: | 373 // Overridden from AppListItemListObserver: |
375 virtual void OnListItemAdded(size_t index, AppListItem* item) override; | 374 void OnListItemAdded(size_t index, AppListItem* item) override; |
376 virtual void OnListItemRemoved(size_t index, AppListItem* item) override; | 375 void OnListItemRemoved(size_t index, AppListItem* item) override; |
377 virtual void OnListItemMoved(size_t from_index, | 376 void OnListItemMoved(size_t from_index, |
378 size_t to_index, | 377 size_t to_index, |
379 AppListItem* item) override; | 378 AppListItem* item) override; |
380 virtual void OnAppListItemHighlight(size_t index, bool highlight) override; | 379 void OnAppListItemHighlight(size_t index, bool highlight) override; |
381 | 380 |
382 // Overridden from PaginationModelObserver: | 381 // Overridden from PaginationModelObserver: |
383 virtual void TotalPagesChanged() override; | 382 void TotalPagesChanged() override; |
384 virtual void SelectedPageChanged(int old_selected, int new_selected) override; | 383 void SelectedPageChanged(int old_selected, int new_selected) override; |
385 virtual void TransitionStarted() override; | 384 void TransitionStarted() override; |
386 virtual void TransitionChanged() override; | 385 void TransitionChanged() override; |
387 | 386 |
388 // Overridden from AppListModelObserver: | 387 // Overridden from AppListModelObserver: |
389 virtual void OnAppListModelStatusChanged() override; | 388 void OnAppListModelStatusChanged() override; |
390 | 389 |
391 // ui::ImplicitAnimationObserver overrides: | 390 // ui::ImplicitAnimationObserver overrides: |
392 virtual void OnImplicitAnimationsCompleted() override; | 391 void OnImplicitAnimationsCompleted() override; |
393 | 392 |
394 // Hide a given view temporarily without losing (mouse) events and / or | 393 // Hide a given view temporarily without losing (mouse) events and / or |
395 // changing the size of it. If |immediate| is set the change will be | 394 // changing the size of it. If |immediate| is set the change will be |
396 // immediately applied - otherwise it will change gradually. | 395 // immediately applied - otherwise it will change gradually. |
397 // If |hide| is set the view will get hidden, otherwise it gets shown. | 396 // If |hide| is set the view will get hidden, otherwise it gets shown. |
398 void SetViewHidden(AppListItemView* view, bool hide, bool immediate); | 397 void SetViewHidden(AppListItemView* view, bool hide, bool immediate); |
399 | 398 |
400 // Whether the folder drag-and-drop UI should be enabled. | 399 // Whether the folder drag-and-drop UI should be enabled. |
401 bool EnableFolderDragDropUI(); | 400 bool EnableFolderDragDropUI(); |
402 | 401 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 566 |
568 // True if the drag_view_ item is a folder item being dragged for reparenting. | 567 // True if the drag_view_ item is a folder item being dragged for reparenting. |
569 bool dragging_for_reparent_item_; | 568 bool dragging_for_reparent_item_; |
570 | 569 |
571 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 570 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
572 }; | 571 }; |
573 | 572 |
574 } // namespace app_list | 573 } // namespace app_list |
575 | 574 |
576 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 575 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |