| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // Returns the view that should be selected next when pressing Shift-Tab. | 767 // Returns the view that should be selected next when pressing Shift-Tab. |
| 768 View* GetPreviousFocusableView(); | 768 View* GetPreviousFocusableView(); |
| 769 | 769 |
| 770 // Sets the component that should be selected next when pressing Tab, and | 770 // Sets the component that should be selected next when pressing Tab, and |
| 771 // makes the current view the precedent view of the specified one. | 771 // makes the current view the precedent view of the specified one. |
| 772 // Note that by default views are linked in the order they have been added to | 772 // Note that by default views are linked in the order they have been added to |
| 773 // their container. Use this method if you want to modify the order. | 773 // their container. Use this method if you want to modify the order. |
| 774 // IMPORTANT NOTE: loops in the focus hierarchy are not supported. | 774 // IMPORTANT NOTE: loops in the focus hierarchy are not supported. |
| 775 void SetNextFocusableView(View* view); | 775 void SetNextFocusableView(View* view); |
| 776 | 776 |
| 777 // Returns last set focus behavior. |
| 778 FocusBehavior focus_behavior() const { return focus_behavior_; } |
| 777 // Sets |focus_behavior| and advances focus if necessary. | 779 // Sets |focus_behavior| and advances focus if necessary. |
| 778 void SetFocusBehavior(FocusBehavior focus_behavior); | 780 void SetFocusBehavior(FocusBehavior focus_behavior); |
| 779 | 781 |
| 780 // Returns true if this view is focusable, |enabled_| and drawn. | 782 // Returns true if this view is focusable, |enabled_| and drawn. |
| 781 bool IsFocusable() const; | 783 bool IsFocusable() const; |
| 782 | 784 |
| 783 // Return whether this view is focusable when the user requires full keyboard | 785 // Return whether this view is focusable when the user requires full keyboard |
| 784 // access, even though it may not be normally focusable. | 786 // access, even though it may not be normally focusable. |
| 785 bool IsAccessibilityFocusable() const; | 787 bool IsAccessibilityFocusable() const; |
| 786 | 788 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 // Invoked from DoDrag after the drag completes. This implementation does | 935 // Invoked from DoDrag after the drag completes. This implementation does |
| 934 // nothing, and is intended for subclasses to do cleanup. | 936 // nothing, and is intended for subclasses to do cleanup. |
| 935 virtual void OnDragDone(); | 937 virtual void OnDragDone(); |
| 936 | 938 |
| 937 // Returns true if the mouse was dragged enough to start a drag operation. | 939 // Returns true if the mouse was dragged enough to start a drag operation. |
| 938 // delta_x and y are the distance the mouse was dragged. | 940 // delta_x and y are the distance the mouse was dragged. |
| 939 static bool ExceededDragThreshold(const gfx::Vector2d& delta); | 941 static bool ExceededDragThreshold(const gfx::Vector2d& delta); |
| 940 | 942 |
| 941 // Accessibility ------------------------------------------------------------- | 943 // Accessibility ------------------------------------------------------------- |
| 942 | 944 |
| 945 // Gets the NativeViewAccessibility instance for this view, and creates one if |
| 946 // it doesn't yet exist. |
| 947 NativeViewAccessibility* GetNativeViewAccessibility(); |
| 948 |
| 943 // Modifies |state| to reflect the current accessible state of this view. | 949 // Modifies |state| to reflect the current accessible state of this view. |
| 944 virtual void GetAccessibleState(ui::AXViewState* state) { } | 950 virtual void GetAccessibleState(ui::AXViewState* state) { } |
| 945 | 951 |
| 946 // Returns an instance of the native accessibility interface for this view. | 952 // Returns an instance of the native accessibility interface for this view. |
| 947 virtual gfx::NativeViewAccessible GetNativeViewAccessible(); | 953 virtual gfx::NativeViewAccessible GetNativeViewAccessible(); |
| 948 | 954 |
| 949 // Notifies assistive technology that an accessibility event has | 955 // Notifies assistive technology that an accessibility event has |
| 950 // occurred on this view, such as when the view is focused or when its | 956 // occurred on this view, such as when the view is focused or when its |
| 951 // value changes. Pass true for |send_native_event| except for rare | 957 // value changes. Pass true for |send_native_event| except for rare |
| 952 // cases where the view is a native control that's already sending a | 958 // cases where the view is a native control that's already sending a |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 // with an associated view. Widget::ReorderNativeViews() may reorder layers | 1138 // with an associated view. Widget::ReorderNativeViews() may reorder layers |
| 1133 // below layers owned by a view. | 1139 // below layers owned by a view. |
| 1134 virtual void ReorderChildLayers(ui::Layer* parent_layer); | 1140 virtual void ReorderChildLayers(ui::Layer* parent_layer); |
| 1135 | 1141 |
| 1136 // Input --------------------------------------------------------------------- | 1142 // Input --------------------------------------------------------------------- |
| 1137 | 1143 |
| 1138 virtual DragInfo* GetDragInfo(); | 1144 virtual DragInfo* GetDragInfo(); |
| 1139 | 1145 |
| 1140 // Focus --------------------------------------------------------------------- | 1146 // Focus --------------------------------------------------------------------- |
| 1141 | 1147 |
| 1142 // Returns last set focus behavior. | |
| 1143 FocusBehavior focus_behavior() const { return focus_behavior_; } | |
| 1144 | |
| 1145 // Override to be notified when focus has changed either to or from this View. | 1148 // Override to be notified when focus has changed either to or from this View. |
| 1146 virtual void OnFocus(); | 1149 virtual void OnFocus(); |
| 1147 virtual void OnBlur(); | 1150 virtual void OnBlur(); |
| 1148 | 1151 |
| 1149 // Handle view focus/blur events for this view. | 1152 // Handle view focus/blur events for this view. |
| 1150 void Focus(); | 1153 void Focus(); |
| 1151 void Blur(); | 1154 void Blur(); |
| 1152 | 1155 |
| 1153 // System events ------------------------------------------------------------- | 1156 // System events ------------------------------------------------------------- |
| 1154 | 1157 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 // Belongs to this view, but it's reference-counted on some platforms | 1567 // Belongs to this view, but it's reference-counted on some platforms |
| 1565 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1568 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
| 1566 NativeViewAccessibility* native_view_accessibility_; | 1569 NativeViewAccessibility* native_view_accessibility_; |
| 1567 | 1570 |
| 1568 DISALLOW_COPY_AND_ASSIGN(View); | 1571 DISALLOW_COPY_AND_ASSIGN(View); |
| 1569 }; | 1572 }; |
| 1570 | 1573 |
| 1571 } // namespace views | 1574 } // namespace views |
| 1572 | 1575 |
| 1573 #endif // UI_VIEWS_VIEW_H_ | 1576 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |