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

Unified Diff: ui/views/view_observer.h

Issue 2500623002: Add ViewObserver to View for view updates (Closed)
Patch Set: Change OnViewParentChanged to OnChildViewAdded/Removed Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/view_observer.h
diff --git a/ui/views/view_observer.h b/ui/views/view_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..86ec8eeb04a48aa5cfed63d2aec8d12c3759ecf4
--- /dev/null
+++ b/ui/views/view_observer.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_VIEW_OBSERVER_H_
+#define UI_VIEWS_VIEW_OBSERVER_H_
+
+#include "ui/views/view.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace views {
+
+// Observer can listen to various events on the Views.
+class VIEWS_EXPORT ViewObserver {
+ public:
+ // Called when |child| is added to its parent. Invoked on the parent which has
+ // the |child| added to it.
+ virtual void OnChildViewAdded(View* child) {}
+
+ // Called when |child| is removed from its |parent|.
+ virtual void OnChildViewRemoved(View* child, View* parent) {}
+
+ // Called when View::SetVisible() is called with a new value.
+ // The |view| may still be hidden at this point.
+ virtual void OnViewVisibilityChanged(View* view) {}
+
+ virtual void OnViewEnabledChanged(View* view) {}
+
+ virtual void OnViewBoundsChanged(View* view) {}
+
+ // Invoked whenever a child is moved to another index. This is called on the
+ // parent view. |view| is the child view being moved.
+ virtual void OnChildViewReordered(View* view) {}
+
+ protected:
+ virtual ~ViewObserver() {}
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_VIEW_OBSERVER_H_
« ui/views/view.h ('K') | « ui/views/view.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698