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_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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); | 707 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); |
708 | 708 |
709 // Returns the ViewTargeter installed on |this| if one exists, | 709 // Returns the ViewTargeter installed on |this| if one exists, |
710 // otherwise returns the ViewTargeter installed on our root view. | 710 // otherwise returns the ViewTargeter installed on our root view. |
711 // The return value is guaranteed to be non-null. | 711 // The return value is guaranteed to be non-null. |
712 ViewTargeter* GetEffectiveViewTargeter() const; | 712 ViewTargeter* GetEffectiveViewTargeter() const; |
713 | 713 |
714 ViewTargeter* targeter() const { return targeter_.get(); } | 714 ViewTargeter* targeter() const { return targeter_.get(); } |
715 | 715 |
716 // Overridden from ui::EventTarget: | 716 // Overridden from ui::EventTarget: |
717 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 717 virtual bool CanAcceptEvent(const ui::Event& event) override; |
718 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 718 virtual ui::EventTarget* GetParentTarget() override; |
719 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 719 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
720 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 720 virtual ui::EventTargeter* GetEventTargeter() override; |
721 virtual void ConvertEventToTarget(ui::EventTarget* target, | 721 virtual void ConvertEventToTarget(ui::EventTarget* target, |
722 ui::LocatedEvent* event) OVERRIDE; | 722 ui::LocatedEvent* event) override; |
723 | 723 |
724 // Overridden from ui::EventHandler: | 724 // Overridden from ui::EventHandler: |
725 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 725 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
726 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 726 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
727 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 727 virtual void OnScrollEvent(ui::ScrollEvent* event) override; |
728 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; | 728 virtual void OnTouchEvent(ui::TouchEvent* event) override final; |
729 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 729 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
730 | 730 |
731 // Accelerators -------------------------------------------------------------- | 731 // Accelerators -------------------------------------------------------------- |
732 | 732 |
733 // Sets a keyboard accelerator for that view. When the user presses the | 733 // Sets a keyboard accelerator for that view. When the user presses the |
734 // accelerator key combination, the AcceleratorPressed method is invoked. | 734 // accelerator key combination, the AcceleratorPressed method is invoked. |
735 // Note that you can set multiple accelerators for a view by invoking this | 735 // Note that you can set multiple accelerators for a view by invoking this |
736 // method several times. Note also that AcceleratorPressed is invoked only | 736 // method several times. Note also that AcceleratorPressed is invoked only |
737 // when CanHandleAccelerators() is true. | 737 // when CanHandleAccelerators() is true. |
738 virtual void AddAccelerator(const ui::Accelerator& accelerator); | 738 virtual void AddAccelerator(const ui::Accelerator& accelerator); |
739 | 739 |
740 // Removes the specified accelerator for this view. | 740 // Removes the specified accelerator for this view. |
741 virtual void RemoveAccelerator(const ui::Accelerator& accelerator); | 741 virtual void RemoveAccelerator(const ui::Accelerator& accelerator); |
742 | 742 |
743 // Removes all the keyboard accelerators for this view. | 743 // Removes all the keyboard accelerators for this view. |
744 virtual void ResetAccelerators(); | 744 virtual void ResetAccelerators(); |
745 | 745 |
746 // Overridden from AcceleratorTarget: | 746 // Overridden from AcceleratorTarget: |
747 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 747 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
748 | 748 |
749 // Returns whether accelerators are enabled for this view. Accelerators are | 749 // Returns whether accelerators are enabled for this view. Accelerators are |
750 // enabled if the containing widget is visible and the view is enabled() and | 750 // enabled if the containing widget is visible and the view is enabled() and |
751 // IsDrawn() | 751 // IsDrawn() |
752 virtual bool CanHandleAccelerators() const OVERRIDE; | 752 virtual bool CanHandleAccelerators() const override; |
753 | 753 |
754 // Focus --------------------------------------------------------------------- | 754 // Focus --------------------------------------------------------------------- |
755 | 755 |
756 // Returns whether this view currently has the focus. | 756 // Returns whether this view currently has the focus. |
757 virtual bool HasFocus() const; | 757 virtual bool HasFocus() const; |
758 | 758 |
759 // Returns the view that should be selected next when pressing Tab. | 759 // Returns the view that should be selected next when pressing Tab. |
760 View* GetNextFocusableView(); | 760 View* GetNextFocusableView(); |
761 const View* GetNextFocusableView() const; | 761 const View* GetNextFocusableView() const; |
762 | 762 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 // recurses through all children. This is used when adding a layer to an | 1110 // recurses through all children. This is used when adding a layer to an |
1111 // existing view to make sure all descendants that have layers are parented to | 1111 // existing view to make sure all descendants that have layers are parented to |
1112 // the right layer. | 1112 // the right layer. |
1113 void MoveLayerToParent(ui::Layer* parent_layer, const gfx::Point& point); | 1113 void MoveLayerToParent(ui::Layer* parent_layer, const gfx::Point& point); |
1114 | 1114 |
1115 // Called to update the bounds of any child layers within this View's | 1115 // Called to update the bounds of any child layers within this View's |
1116 // hierarchy when something happens to the hierarchy. | 1116 // hierarchy when something happens to the hierarchy. |
1117 void UpdateChildLayerBounds(const gfx::Vector2d& offset); | 1117 void UpdateChildLayerBounds(const gfx::Vector2d& offset); |
1118 | 1118 |
1119 // Overridden from ui::LayerDelegate: | 1119 // Overridden from ui::LayerDelegate: |
1120 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 1120 virtual void OnPaintLayer(gfx::Canvas* canvas) override; |
1121 virtual void OnDelegatedFrameDamage( | 1121 virtual void OnDelegatedFrameDamage( |
1122 const gfx::Rect& damage_rect_in_dip) OVERRIDE; | 1122 const gfx::Rect& damage_rect_in_dip) override; |
1123 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 1123 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
1124 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; | 1124 virtual base::Closure PrepareForLayerBoundsChange() override; |
1125 | 1125 |
1126 // Finds the layer that this view paints to (it may belong to an ancestor | 1126 // Finds the layer that this view paints to (it may belong to an ancestor |
1127 // view), then reorders the immediate children of that layer to match the | 1127 // view), then reorders the immediate children of that layer to match the |
1128 // order of the view tree. | 1128 // order of the view tree. |
1129 virtual void ReorderLayers(); | 1129 virtual void ReorderLayers(); |
1130 | 1130 |
1131 // This reorders the immediate children of |*parent_layer| to match the | 1131 // This reorders the immediate children of |*parent_layer| to match the |
1132 // order of the view tree. Child layers which are owned by a view are | 1132 // order of the view tree. Child layers which are owned by a view are |
1133 // reordered so that they are below any child layers not owned by a view. | 1133 // reordered so that they are below any child layers not owned by a view. |
1134 // Widget::ReorderNativeViews() should be called to reorder any child layers | 1134 // Widget::ReorderNativeViews() should be called to reorder any child layers |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 // Belongs to this view, but it's reference-counted on some platforms | 1601 // Belongs to this view, but it's reference-counted on some platforms |
1602 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1602 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1603 NativeViewAccessibility* native_view_accessibility_; | 1603 NativeViewAccessibility* native_view_accessibility_; |
1604 | 1604 |
1605 DISALLOW_COPY_AND_ASSIGN(View); | 1605 DISALLOW_COPY_AND_ASSIGN(View); |
1606 }; | 1606 }; |
1607 | 1607 |
1608 } // namespace views | 1608 } // namespace views |
1609 | 1609 |
1610 #endif // UI_VIEWS_VIEW_H_ | 1610 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |