| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 // Given a rectangle specified in this View's coordinate system, the function | 372 // Given a rectangle specified in this View's coordinate system, the function |
| 373 // computes the 'left' value for the mirrored rectangle within this View. If | 373 // computes the 'left' value for the mirrored rectangle within this View. If |
| 374 // the View's UI layout is not right-to-left, then bounds.x() is returned. | 374 // the View's UI layout is not right-to-left, then bounds.x() is returned. |
| 375 // | 375 // |
| 376 // UI mirroring is transparent to most View subclasses and therefore there is | 376 // UI mirroring is transparent to most View subclasses and therefore there is |
| 377 // no need to call this routine from anywhere within your subclass | 377 // no need to call this routine from anywhere within your subclass |
| 378 // implementation. | 378 // implementation. |
| 379 int GetMirroredXForRect(const gfx::Rect& rect) const; | 379 int GetMirroredXForRect(const gfx::Rect& rect) const; |
| 380 | 380 |
| 381 // Given a rectangle specified in this View's coordinate system, the function |
| 382 // computes the mirrored rectangle. |
| 383 gfx::Rect GetMirroredRect(const gfx::Rect& rect) const; |
| 384 |
| 381 // Given the X coordinate of a point inside the View, this function returns | 385 // Given the X coordinate of a point inside the View, this function returns |
| 382 // the mirrored X coordinate of the point if the View's UI layout is | 386 // the mirrored X coordinate of the point if the View's UI layout is |
| 383 // right-to-left. If the layout is left-to-right, the same X coordinate is | 387 // right-to-left. If the layout is left-to-right, the same X coordinate is |
| 384 // returned. | 388 // returned. |
| 385 // | 389 // |
| 386 // Following are a few examples of the values returned by this function for | 390 // Following are a few examples of the values returned by this function for |
| 387 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout: | 391 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout: |
| 388 // | 392 // |
| 389 // GetMirroredXCoordinateInView(0) -> 100 | 393 // GetMirroredXCoordinateInView(0) -> 100 |
| 390 // GetMirroredXCoordinateInView(20) -> 80 | 394 // GetMirroredXCoordinateInView(20) -> 80 |
| (...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 // Observers ------------------------------------------------------------- | 1712 // Observers ------------------------------------------------------------- |
| 1709 | 1713 |
| 1710 base::ObserverList<ViewObserver> observers_; | 1714 base::ObserverList<ViewObserver> observers_; |
| 1711 | 1715 |
| 1712 DISALLOW_COPY_AND_ASSIGN(View); | 1716 DISALLOW_COPY_AND_ASSIGN(View); |
| 1713 }; | 1717 }; |
| 1714 | 1718 |
| 1715 } // namespace views | 1719 } // namespace views |
| 1716 | 1720 |
| 1717 #endif // UI_VIEWS_VIEW_H_ | 1721 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |