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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 bool animate_target, | 284 bool animate_target, |
285 const gfx::Rect& target); | 285 const gfx::Rect& target); |
286 | 286 |
287 // Extracts drag location info from |event| into |drag_point|. | 287 // Extracts drag location info from |event| into |drag_point|. |
288 void ExtractDragLocation(const ui::LocatedEvent& event, | 288 void ExtractDragLocation(const ui::LocatedEvent& event, |
289 gfx::Point* drag_point); | 289 gfx::Point* drag_point); |
290 | 290 |
291 // Calculates |drop_target_| based on |drag_point|. |drag_point| is in the | 291 // Calculates |drop_target_| based on |drag_point|. |drag_point| is in the |
292 // grid view's coordinates. When |use_page_button_hovering| is true and | 292 // grid view's coordinates. When |use_page_button_hovering| is true and |
293 // |drag_point| is hovering on a page button, use the last slot on that page | 293 // |drag_point| is hovering on a page button, use the last slot on that page |
294 // as drop target. | 294 // as drop target. |
Matt Giuca
2014/09/12 01:13:28
Rewrite this comment now that |drop_target_| has b
calamity
2014/09/12 08:26:06
Done.
| |
295 void CalculateDropTarget(const gfx::Point& drag_point, | 295 void CalculateDropTarget(const gfx::Point& drag_point, |
296 bool use_page_button_hovering); | 296 bool use_page_button_hovering); |
297 | 297 |
298 // Same as CalculateDropTarget, but with folder UI enabled. The |drop_target_| | 298 // Same as CalculateDropTarget, but with folder UI enabled. The |drop_target_| |
299 // can be either a target for re-ordering, or a target folder to move the | 299 // can be either a target for re-ordering, or a target folder to move the |
300 // dragged item into if |drag_view_| enters its re-ordering or folder | 300 // dragged item into if |drag_view_| enters its re-ordering or folder |
301 // dropping circle. | 301 // dropping circle. |
Matt Giuca
2014/09/12 01:13:28
Ditto (and see my comments in this method's implem
calamity
2014/09/12 08:26:06
Done.
| |
302 void CalculateDropTargetWithFolderEnabled(const gfx::Point& drag_point, | 302 void CalculateDropTargetWithFolderEnabled(const gfx::Point& drag_point, |
303 bool use_page_button_hovering); | 303 bool use_page_button_hovering); |
304 | 304 |
305 // Prepares |drag_and_drop_host_| for dragging. |grid_location| contains | 305 // Prepares |drag_and_drop_host_| for dragging. |grid_location| contains |
306 // the drag point in this grid view's coordinates. | 306 // the drag point in this grid view's coordinates. |
307 void StartDragAndDropHostDrag(const gfx::Point& grid_location); | 307 void StartDragAndDropHostDrag(const gfx::Point& grid_location); |
308 | 308 |
309 // Dispatch the drag and drop update event to the dnd host (if needed). | 309 // Dispatch the drag and drop update event to the dnd host (if needed). |
310 void DispatchDragEventToDragAndDropHost( | 310 void DispatchDragEventToDragAndDropHost( |
311 const gfx::Point& location_in_screen_coordinates); | 311 const gfx::Point& location_in_screen_coordinates); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 // If |hide| is set the view will get hidden, otherwise it gets shown. | 383 // If |hide| is set the view will get hidden, otherwise it gets shown. |
384 void SetViewHidden(views::View* view, bool hide, bool immediate); | 384 void SetViewHidden(views::View* view, bool hide, bool immediate); |
385 | 385 |
386 // Whether the folder drag-and-drop UI should be enabled. | 386 // Whether the folder drag-and-drop UI should be enabled. |
387 bool EnableFolderDragDropUI(); | 387 bool EnableFolderDragDropUI(); |
388 | 388 |
389 // Whether target specified by |drap_target| can accept more items to be | 389 // Whether target specified by |drap_target| can accept more items to be |
390 // dropped into it. | 390 // dropped into it. |
391 bool CanDropIntoTarget(const Index& drop_target); | 391 bool CanDropIntoTarget(const Index& drop_target); |
392 | 392 |
393 // Returns the visual index of the nearest tile in which |drag_view_| enters | 393 // Calculates the visual index of the nearest tile for which |drag_view_| |
394 // either its re-ordering or folder dropping circle. | 394 // enters either its re-ordering or folder dropping circle. |
395 Index GetNearestTileForDragView(); | 395 void CalculateNearestTileForDragView(); |
396 | 396 |
397 // Calculates |nearest_tile| in which |vertex| of the |drag_view| is | 397 // Calculates |nearest_tile| in which |vertex| of the |drag_view| is |
398 // enclosed. | 398 // enclosed. |
399 // *|nearest_tile| and *|d_min| will be updated based on the calculation. | 399 // *|nearest_tile| and *|d_min| will be updated based on the calculation. |
400 // *|d_min| is the distance between |nearest_tile| and |drag_view_|. | 400 // *|d_min| is the distance between |nearest_tile| and |drag_view_|. |
401 void CalculateNearestTileForVertex( | 401 void CalculateNearestTileForVertex( |
402 const gfx::Point& vertex, Index* nearest_tile, int* d_min); | 402 const gfx::Point& vertex, Index* nearest_tile, int* d_min); |
403 | 403 |
404 // Returns the bounds of the tile in which |point| is enclosed if there | 404 // Returns the bounds of the tile in which |point| is enclosed if there |
405 // is a valid item sits on the tile. | 405 // is a valid item sits on the tile. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 #if defined(OS_WIN) | 506 #if defined(OS_WIN) |
507 // Created when a drag is started (ie: drag exceeds the drag threshold), but | 507 // Created when a drag is started (ie: drag exceeds the drag threshold), but |
508 // not Run() until supplied with a shortcut path. | 508 // not Run() until supplied with a shortcut path. |
509 scoped_refptr<SynchronousDrag> synchronous_drag_; | 509 scoped_refptr<SynchronousDrag> synchronous_drag_; |
510 | 510 |
511 // Whether to use SynchronousDrag to support dropping to task bar etc. | 511 // Whether to use SynchronousDrag to support dropping to task bar etc. |
512 bool use_synchronous_drag_; | 512 bool use_synchronous_drag_; |
513 #endif | 513 #endif |
514 | 514 |
515 Pointer drag_pointer_; | 515 Pointer drag_pointer_; |
516 Index drop_target_; | 516 |
517 // The most recent reorder drop target. | |
518 Index reorder_drop_target_; | |
519 | |
520 // The most recent folder drop target. | |
521 Index folder_drop_target_; | |
522 | |
523 // The current action that ending a drag will perform. | |
517 DropAttempt drop_attempt_; | 524 DropAttempt drop_attempt_; |
518 | 525 |
519 // Timer for re-ordering the |drop_target_| and |drag_view_|. | 526 // Timer for re-ordering the |drop_target_| and |drag_view_|. |
520 base::OneShotTimer<AppsGridView> reorder_timer_; | 527 base::OneShotTimer<AppsGridView> reorder_timer_; |
521 | 528 |
522 // Timer for dropping |drag_view_| into the folder containing | 529 // Timer for dropping |drag_view_| into the folder containing |
523 // the |drop_target_|. | 530 // the |drop_target_|. |
524 base::OneShotTimer<AppsGridView> folder_dropping_timer_; | 531 base::OneShotTimer<AppsGridView> folder_dropping_timer_; |
525 | 532 |
526 // Timer for dragging a folder item out of folder container ink bubble. | 533 // Timer for dragging a folder item out of folder container ink bubble. |
(...skipping 30 matching lines...) Expand all Loading... | |
557 | 564 |
558 // True if the drag_view_ item is a folder item being dragged for reparenting. | 565 // True if the drag_view_ item is a folder item being dragged for reparenting. |
559 bool dragging_for_reparent_item_; | 566 bool dragging_for_reparent_item_; |
560 | 567 |
561 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 568 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
562 }; | 569 }; |
563 | 570 |
564 } // namespace app_list | 571 } // namespace app_list |
565 | 572 |
566 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 573 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |