Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: ui/views/view.h

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failing tests. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // 108 //
109 ///////////////////////////////////////////////////////////////////////////// 109 /////////////////////////////////////////////////////////////////////////////
110 class VIEWS_EXPORT View : public ui::LayerDelegate, 110 class VIEWS_EXPORT View : public ui::LayerDelegate,
111 public ui::LayerOwner, 111 public ui::LayerOwner,
112 public ui::AcceleratorTarget, 112 public ui::AcceleratorTarget,
113 public ui::EventTarget, 113 public ui::EventTarget,
114 public ui::EventHandler { 114 public ui::EventHandler {
115 public: 115 public:
116 typedef std::vector<View*> Views; 116 typedef std::vector<View*> Views;
117 117
118 enum class FocusBehavior {
119 // Use when the view is to be focusable both in default and full keyboard
120 // access mode.
121 ALWAYS,
122
123 // Use when view is never focusable. Default.
124 NEVER,
125
126 // Use when the view is to be made focusable only during full keyboard mode.
127 ACCESSIBLE_ONLY,
128
129 // Use for controls. On Mac, this is the same as ACCESSIBLE_ONLY mode, while
130 // on other platforms it corresponds to ALWAYS.
131 CONTROL,
sky 2016/04/12 16:39:52 CONTROL sounds good, but in practice it is really
132 };
133
118 struct ViewHierarchyChangedDetails { 134 struct ViewHierarchyChangedDetails {
119 ViewHierarchyChangedDetails() 135 ViewHierarchyChangedDetails()
120 : is_add(false), 136 : is_add(false),
121 parent(NULL), 137 parent(NULL),
122 child(NULL), 138 child(NULL),
123 move_view(NULL) {} 139 move_view(NULL) {}
124 140
125 ViewHierarchyChangedDetails(bool is_add, 141 ViewHierarchyChangedDetails(bool is_add,
126 View* parent, 142 View* parent,
127 View* child, 143 View* child,
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 // Returns the view that should be selected next when pressing Shift-Tab. 777 // Returns the view that should be selected next when pressing Shift-Tab.
762 View* GetPreviousFocusableView(); 778 View* GetPreviousFocusableView();
763 779
764 // Sets the component that should be selected next when pressing Tab, and 780 // Sets the component that should be selected next when pressing Tab, and
765 // makes the current view the precedent view of the specified one. 781 // makes the current view the precedent view of the specified one.
766 // Note that by default views are linked in the order they have been added to 782 // Note that by default views are linked in the order they have been added to
767 // their container. Use this method if you want to modify the order. 783 // their container. Use this method if you want to modify the order.
768 // IMPORTANT NOTE: loops in the focus hierarchy are not supported. 784 // IMPORTANT NOTE: loops in the focus hierarchy are not supported.
769 void SetNextFocusableView(View* view); 785 void SetNextFocusableView(View* view);
770 786
787 // Sets |focusable_| and |accessibility_focusable_| corresponding to the given
788 // |focus_behavior|.
789 void SetFocusBehavior(FocusBehavior focus_behavior);
790
771 // Sets whether this view is capable of taking focus. It will clear focus if 791 // Sets whether this view is capable of taking focus. It will clear focus if
772 // the focused view is set to be non-focusable. 792 // the focused view is set to be non-focusable.
773 // Note that this is false by default so that a view used as a container does 793 // Note that this is false by default so that a view used as a container does
774 // not get the focus. 794 // not get the focus.
795 // TODO(karandeepb): Make private.
775 void SetFocusable(bool focusable); 796 void SetFocusable(bool focusable);
776 797
777 // Returns true if this view is |focusable_|, |enabled_| and drawn. 798 // Returns true if this view is |focusable_|, |enabled_| and drawn.
778 bool IsFocusable() const; 799 bool IsFocusable() const;
779 800
780 // Return whether this view is focusable when the user requires full keyboard 801 // Return whether this view is focusable when the user requires full keyboard
781 // access, even though it may not be normally focusable. 802 // access, even though it may not be normally focusable.
782 bool IsAccessibilityFocusable() const; 803 bool IsAccessibilityFocusable() const;
783 804
784 // Set whether this view can be made focusable if the user requires 805 // Set whether this view can be made focusable if the user requires
785 // full keyboard access, even though it's not normally focusable. It will 806 // full keyboard access, even though it's not normally focusable. It will
786 // clear focus if the focused view is set to be non-focusable. 807 // clear focus if the focused view is set to be non-focusable.
787 // Note that this is false by default. 808 // Note that this is false by default.
809 // TODO(karandeepb): Make private.
788 void SetAccessibilityFocusable(bool accessibility_focusable); 810 void SetAccessibilityFocusable(bool accessibility_focusable);
789 811
790 // Convenience method to retrieve the FocusManager associated with the 812 // Convenience method to retrieve the FocusManager associated with the
791 // Widget that contains this view. This can return NULL if this view is not 813 // Widget that contains this view. This can return NULL if this view is not
792 // part of a view hierarchy with a Widget. 814 // part of a view hierarchy with a Widget.
793 virtual FocusManager* GetFocusManager(); 815 virtual FocusManager* GetFocusManager();
794 virtual const FocusManager* GetFocusManager() const; 816 virtual const FocusManager* GetFocusManager() const;
795 817
796 // Request keyboard focus. The receiving view will become the focused view. 818 // Request keyboard focus. The receiving view will become the focused view.
797 virtual void RequestFocus(); 819 virtual void RequestFocus();
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // Belongs to this view, but it's reference-counted on some platforms 1592 // Belongs to this view, but it's reference-counted on some platforms
1571 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1593 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1572 NativeViewAccessibility* native_view_accessibility_; 1594 NativeViewAccessibility* native_view_accessibility_;
1573 1595
1574 DISALLOW_COPY_AND_ASSIGN(View); 1596 DISALLOW_COPY_AND_ASSIGN(View);
1575 }; 1597 };
1576 1598
1577 } // namespace views 1599 } // namespace views
1578 1600
1579 #endif // UI_VIEWS_VIEW_H_ 1601 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698