| 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_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
| 6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 // Convert a point from the coordinate system of one View to another. | 443 // Convert a point from the coordinate system of one View to another. |
| 444 // | 444 // |
| 445 // |source| and |target| must be in the same widget, but doesn't need to be in | 445 // |source| and |target| must be in the same widget, but doesn't need to be in |
| 446 // the same view hierarchy. | 446 // the same view hierarchy. |
| 447 // |source| can be NULL in which case it means the screen coordinate system. | 447 // |source| can be NULL in which case it means the screen coordinate system. |
| 448 static void ConvertPointToTarget(const View* source, | 448 static void ConvertPointToTarget(const View* source, |
| 449 const View* target, | 449 const View* target, |
| 450 gfx::Point* point); | 450 gfx::Point* point); |
| 451 | 451 |
| 452 // Convert |rect| from the coordinate system of |source| to the coordinate |
| 453 // system of |target|. |
| 454 // |
| 455 // |source| and |target| must be in the same widget, but doesn't need to be in |
| 456 // the same view hierarchy. |
| 457 // |source| can be NULL in which case it means the screen coordinate system. |
| 458 static void ConvertRectToTarget(const View* source, |
| 459 const View* target, |
| 460 gfx::Rect* rect); |
| 461 |
| 452 // Convert a point from a View's coordinate system to that of its Widget. | 462 // Convert a point from a View's coordinate system to that of its Widget. |
| 453 static void ConvertPointToWidget(const View* src, gfx::Point* point); | 463 static void ConvertPointToWidget(const View* src, gfx::Point* point); |
| 454 | 464 |
| 455 // Convert a point from the coordinate system of a View's Widget to that | 465 // Convert a point from the coordinate system of a View's Widget to that |
| 456 // View's coordinate system. | 466 // View's coordinate system. |
| 457 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); | 467 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); |
| 458 | 468 |
| 459 // Convert a point from a View's coordinate system to that of the screen. | 469 // Convert a point from a View's coordinate system to that of the screen. |
| 460 static void ConvertPointToScreen(const View* src, gfx::Point* point); | 470 static void ConvertPointToScreen(const View* src, gfx::Point* point); |
| 461 | 471 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 flip_canvas_on_paint_for_rtl_ui_ = enable; | 552 flip_canvas_on_paint_for_rtl_ui_ = enable; |
| 543 } | 553 } |
| 544 | 554 |
| 545 // Accelerated painting ------------------------------------------------------ | 555 // Accelerated painting ------------------------------------------------------ |
| 546 | 556 |
| 547 // Enable/Disable accelerated compositing. | 557 // Enable/Disable accelerated compositing. |
| 548 static void set_use_acceleration_when_possible(bool use); | 558 static void set_use_acceleration_when_possible(bool use); |
| 549 static bool get_use_acceleration_when_possible(); | 559 static bool get_use_acceleration_when_possible(); |
| 550 | 560 |
| 551 // Input --------------------------------------------------------------------- | 561 // Input --------------------------------------------------------------------- |
| 552 // The points (and mouse locations) in the following functions are in the | 562 // The points, rects, mouse locations, and touch locations in the following |
| 553 // view's coordinates, except for a RootView. | 563 // functions are in the view's coordinates, except for a RootView. |
| 554 | 564 |
| 555 // Returns the deepest visible descendant that contains the specified point | 565 // Convenience functions which calls into GetEventHandler() with |
| 556 // and supports event handling. | 566 // a 1x1 rect centered at |point|. |
| 557 virtual View* GetEventHandlerForPoint(const gfx::Point& point); | 567 View* GetEventHandlerForPoint(const gfx::Point& point); |
| 568 |
| 569 // If point-based targeting should be used, return the deepest visible |
| 570 // descendant that contains the center point of |rect|. |
| 571 // If rect-based targeting (i.e., fuzzing) should be used, return the |
| 572 // closest visible descendant having at least kRectTargetOverlap of |
| 573 // its area covered by |rect|. If no such descendant exists, return the |
| 574 // deepest visible descendant that contains the center point of |rect|. |
| 575 virtual View* GetEventHandlerForRect(const gfx::Rect& rect); |
| 558 | 576 |
| 559 // Returns the deepest visible descendant that contains the specified point | 577 // Returns the deepest visible descendant that contains the specified point |
| 560 // and supports tooltips. If the view does not contain the point, returns | 578 // and supports tooltips. If the view does not contain the point, returns |
| 561 // NULL. | 579 // NULL. |
| 562 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point); | 580 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point); |
| 563 | 581 |
| 564 // Return the cursor that should be used for this view or the default cursor. | 582 // Return the cursor that should be used for this view or the default cursor. |
| 565 // The event location is in the receiver's coordinate system. The caller is | 583 // The event location is in the receiver's coordinate system. The caller is |
| 566 // responsible for managing the lifetime of the returned object, though that | 584 // responsible for managing the lifetime of the returned object, though that |
| 567 // lifetime may vary from platform to platform. On Windows and Aura, | 585 // lifetime may vary from platform to platform. On Windows and Aura, |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 | 1317 |
| 1300 // Coordinate conversion ----------------------------------------------------- | 1318 // Coordinate conversion ----------------------------------------------------- |
| 1301 | 1319 |
| 1302 // Convert a point in the view's coordinate to an ancestor view's coordinate | 1320 // Convert a point in the view's coordinate to an ancestor view's coordinate |
| 1303 // system using necessary transformations. Returns whether the point was | 1321 // system using necessary transformations. Returns whether the point was |
| 1304 // successfully converted to the ancestor's coordinate system. | 1322 // successfully converted to the ancestor's coordinate system. |
| 1305 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; | 1323 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; |
| 1306 | 1324 |
| 1307 // Convert a point in the ancestor's coordinate system to the view's | 1325 // Convert a point in the ancestor's coordinate system to the view's |
| 1308 // coordinate system using necessary transformations. Returns whether the | 1326 // coordinate system using necessary transformations. Returns whether the |
| 1309 // point was successfully from the ancestor's coordinate system to the view's | 1327 // point was successfully converted from the ancestor's coordinate system |
| 1310 // coordinate system. | 1328 // to the view's coordinate system. |
| 1311 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; | 1329 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; |
| 1312 | 1330 |
| 1331 // Convert a rect in the view's coordinate to an ancestor view's coordinate |
| 1332 // system using necessary transformations. Returns whether the rect was |
| 1333 // successfully converted to the ancestor's coordinate system. |
| 1334 bool ConvertRectForAncestor(const View* ancestor, gfx::Rect* rect) const; |
| 1335 |
| 1336 // Convert a rect in the ancestor's coordinate system to the view's |
| 1337 // coordinate system using necessary transformations. Returns whether the |
| 1338 // rect was successfully converted from the ancestor's coordinate system |
| 1339 // to the view's coordinate system. |
| 1340 bool ConvertRectFromAncestor(const View* ancestor, gfx::Rect* rect) const; |
| 1341 |
| 1313 // Accelerated painting ------------------------------------------------------ | 1342 // Accelerated painting ------------------------------------------------------ |
| 1314 | 1343 |
| 1315 // Creates the layer and related fields for this view. | 1344 // Creates the layer and related fields for this view. |
| 1316 void CreateLayer(); | 1345 void CreateLayer(); |
| 1317 | 1346 |
| 1318 // Parents all un-parented layers within this view's hierarchy to this view's | 1347 // Parents all un-parented layers within this view's hierarchy to this view's |
| 1319 // layer. | 1348 // layer. |
| 1320 void UpdateParentLayers(); | 1349 void UpdateParentLayers(); |
| 1321 | 1350 |
| 1322 // Parents this view's layer to |parent_layer|, and sets its bounds and other | 1351 // Parents this view's layer to |parent_layer|, and sets its bounds and other |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 // Belongs to this view, but it's reference-counted on some platforms | 1560 // Belongs to this view, but it's reference-counted on some platforms |
| 1532 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1561 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
| 1533 NativeViewAccessibility* native_view_accessibility_; | 1562 NativeViewAccessibility* native_view_accessibility_; |
| 1534 | 1563 |
| 1535 DISALLOW_COPY_AND_ASSIGN(View); | 1564 DISALLOW_COPY_AND_ASSIGN(View); |
| 1536 }; | 1565 }; |
| 1537 | 1566 |
| 1538 } // namespace views | 1567 } // namespace views |
| 1539 | 1568 |
| 1540 #endif // UI_VIEWS_VIEW_H_ | 1569 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |