Chromium Code Reviews| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Sets whether this view is capable of taking focus. It will clear focus if | 777 // Sets whether this view is capable of taking focus. It will clear focus if |
| 778 // the focused view is set to be non-focusable. | 778 // the focused view is set to be non-focusable. |
| 779 // Note that this is false by default so that a view used as a container does | 779 // Note that this is false by default so that a view used as a container does |
| 780 // not get the focus. | 780 // not get the focus. |
| 781 // Subclasses which represent controls should call | |
| 782 // PlatformStyle::SetControlStyleFocus to set focus correctly for different | |
| 783 // platforms. | |
| 781 void SetFocusable(bool focusable); | 784 void SetFocusable(bool focusable); |
|
tapted
2016/02/23 03:01:20
I think it's confusing to keep this method around
karandeepb
2016/03/15 02:19:51
I like the enum idea. I have created a new functio
tapted
2016/03/15 05:05:31
sgtm
| |
| 782 | 785 |
| 783 // Returns true if this view is |focusable_|, |enabled_| and drawn. | 786 // Returns true if this view is |focusable_|, |enabled_| and drawn. |
| 784 bool IsFocusable() const; | 787 bool IsFocusable() const; |
| 785 | 788 |
| 786 // Return whether this view is focusable when the user requires full keyboard | 789 // Return whether this view is focusable when the user requires full keyboard |
| 787 // access, even though it may not be normally focusable. | 790 // access, even though it may not be normally focusable. |
| 788 bool IsAccessibilityFocusable() const; | 791 bool IsAccessibilityFocusable() const; |
| 789 | 792 |
| 790 // Set whether this view can be made focusable if the user requires | 793 // Set whether this view can be made focusable if the user requires |
| 791 // full keyboard access, even though it's not normally focusable. It will | 794 // full keyboard access, even though it's not normally focusable. It will |
| 792 // clear focus if the focused view is set to be non-focusable. | 795 // clear focus if the focused view is set to be non-focusable. |
| 793 // Note that this is false by default. | 796 // Note that this is false by default. |
| 797 // Subclasses which represent controls should call | |
| 798 // PlatformStyle::SetControlStyleFocus to set focus correctly for different | |
| 799 // platforms. | |
| 794 void SetAccessibilityFocusable(bool accessibility_focusable); | 800 void SetAccessibilityFocusable(bool accessibility_focusable); |
| 795 | 801 |
| 796 // Convenience method to retrieve the FocusManager associated with the | 802 // Convenience method to retrieve the FocusManager associated with the |
| 797 // Widget that contains this view. This can return NULL if this view is not | 803 // Widget that contains this view. This can return NULL if this view is not |
| 798 // part of a view hierarchy with a Widget. | 804 // part of a view hierarchy with a Widget. |
| 799 virtual FocusManager* GetFocusManager(); | 805 virtual FocusManager* GetFocusManager(); |
| 800 virtual const FocusManager* GetFocusManager() const; | 806 virtual const FocusManager* GetFocusManager() const; |
| 801 | 807 |
| 802 // Request keyboard focus. The receiving view will become the focused view. | 808 // Request keyboard focus. The receiving view will become the focused view. |
| 803 virtual void RequestFocus(); | 809 virtual void RequestFocus(); |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1574 // Belongs to this view, but it's reference-counted on some platforms | 1580 // Belongs to this view, but it's reference-counted on some platforms |
| 1575 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1581 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
| 1576 NativeViewAccessibility* native_view_accessibility_; | 1582 NativeViewAccessibility* native_view_accessibility_; |
| 1577 | 1583 |
| 1578 DISALLOW_COPY_AND_ASSIGN(View); | 1584 DISALLOW_COPY_AND_ASSIGN(View); |
| 1579 }; | 1585 }; |
| 1580 | 1586 |
| 1581 } // namespace views | 1587 } // namespace views |
| 1582 | 1588 |
| 1583 #endif // UI_VIEWS_VIEW_H_ | 1589 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |