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