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

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

Issue 2713643002: Add View::AddedToWidget and RemovedFromWidget. (Closed)
Patch Set: Reimplement without using the additional member View::attached_widget_. Created 3 years, 9 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
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 virtual void VisibilityChanged(View* starting_from, bool is_visible); 1109 virtual void VisibilityChanged(View* starting_from, bool is_visible);
1110 1110
1111 // This method is invoked when the parent NativeView of the widget that the 1111 // This method is invoked when the parent NativeView of the widget that the
1112 // view is attached to has changed and the view hierarchy has not changed. 1112 // view is attached to has changed and the view hierarchy has not changed.
1113 // ViewHierarchyChanged() is called when the parent NativeView of the widget 1113 // ViewHierarchyChanged() is called when the parent NativeView of the widget
1114 // that the view is attached to is changed as a result of changing the view 1114 // that the view is attached to is changed as a result of changing the view
1115 // hierarchy. Overriding this method is useful for tracking which 1115 // hierarchy. Overriding this method is useful for tracking which
1116 // FocusManager manages this view. 1116 // FocusManager manages this view.
1117 virtual void NativeViewHierarchyChanged(); 1117 virtual void NativeViewHierarchyChanged();
1118 1118
1119 // This method is invoked for a view when it is attached to a hierarchy with
1120 // a widget, i.e. GetWidget() starts returning a non-null result.
1121 virtual void AddedToWidget();
1122
1123 // This method is invoked for a view when it is removed from a hierarchy with
1124 // a widget.
1125 virtual void RemovedFromWidget();
1126
1119 // Painting ------------------------------------------------------------------ 1127 // Painting ------------------------------------------------------------------
1120 1128
1121 // Responsible for calling Paint() on child Views. Override to control the 1129 // Responsible for calling Paint() on child Views. Override to control the
1122 // order child Views are painted. 1130 // order child Views are painted.
1123 virtual void PaintChildren(const ui::PaintContext& context); 1131 virtual void PaintChildren(const ui::PaintContext& context);
1124 1132
1125 // Override to provide rendering in any part of the View's bounds. Typically 1133 // Override to provide rendering in any part of the View's bounds. Typically
1126 // this is the "contents" of the view. If you override this method you will 1134 // this is the "contents" of the view. If you override this method you will
1127 // have to call the subsequent OnPaint*() methods manually. 1135 // have to call the subsequent OnPaint*() methods manually.
1128 virtual void OnPaint(gfx::Canvas* canvas); 1136 virtual void OnPaint(gfx::Canvas* canvas);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 void PropagateNativeViewHierarchyChanged(); 1316 void PropagateNativeViewHierarchyChanged();
1309 1317
1310 // Takes care of registering/unregistering accelerators if 1318 // Takes care of registering/unregistering accelerators if
1311 // |register_accelerators| true and calls ViewHierarchyChanged(). 1319 // |register_accelerators| true and calls ViewHierarchyChanged().
1312 void ViewHierarchyChangedImpl(bool register_accelerators, 1320 void ViewHierarchyChangedImpl(bool register_accelerators,
1313 const ViewHierarchyChangedDetails& details); 1321 const ViewHierarchyChangedDetails& details);
1314 1322
1315 // Invokes OnNativeThemeChanged() on this and all descendants. 1323 // Invokes OnNativeThemeChanged() on this and all descendants.
1316 void PropagateNativeThemeChanged(const ui::NativeTheme* theme); 1324 void PropagateNativeThemeChanged(const ui::NativeTheme* theme);
1317 1325
1326 // Invokes AddedToWidget() on this and all descendants.
1327 void PropagateAddedToWidget();
1328
1329 // Invokes RemovedFromWidget() on this and all descendants.
1330 void PropagateRemovedFromWidget();
1331
1318 // Size and disposition ------------------------------------------------------ 1332 // Size and disposition ------------------------------------------------------
1319 1333
1320 // Call VisibilityChanged() recursively for all children. 1334 // Call VisibilityChanged() recursively for all children.
1321 void PropagateVisibilityNotifications(View* from, bool is_visible); 1335 void PropagateVisibilityNotifications(View* from, bool is_visible);
1322 1336
1323 // Registers/unregisters accelerators as necessary and calls 1337 // Registers/unregisters accelerators as necessary and calls
1324 // VisibilityChanged(). 1338 // VisibilityChanged().
1325 void VisibilityChangedImpl(View* starting_from, bool is_visible); 1339 void VisibilityChangedImpl(View* starting_from, bool is_visible);
1326 1340
1327 // Responsible for propagating bounds change notifications to relevant 1341 // Responsible for propagating bounds change notifications to relevant
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 // Observers ------------------------------------------------------------- 1637 // Observers -------------------------------------------------------------
1624 1638
1625 base::ObserverList<ViewObserver> observers_; 1639 base::ObserverList<ViewObserver> observers_;
1626 1640
1627 DISALLOW_COPY_AND_ASSIGN(View); 1641 DISALLOW_COPY_AND_ASSIGN(View);
1628 }; 1642 };
1629 1643
1630 } // namespace views 1644 } // namespace views
1631 1645
1632 #endif // UI_VIEWS_VIEW_H_ 1646 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698