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 ConvertPointToView(const View* source, | 409 static void ConvertPointToView(const View* source, |
410 const View* target, | 410 const View* target, |
411 gfx::Point* point); | 411 gfx::Point* point); |
412 | 412 |
| 413 // Convert a 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 ConvertRectToView(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. |
| 512 // Note that if you are overriding GetEventHandlerForPoint, you will likely |
| 513 // also want to override GetEventHandlerForRect. |
503 virtual View* GetEventHandlerForPoint(const gfx::Point& point); | 514 virtual View* GetEventHandlerForPoint(const gfx::Point& point); |
504 | 515 |
| 516 // Considers the bounding rectangles of all leaf descendant views that have |
| 517 // at least views::kFuzzingOverlapPercentage of their area covered by |
| 518 // |rect|. Among these rectangles, choose one that is closest to the center |
| 519 // line of |rect| and return its corresponding View. If there are no such |
| 520 // rectangles, NULL is returned. |
| 521 virtual View* GetEventHandlerForRect(const gfx::Rect& rect); |
| 522 |
505 // Return the cursor that should be used for this view or the default cursor. | 523 // 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 | 524 // 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 | 525 // responsible for managing the lifetime of the returned object, though that |
508 // lifetime may vary from platform to platform. On Windows and Aura, | 526 // lifetime may vary from platform to platform. On Windows and Aura, |
509 // the cursor is a shared resource. | 527 // the cursor is a shared resource. |
510 virtual gfx::NativeCursor GetCursor(const MouseEvent& event); | 528 virtual gfx::NativeCursor GetCursor(const MouseEvent& event); |
511 | 529 |
512 // Convenience to test whether a point is within this view's bounds | 530 // Convenience to test whether a point is within this view's bounds |
513 virtual bool HitTest(const gfx::Point& l) const; | 531 virtual bool HitTest(const gfx::Point& l) const; |
514 | 532 |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1486 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
1469 native_view_accessibility_win_; | 1487 native_view_accessibility_win_; |
1470 #endif | 1488 #endif |
1471 | 1489 |
1472 DISALLOW_COPY_AND_ASSIGN(View); | 1490 DISALLOW_COPY_AND_ASSIGN(View); |
1473 }; | 1491 }; |
1474 | 1492 |
1475 } // namespace views | 1493 } // namespace views |
1476 | 1494 |
1477 #endif // UI_VIEWS_VIEW_H_ | 1495 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |