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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 // Convenience method to retrieve the InputMethod associated with the | 697 // Convenience method to retrieve the InputMethod associated with the |
698 // Widget that contains this view. Returns NULL if this view is not part of a | 698 // Widget that contains this view. Returns NULL if this view is not part of a |
699 // view hierarchy with a Widget. | 699 // view hierarchy with a Widget. |
700 virtual InputMethod* GetInputMethod(); | 700 virtual InputMethod* GetInputMethod(); |
701 virtual const InputMethod* GetInputMethod() const; | 701 virtual const InputMethod* GetInputMethod() const; |
702 | 702 |
703 // Sets a new ViewTargeter for the view, and returns the previous | 703 // Sets a new ViewTargeter for the view, and returns the previous |
704 // ViewTargeter. | 704 // ViewTargeter. |
705 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); | 705 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); |
706 | 706 |
| 707 // Returns the ViewTargeter installed on |this| if one exists, |
| 708 // otherwise returns the ViewTargeter installed on our root view. |
| 709 // The return value is guaranteed to be non-null. |
| 710 ViewTargeter* GetEffectiveViewTargeter() const; |
| 711 |
| 712 ViewTargeter* targeter() const { return targeter_.get(); } |
| 713 |
707 // Overridden from ui::EventTarget: | 714 // Overridden from ui::EventTarget: |
708 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 715 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; |
709 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 716 virtual ui::EventTarget* GetParentTarget() OVERRIDE; |
710 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 717 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; |
711 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 718 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; |
712 virtual void ConvertEventToTarget(ui::EventTarget* target, | 719 virtual void ConvertEventToTarget(ui::EventTarget* target, |
713 ui::LocatedEvent* event) OVERRIDE; | 720 ui::LocatedEvent* event) OVERRIDE; |
714 | 721 |
715 ViewTargeter* targeter() const { return targeter_.get(); } | |
716 | |
717 // Overridden from ui::EventHandler: | 722 // Overridden from ui::EventHandler: |
718 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 723 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
719 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 724 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
720 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 725 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
721 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; | 726 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; |
722 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 727 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
723 | 728 |
724 // Accelerators -------------------------------------------------------------- | 729 // Accelerators -------------------------------------------------------------- |
725 | 730 |
726 // Sets a keyboard accelerator for that view. When the user presses the | 731 // Sets a keyboard accelerator for that view. When the user presses the |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 // Destroys the layer associated with this view, and reparents any descendants | 1388 // Destroys the layer associated with this view, and reparents any descendants |
1384 // to the destroyed layer's parent. | 1389 // to the destroyed layer's parent. |
1385 void DestroyLayer(); | 1390 void DestroyLayer(); |
1386 | 1391 |
1387 // Input --------------------------------------------------------------------- | 1392 // Input --------------------------------------------------------------------- |
1388 | 1393 |
1389 bool ProcessMousePressed(const ui::MouseEvent& event); | 1394 bool ProcessMousePressed(const ui::MouseEvent& event); |
1390 bool ProcessMouseDragged(const ui::MouseEvent& event); | 1395 bool ProcessMouseDragged(const ui::MouseEvent& event); |
1391 void ProcessMouseReleased(const ui::MouseEvent& event); | 1396 void ProcessMouseReleased(const ui::MouseEvent& event); |
1392 | 1397 |
1393 // Returns the ViewTargeter installed on |this| if one exists, | |
1394 // otherwise returns the ViewTargeter installed on our root view. | |
1395 // The return value is guaranteed to be non-null. | |
1396 ViewTargeter* GetEffectiveViewTargeter() const; | |
1397 | |
1398 // Accelerators -------------------------------------------------------------- | 1398 // Accelerators -------------------------------------------------------------- |
1399 | 1399 |
1400 // Registers this view's keyboard accelerators that are not registered to | 1400 // Registers this view's keyboard accelerators that are not registered to |
1401 // FocusManager yet, if possible. | 1401 // FocusManager yet, if possible. |
1402 void RegisterPendingAccelerators(); | 1402 void RegisterPendingAccelerators(); |
1403 | 1403 |
1404 // Unregisters all the keyboard accelerators associated with this view. | 1404 // Unregisters all the keyboard accelerators associated with this view. |
1405 // |leave_data_intact| if true does not remove data from accelerators_ array, | 1405 // |leave_data_intact| if true does not remove data from accelerators_ array, |
1406 // so it could be re-registered with other focus manager | 1406 // so it could be re-registered with other focus manager |
1407 void UnregisterAccelerators(bool leave_data_intact); | 1407 void UnregisterAccelerators(bool leave_data_intact); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 // Belongs to this view, but it's reference-counted on some platforms | 1591 // Belongs to this view, but it's reference-counted on some platforms |
1592 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1592 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1593 NativeViewAccessibility* native_view_accessibility_; | 1593 NativeViewAccessibility* native_view_accessibility_; |
1594 | 1594 |
1595 DISALLOW_COPY_AND_ASSIGN(View); | 1595 DISALLOW_COPY_AND_ASSIGN(View); |
1596 }; | 1596 }; |
1597 | 1597 |
1598 } // namespace views | 1598 } // namespace views |
1599 | 1599 |
1600 #endif // UI_VIEWS_VIEW_H_ | 1600 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |