| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 // Convert a point from the coordinate system of one View to another. | 404 // Convert a point from the coordinate system of one View to another. |
| 405 // | 405 // |
| 406 // |source| and |target| must be in the same widget, but doesn't need to be in | 406 // |source| and |target| must be in the same widget, but doesn't need to be in |
| 407 // the same view hierarchy. | 407 // the same view hierarchy. |
| 408 // |source| can be NULL in which case it means the screen coordinate system. | 408 // |source| can be NULL in which case it means the screen coordinate system. |
| 409 static void ConvertPointToTarget(const View* source, | 409 static void ConvertPointToTarget(const View* source, |
| 410 const View* target, | 410 const View* target, |
| 411 gfx::Point* point); | 411 gfx::Point* point); |
| 412 | 412 |
| 413 // Convert |rect| from the coordinate system of one View to another. |
| 414 // |
| 415 // |source| and |target| must be in the same widget, but doesn't need to be in |
| 416 // the same view hierarchy. |
| 417 // |source| can be NULL in which case it means the screen coordinate system. |
| 418 static void ConvertRectToTarget(const View* source, |
| 419 const View* target, |
| 420 gfx::Rect* rect); |
| 421 |
| 413 // Convert a point from a View's coordinate system to that of its Widget. | 422 // Convert a point from a View's coordinate system to that of its Widget. |
| 414 static void ConvertPointToWidget(const View* src, gfx::Point* point); | 423 static void ConvertPointToWidget(const View* src, gfx::Point* point); |
| 415 | 424 |
| 416 // Convert a point from the coordinate system of a View's Widget to that | 425 // Convert a point from the coordinate system of a View's Widget to that |
| 417 // View's coordinate system. | 426 // View's coordinate system. |
| 418 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); | 427 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); |
| 419 | 428 |
| 420 // Convert a point from a View's coordinate system to that of the screen. | 429 // Convert a point from a View's coordinate system to that of the screen. |
| 421 static void ConvertPointToScreen(const View* src, gfx::Point* point); | 430 static void ConvertPointToScreen(const View* src, gfx::Point* point); |
| 422 | 431 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 502 |
| 494 // Enable/Disable accelerated compositing. | 503 // Enable/Disable accelerated compositing. |
| 495 static void set_use_acceleration_when_possible(bool use); | 504 static void set_use_acceleration_when_possible(bool use); |
| 496 static bool get_use_acceleration_when_possible(); | 505 static bool get_use_acceleration_when_possible(); |
| 497 | 506 |
| 498 // Input --------------------------------------------------------------------- | 507 // Input --------------------------------------------------------------------- |
| 499 // The points (and mouse locations) in the following functions are in the | 508 // The points (and mouse locations) in the following functions are in the |
| 500 // view's coordinates, except for a RootView. | 509 // view's coordinates, except for a RootView. |
| 501 | 510 |
| 502 // Returns the deepest visible descendant that contains the specified point. | 511 // Returns the deepest visible descendant that contains the specified point. |
| 503 virtual View* GetEventHandlerForPoint(const gfx::Point& point); | 512 View* GetEventHandlerForPoint(const gfx::Point& point); |
| 513 |
| 514 // Returns the appropriate event handler for the given touch rect. |
| 515 View* GetEventHandlerForRect(const gfx::Rect& rect); |
| 516 |
| 517 // Flags the event type, so that a single GetEvent routine can handle both. |
| 518 enum EventType { EVENT_HANDLER_TYPE_MOUSE, EVENT_HANDLER_TYPE_TOUCH }; |
| 519 |
| 520 // Returns the appropriate event handler for the given |rect|. Location will |
| 521 // either be a rect (for a touch event) or a point (as a 1X1 rect) for a |
| 522 // mouse event. |
| 523 // Considers the bounding rectangles of all leaf descendant views that have |
| 524 // at least views::kFuzzingOverlapPercentage of their area covered by |
| 525 // |rect|. Among these rectangles, choose one that is closest to the center |
| 526 // line of |rect| and return its corresponding View. If there are no such |
| 527 // rectangles, NULL is returned. |
| 528 virtual View* GetEventHandler(const gfx::Rect& rect, EventType type); |
| 504 | 529 |
| 505 // Return the cursor that should be used for this view or the default cursor. | 530 // Return the cursor that should be used for this view or the default cursor. |
| 506 // The event location is in the receiver's coordinate system. The caller is | 531 // The event location is in the receiver's coordinate system. The caller is |
| 507 // responsible for managing the lifetime of the returned object, though that | 532 // responsible for managing the lifetime of the returned object, though that |
| 508 // lifetime may vary from platform to platform. On Windows and Aura, | 533 // lifetime may vary from platform to platform. On Windows and Aura, |
| 509 // the cursor is a shared resource. | 534 // the cursor is a shared resource. |
| 510 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event); | 535 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event); |
| 511 | 536 |
| 512 // A convenience function which calls HitTestRect() with a rect of size | 537 // A convenience function which calls HitTestRect() with a rect of size |
| 513 // 1x1 and an origin of |point|. | 538 // 1x1 and an origin of |point|. |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1497 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
| 1473 native_view_accessibility_win_; | 1498 native_view_accessibility_win_; |
| 1474 #endif | 1499 #endif |
| 1475 | 1500 |
| 1476 DISALLOW_COPY_AND_ASSIGN(View); | 1501 DISALLOW_COPY_AND_ASSIGN(View); |
| 1477 }; | 1502 }; |
| 1478 | 1503 |
| 1479 } // namespace views | 1504 } // namespace views |
| 1480 | 1505 |
| 1481 #endif // UI_VIEWS_VIEW_H_ | 1506 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |