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

Side by Side Diff: ui/views/view.h

Issue 15071002: WIP - loop in LayoutManager for preferred size changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scoped layouter Created 7 years, 7 months 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/layout/layout_manager.cc ('k') | ui/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) 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 class LayoutManager; 67 class LayoutManager;
68 class NativeViewAccessibility; 68 class NativeViewAccessibility;
69 class ScrollView; 69 class ScrollView;
70 class Widget; 70 class Widget;
71 71
72 namespace internal { 72 namespace internal {
73 class PostEventDispatchHandler; 73 class PostEventDispatchHandler;
74 class RootView; 74 class RootView;
75 } 75 }
76 76
77 class VIEWS_EXPORT ScopedMaybeLayout {
78 public:
79 ScopedMaybeLayout(views::View* view);
80 ~ScopedMaybeLayout();
81
82 private:
83 views::View* view_;
84 };
85
77 ///////////////////////////////////////////////////////////////////////////// 86 /////////////////////////////////////////////////////////////////////////////
78 // 87 //
79 // View class 88 // View class
80 // 89 //
81 // A View is a rectangle within the views View hierarchy. It is the base 90 // A View is a rectangle within the views View hierarchy. It is the base
82 // class for all Views. 91 // class for all Views.
83 // 92 //
84 // A View is a container of other Views (there is no such thing as a Leaf 93 // A View is a container of other Views (there is no such thing as a Leaf
85 // View - makes code simpler, reduces type conversion headaches, design 94 // View - makes code simpler, reduces type conversion headaches, design
86 // mistakes etc) 95 // mistakes etc)
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 // Whether the press may generate a drag. 977 // Whether the press may generate a drag.
969 bool possible_drag; 978 bool possible_drag;
970 979
971 // Coordinates of the mouse press. 980 // Coordinates of the mouse press.
972 gfx::Point start_pt; 981 gfx::Point start_pt;
973 }; 982 };
974 983
975 // Size and disposition ------------------------------------------------------ 984 // Size and disposition ------------------------------------------------------
976 985
977 // Override to be notified when the bounds of the view have changed. 986 // Override to be notified when the bounds of the view have changed.
978 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds); 987 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) {}
979 988
980 // Called when the preferred size of a child view changed. This gives the 989 // Called when the preferred size of a child view changed. This gives the
981 // parent an opportunity to do a fresh layout if that makes sense. 990 // parent an opportunity to do a fresh layout if that makes sense.
982 virtual void ChildPreferredSizeChanged(View* child) {} 991 virtual void ChildPreferredSizeChanged(View* child);
983 992
984 // Called when the visibility of a child view changed. This gives the parent 993 // Called when the visibility of a child view changed. This gives the parent
985 // an opportunity to do a fresh layout if that makes sense. 994 // an opportunity to do a fresh layout if that makes sense.
986 virtual void ChildVisibilityChanged(View* child) {} 995 virtual void ChildVisibilityChanged(View* child) {}
987 996
988 // Invalidates the layout and calls ChildPreferredSizeChanged on the parent 997 // Invalidates the layout and calls ChildPreferredSizeChanged on the parent
989 // if there is one. Be sure to call View::PreferredSizeChanged when 998 // if there is one. Be sure to call View::PreferredSizeChanged when
990 // overriding such that the layout is properly invalidated. 999 // overriding such that the layout is properly invalidated.
991 virtual void PreferredSizeChanged(); 1000 virtual void PreferredSizeChanged();
992 1001
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 // the views hierarchy. The above function gives the class the flexibility to 1200 // the views hierarchy. The above function gives the class the flexibility to
1192 // decide which object should be used to obtain the children, but this 1201 // decide which object should be used to obtain the children, but this
1193 // function makes the decision explicit. 1202 // function makes the decision explicit.
1194 std::string DoPrintViewGraph(bool first, View* view_with_children); 1203 std::string DoPrintViewGraph(bool first, View* view_with_children);
1195 #endif 1204 #endif
1196 1205
1197 private: 1206 private:
1198 friend class internal::PostEventDispatchHandler; 1207 friend class internal::PostEventDispatchHandler;
1199 friend class internal::RootView; 1208 friend class internal::RootView;
1200 friend class FocusManager; 1209 friend class FocusManager;
1210 friend class LayoutManager;
1211 friend class ScopedMaybeLayout;
1201 friend class Widget; 1212 friend class Widget;
1202 1213
1203 // Painting ----------------------------------------------------------------- 1214 // Painting -----------------------------------------------------------------
1204 1215
1205 enum SchedulePaintType { 1216 enum SchedulePaintType {
1206 // Indicates the size is the same (only the origin changed). 1217 // Indicates the size is the same (only the origin changed).
1207 SCHEDULE_PAINT_SIZE_SAME, 1218 SCHEDULE_PAINT_SIZE_SAME,
1208 1219
1209 // Indicates the size changed (and possibly the origin). 1220 // Indicates the size changed (and possibly the origin).
1210 SCHEDULE_PAINT_SIZE_CHANGED 1221 SCHEDULE_PAINT_SIZE_CHANGED
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 // Belongs to this view, but it's reference-counted on some platforms 1549 // Belongs to this view, but it's reference-counted on some platforms
1539 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1550 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1540 NativeViewAccessibility* native_view_accessibility_; 1551 NativeViewAccessibility* native_view_accessibility_;
1541 1552
1542 DISALLOW_COPY_AND_ASSIGN(View); 1553 DISALLOW_COPY_AND_ASSIGN(View);
1543 }; 1554 };
1544 1555
1545 } // namespace views 1556 } // namespace views
1546 1557
1547 #endif // UI_VIEWS_VIEW_H_ 1558 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/layout/layout_manager.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698