| 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_WIDGET_ROOT_VIEW_H_ | 5 #ifndef UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // | 48 // |
| 49 class VIEWS_EXPORT RootView : public View, | 49 class VIEWS_EXPORT RootView : public View, |
| 50 public ViewTargeterDelegate, | 50 public ViewTargeterDelegate, |
| 51 public FocusTraversable, | 51 public FocusTraversable, |
| 52 public ui::EventProcessor { | 52 public ui::EventProcessor { |
| 53 public: | 53 public: |
| 54 static const char kViewClassName[]; | 54 static const char kViewClassName[]; |
| 55 | 55 |
| 56 // Creation and lifetime ----------------------------------------------------- | 56 // Creation and lifetime ----------------------------------------------------- |
| 57 explicit RootView(Widget* widget); | 57 explicit RootView(Widget* widget); |
| 58 virtual ~RootView(); | 58 ~RootView() override; |
| 59 | 59 |
| 60 // Tree operations ----------------------------------------------------------- | 60 // Tree operations ----------------------------------------------------------- |
| 61 | 61 |
| 62 // Sets the "contents view" of the RootView. This is the single child view | 62 // Sets the "contents view" of the RootView. This is the single child view |
| 63 // that is responsible for laying out the contents of the widget. | 63 // that is responsible for laying out the contents of the widget. |
| 64 void SetContentsView(View* contents_view); | 64 void SetContentsView(View* contents_view); |
| 65 View* GetContentsView(); | 65 View* GetContentsView(); |
| 66 | 66 |
| 67 // Called when parent of the host changed. | 67 // Called when parent of the host changed. |
| 68 void NotifyNativeViewHierarchyChanged(); | 68 void NotifyNativeViewHierarchyChanged(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 // Public API for broadcasting theme change notifications to this View | 81 // Public API for broadcasting theme change notifications to this View |
| 82 // hierarchy. | 82 // hierarchy. |
| 83 void ThemeChanged(); | 83 void ThemeChanged(); |
| 84 | 84 |
| 85 // Public API for broadcasting locale change notifications to this View | 85 // Public API for broadcasting locale change notifications to this View |
| 86 // hierarchy. | 86 // hierarchy. |
| 87 void LocaleChanged(); | 87 void LocaleChanged(); |
| 88 | 88 |
| 89 // Overridden from FocusTraversable: | 89 // Overridden from FocusTraversable: |
| 90 virtual FocusSearch* GetFocusSearch() override; | 90 FocusSearch* GetFocusSearch() override; |
| 91 virtual FocusTraversable* GetFocusTraversableParent() override; | 91 FocusTraversable* GetFocusTraversableParent() override; |
| 92 virtual View* GetFocusTraversableParentView() override; | 92 View* GetFocusTraversableParentView() override; |
| 93 | 93 |
| 94 // Overridden from ui::EventProcessor: | 94 // Overridden from ui::EventProcessor: |
| 95 virtual ui::EventTarget* GetRootTarget() override; | 95 ui::EventTarget* GetRootTarget() override; |
| 96 virtual void OnEventProcessingStarted(ui::Event* event) override; | 96 void OnEventProcessingStarted(ui::Event* event) override; |
| 97 virtual void OnEventProcessingFinished(ui::Event* event) override; | 97 void OnEventProcessingFinished(ui::Event* event) override; |
| 98 | 98 |
| 99 // Overridden from View: | 99 // Overridden from View: |
| 100 virtual const Widget* GetWidget() const override; | 100 const Widget* GetWidget() const override; |
| 101 virtual Widget* GetWidget() override; | 101 Widget* GetWidget() override; |
| 102 virtual bool IsDrawn() const override; | 102 bool IsDrawn() const override; |
| 103 virtual void Layout() override; | 103 void Layout() override; |
| 104 virtual const char* GetClassName() const override; | 104 const char* GetClassName() const override; |
| 105 virtual void SchedulePaintInRect(const gfx::Rect& rect) override; | 105 void SchedulePaintInRect(const gfx::Rect& rect) override; |
| 106 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 106 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 107 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; | 107 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 108 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 108 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 109 virtual void OnMouseCaptureLost() override; | 109 void OnMouseCaptureLost() override; |
| 110 virtual void OnMouseMoved(const ui::MouseEvent& event) override; | 110 void OnMouseMoved(const ui::MouseEvent& event) override; |
| 111 virtual void OnMouseExited(const ui::MouseEvent& event) override; | 111 void OnMouseExited(const ui::MouseEvent& event) override; |
| 112 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 112 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
| 113 virtual void SetMouseHandler(View* new_mouse_handler) override; | 113 void SetMouseHandler(View* new_mouse_handler) override; |
| 114 virtual void GetAccessibleState(ui::AXViewState* state) override; | 114 void GetAccessibleState(ui::AXViewState* state) override; |
| 115 virtual void UpdateParentLayer() override; | 115 void UpdateParentLayer() override; |
| 116 | 116 |
| 117 protected: | 117 protected: |
| 118 // Overridden from View: | 118 // Overridden from View: |
| 119 virtual void ViewHierarchyChanged( | 119 void ViewHierarchyChanged( |
| 120 const ViewHierarchyChangedDetails& details) override; | 120 const ViewHierarchyChangedDetails& details) override; |
| 121 virtual void VisibilityChanged(View* starting_from, bool is_visible) override; | 121 void VisibilityChanged(View* starting_from, bool is_visible) override; |
| 122 virtual void OnPaint(gfx::Canvas* canvas) override; | 122 void OnPaint(gfx::Canvas* canvas) override; |
| 123 virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( | 123 gfx::Vector2d CalculateOffsetToAncestorWithLayer( |
| 124 ui::Layer** layer_parent) override; | 124 ui::Layer** layer_parent) override; |
| 125 virtual View::DragInfo* GetDragInfo() override; | 125 View::DragInfo* GetDragInfo() override; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 friend class ::views::RootViewTargeter; | 128 friend class ::views::RootViewTargeter; |
| 129 friend class ::views::View; | 129 friend class ::views::View; |
| 130 friend class ::views::Widget; | 130 friend class ::views::Widget; |
| 131 friend class ::views::test::ViewTargeterTest; | 131 friend class ::views::test::ViewTargeterTest; |
| 132 friend class ::views::test::WidgetTest; | 132 friend class ::views::test::WidgetTest; |
| 133 | 133 |
| 134 // Input --------------------------------------------------------------------- | 134 // Input --------------------------------------------------------------------- |
| 135 | 135 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 147 | 147 |
| 148 // |view| is the view receiving |event|. This function sends the event to all | 148 // |view| is the view receiving |event|. This function sends the event to all |
| 149 // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag | 149 // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag |
| 150 // turned on, but does not contain |sibling|. | 150 // turned on, but does not contain |sibling|. |
| 151 void NotifyEnterExitOfDescendant(const ui::MouseEvent& event, | 151 void NotifyEnterExitOfDescendant(const ui::MouseEvent& event, |
| 152 ui::EventType type, | 152 ui::EventType type, |
| 153 View* view, | 153 View* view, |
| 154 View* sibling); | 154 View* sibling); |
| 155 | 155 |
| 156 // Overridden from ui::EventDispatcherDelegate: | 156 // Overridden from ui::EventDispatcherDelegate: |
| 157 virtual bool CanDispatchToTarget(ui::EventTarget* target) override; | 157 bool CanDispatchToTarget(ui::EventTarget* target) override; |
| 158 virtual ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, | 158 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, |
| 159 ui::Event* event) override; | 159 ui::Event* event) override; |
| 160 virtual ui::EventDispatchDetails PostDispatchEvent( | 160 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, |
| 161 ui::EventTarget* target, const ui::Event& event) override; | 161 const ui::Event& event) override; |
| 162 | 162 |
| 163 ////////////////////////////////////////////////////////////////////////////// | 163 ////////////////////////////////////////////////////////////////////////////// |
| 164 // Tree operations ----------------------------------------------------------- | 164 // Tree operations ----------------------------------------------------------- |
| 165 | 165 |
| 166 // The host Widget | 166 // The host Widget |
| 167 Widget* widget_; | 167 Widget* widget_; |
| 168 | 168 |
| 169 // Input --------------------------------------------------------------------- | 169 // Input --------------------------------------------------------------------- |
| 170 | 170 |
| 171 // TODO(tdanderson): Consider moving the input-related members into | 171 // TODO(tdanderson): Consider moving the input-related members into |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // Tracks drag state for a view. | 227 // Tracks drag state for a view. |
| 228 View::DragInfo drag_info_; | 228 View::DragInfo drag_info_; |
| 229 | 229 |
| 230 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); | 230 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 } // namespace internal | 233 } // namespace internal |
| 234 } // namespace views | 234 } // namespace views |
| 235 | 235 |
| 236 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 236 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| OLD | NEW |