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

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

Issue 129863002: Makes View::focusable() return last value supplied to SetFocusable() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views_examples Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/examples/button_example.cc ('k') | ui/views/view_unittest.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 <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // Note that by default views are linked in the order they have been added to 766 // 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. 767 // their container. Use this method if you want to modify the order.
768 // IMPORTANT NOTE: loops in the focus hierarchy are not supported. 768 // IMPORTANT NOTE: loops in the focus hierarchy are not supported.
769 void SetNextFocusableView(View* view); 769 void SetNextFocusableView(View* view);
770 770
771 // Sets whether this view is capable of taking focus. 771 // Sets whether this view is capable of taking focus.
772 // Note that this is false by default so that a view used as a container does 772 // Note that this is false by default so that a view used as a container does
773 // not get the focus. 773 // not get the focus.
774 void SetFocusable(bool focusable); 774 void SetFocusable(bool focusable);
775 775
776 // Returns true if this view is capable of taking focus.
777 bool focusable() const { return focusable_ && enabled_ && visible_; }
778
779 // Returns true if this view is |focusable_|, |enabled_| and drawn. 776 // Returns true if this view is |focusable_|, |enabled_| and drawn.
780 virtual bool IsFocusable() const; 777 virtual bool IsFocusable() const;
781 778
782 // Return whether this view is focusable when the user requires full keyboard 779 // Return whether this view is focusable when the user requires full keyboard
783 // access, even though it may not be normally focusable. 780 // access, even though it may not be normally focusable.
784 bool IsAccessibilityFocusable() const; 781 bool IsAccessibilityFocusable() const;
785 782
786 // Set whether this view can be made focusable if the user requires 783 // Set whether this view can be made focusable if the user requires
787 // full keyboard access, even though it's not normally focusable. 784 // full keyboard access, even though it's not normally focusable.
788 // Note that this is false by default. 785 // Note that this is false by default.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 virtual bool HasHitTestMask() const; 1132 virtual bool HasHitTestMask() const;
1136 1133
1137 // Called by HitTestRect() to retrieve a mask for hit-testing against. 1134 // Called by HitTestRect() to retrieve a mask for hit-testing against.
1138 // Subclasses override to provide custom shaped hit test regions. 1135 // Subclasses override to provide custom shaped hit test regions.
1139 virtual void GetHitTestMask(HitTestSource source, gfx::Path* mask) const; 1136 virtual void GetHitTestMask(HitTestSource source, gfx::Path* mask) const;
1140 1137
1141 virtual DragInfo* GetDragInfo(); 1138 virtual DragInfo* GetDragInfo();
1142 1139
1143 // Focus --------------------------------------------------------------------- 1140 // Focus ---------------------------------------------------------------------
1144 1141
1142 // Returns last value passed to SetFocusable(). Use IsFocusable() to determine
1143 // if a view can take focus right now.
1144 bool focusable() const { return focusable_; }
1145
1145 // Override to be notified when focus has changed either to or from this View. 1146 // Override to be notified when focus has changed either to or from this View.
1146 virtual void OnFocus(); 1147 virtual void OnFocus();
1147 virtual void OnBlur(); 1148 virtual void OnBlur();
1148 1149
1149 // Handle view focus/blur events for this view. 1150 // Handle view focus/blur events for this view.
1150 void Focus(); 1151 void Focus();
1151 void Blur(); 1152 void Blur();
1152 1153
1153 // System events ------------------------------------------------------------- 1154 // System events -------------------------------------------------------------
1154 1155
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 // Belongs to this view, but it's reference-counted on some platforms 1560 // Belongs to this view, but it's reference-counted on some platforms
1560 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1561 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1561 NativeViewAccessibility* native_view_accessibility_; 1562 NativeViewAccessibility* native_view_accessibility_;
1562 1563
1563 DISALLOW_COPY_AND_ASSIGN(View); 1564 DISALLOW_COPY_AND_ASSIGN(View);
1564 }; 1565 };
1565 1566
1566 } // namespace views 1567 } // namespace views
1567 1568
1568 #endif // UI_VIEWS_VIEW_H_ 1569 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/examples/button_example.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698