Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: views/view.h

Issue 8620008: Get rid of Widget::ConvertPointFromAncestor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/widget.cc ('k') | views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_VIEW_H_ 5 #ifndef VIEWS_VIEW_H_
6 #define VIEWS_VIEW_H_ 6 #define VIEWS_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // The default implementation simply returns the first View found for that 408 // The default implementation simply returns the first View found for that
409 // group. 409 // group.
410 virtual View* GetSelectedViewForGroup(int group); 410 virtual View* GetSelectedViewForGroup(int group);
411 411
412 // Coordinate conversion ----------------------------------------------------- 412 // Coordinate conversion -----------------------------------------------------
413 413
414 // Note that the utility coordinate conversions functions always operate on 414 // Note that the utility coordinate conversions functions always operate on
415 // the mirrored position of the child Views if the parent View uses a 415 // the mirrored position of the child Views if the parent View uses a
416 // right-to-left UI layout. 416 // right-to-left UI layout.
417 417
418 // Convert a point from source coordinate system to dst coordinate system. 418 // Convert a point from the coordinate system of one View to another.
419 // 419 //
420 // |src| and |dst| needs to be in the same widget, but doesn't need to be in 420 // |source| and |target| must be in the same widget, but doesn't need to be in
421 // the same view hierarchy. 421 // the same view hierarchy.
422 // If |src| and |dst| are not in the same widget, the result is undefined. 422 // |source| can be NULL in which case it means the screen coordinate system.
423 // Source can be NULL in which case it means the screen coordinate system 423 static void ConvertPointToView(const View* source,
424 static void ConvertPointToView(const View* src, 424 const View* target,
425 const View* dst,
426 gfx::Point* point); 425 gfx::Point* point);
427 426
428 // Convert a point from the coordinate system of a View to that of the 427 // Convert a point from a View's coordinate system to that of its Widget.
429 // Widget. This is useful for example when sizing HWND children of the
430 // Widget that don't know about the View hierarchy and need to be placed
431 // relative to the Widget that is their parent.
432 static void ConvertPointToWidget(const View* src, gfx::Point* point); 428 static void ConvertPointToWidget(const View* src, gfx::Point* point);
433 429
434 // Convert a point from a view Widget to a View dest 430 // Convert a point from the coordinate system of a View's Widget to that
431 // View's coordinate system.
435 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); 432 static void ConvertPointFromWidget(const View* dest, gfx::Point* p);
436 433
437 // Convert a point from the coordinate system of a View to that of the 434 // Convert a point from a View's coordinate system to that of the screen.
438 // screen. This is useful for example when placing popup windows.
439 static void ConvertPointToScreen(const View* src, gfx::Point* point); 435 static void ConvertPointToScreen(const View* src, gfx::Point* point);
440 436
441 // Applies transformation on the rectangle, which is in the view's coordinate 437 // Applies transformation on the rectangle, which is in the view's coordinate
442 // system, to convert it into the parent's coordinate system. 438 // system, to convert it into the parent's coordinate system.
443 gfx::Rect ConvertRectToParent(const gfx::Rect& rect) const; 439 gfx::Rect ConvertRectToParent(const gfx::Rect& rect) const;
444 440
445 // Converts a rectangle from this views coordinate system to its widget 441 // Converts a rectangle from this views coordinate system to its widget
446 // cooridnate system. 442 // coordinate system.
447 gfx::Rect ConvertRectToWidget(const gfx::Rect& rect) const; 443 gfx::Rect ConvertRectToWidget(const gfx::Rect& rect) const;
448 444
449 // Painting ------------------------------------------------------------------ 445 // Painting ------------------------------------------------------------------
450 446
451 // Mark all or part of the View's bounds as dirty (needing repaint). 447 // Mark all or part of the View's bounds as dirty (needing repaint).
452 // |r| is in the View's coordinates. 448 // |r| is in the View's coordinates.
453 // Rectangle |r| should be in the view's coordinate system. The 449 // Rectangle |r| should be in the view's coordinate system. The
454 // transformations are applied to it to convert it into the parent coordinate 450 // transformations are applied to it to convert it into the parent coordinate
455 // system before propagating SchedulePaint up the view hierarchy. 451 // system before propagating SchedulePaint up the view hierarchy.
456 // TODO(beng): Make protected. 452 // TODO(beng): Make protected.
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 // Transformations ----------------------------------------------------------- 1191 // Transformations -----------------------------------------------------------
1196 1192
1197 // Returns in |transform| the transform to get from coordinates of |ancestor| 1193 // Returns in |transform| the transform to get from coordinates of |ancestor|
1198 // to this. Returns true if |ancestor| is found. If |ancestor| is not found, 1194 // to this. Returns true if |ancestor| is found. If |ancestor| is not found,
1199 // or NULL, |transform| is set to convert from root view coordinates to this. 1195 // or NULL, |transform| is set to convert from root view coordinates to this.
1200 bool GetTransformRelativeTo(const View* ancestor, 1196 bool GetTransformRelativeTo(const View* ancestor,
1201 ui::Transform* transform) const; 1197 ui::Transform* transform) const;
1202 1198
1203 // Coordinate conversion ----------------------------------------------------- 1199 // Coordinate conversion -----------------------------------------------------
1204 1200
1205 // This is the actual implementation for ConvertPointToView()
1206 // Attempts a parent -> child conversion and then a
1207 // child -> parent conversion if try_other_direction is true
1208 // Applies necessary transformations during the conversion.
1209 static void ConvertPointToView(const View* src,
1210 const View* dst,
1211 gfx::Point* point,
1212 bool try_other_direction);
1213
1214 // Convert a point in the view's coordinate to an ancestor view's coordinate 1201 // Convert a point in the view's coordinate to an ancestor view's coordinate
1215 // system using necessary transformations. Returns whether the point was 1202 // system using necessary transformations. Returns whether the point was
1216 // successfully converted to the ancestor's coordinate system. 1203 // successfully converted to the ancestor's coordinate system.
1217 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; 1204 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const;
1218 1205
1219 // Convert a point in the ancestor's coordinate system to the view's 1206 // Convert a point in the ancestor's coordinate system to the view's
1220 // coordinate system using necessary transformations. Returns whether the 1207 // coordinate system using necessary transformations. Returns whether the
1221 // point was successfully from the ancestor's coordinate system to the view's 1208 // point was successfully from the ancestor's coordinate system to the view's
1222 // coordinate system. 1209 // coordinate system.
1223 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; 1210 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 base::win::ScopedComPtr<NativeViewAccessibilityWin> 1431 base::win::ScopedComPtr<NativeViewAccessibilityWin>
1445 native_view_accessibility_win_; 1432 native_view_accessibility_win_;
1446 #endif 1433 #endif
1447 1434
1448 DISALLOW_COPY_AND_ASSIGN(View); 1435 DISALLOW_COPY_AND_ASSIGN(View);
1449 }; 1436 };
1450 1437
1451 } // namespace views 1438 } // namespace views
1452 1439
1453 #endif // VIEWS_VIEW_H_ 1440 #endif // VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/widget/widget.cc ('k') | views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698