OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_ | |
6 #define MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_ | |
7 | |
8 #include "mojo/services/public/cpp/view_manager/types.h" | |
9 #include "mojo/services/public/cpp/view_manager/view.h" | |
10 | |
11 namespace mojo { | |
12 | |
13 class FocusRules { | |
sky
2014/11/10 20:45:30
Description?
| |
14 public: | |
15 virtual ~FocusRules() {} | |
16 | |
17 // Returns true if |view| is a toplevel view. Whether or not a view | |
18 // is considered toplevel is determined by a similar set of rules that | |
19 // govern activation and focus. Not all toplevel views are activatable, | |
20 // call CanActivateView() to determine if a view can be activated. | |
21 virtual bool IsToplevelView(View* view) const = 0; | |
22 // Returns true if |view| can be activated or focused. | |
23 virtual bool CanActivateView(View* view) const = 0; | |
24 // For CanFocusView(), NULL is supported, because NULL is a valid focusable | |
25 // view (in the case of clearing focus). | |
26 virtual bool CanFocusView(View* view) const = 0; | |
27 | |
28 // Returns the toplevel view containing |view|. Not all toplevel views | |
29 // are activatable, call GetActivatableView() instead to return the | |
30 // activatable view, which might be in a different hierarchy. | |
31 // Will return NULL if |view| is not contained by a view considered to be | |
32 // a toplevel view. | |
33 virtual View* GetToplevelView(View* view) const = 0; | |
34 // Returns the activatable or focusable view given an attempt to activate or | |
35 // focus |view|. Some possible scenarios (not intended to be exhaustive): | |
36 // - |view| is a child of a non-focusable view and so focus must be set | |
37 // according to rules defined by the delegate, e.g. to a parent. | |
38 // - |view| is an activatable view that is the transient parent of a modal | |
39 // view, so attempts to activate |view| should result in the modal | |
40 // transient being activated instead. | |
41 // These methods may return NULL if they are unable to find an activatable | |
42 // or focusable view given |view|. | |
43 virtual View* GetActivatableView(View* view) const = 0; | |
44 virtual View* GetFocusableView(View* view) const = 0; | |
45 | |
46 // Returns the next view to activate in the event that |ignore| is no longer | |
47 // activatable. This function is called when something is happening to | |
48 // |ignore| that means it can no longer have focus or activation, including | |
49 // but not limited to: | |
50 // - it or its parent hierarchy is being hidden, or removed from the | |
51 // RootView. | |
52 // - it is being destroyed. | |
53 // - it is being explicitly deactivated. | |
54 // |ignore| cannot be NULL. | |
55 virtual View* GetNextActivatableView(View* ignore) const = 0; | |
56 }; | |
57 | |
58 } // namespace mojo | |
59 | |
60 #endif // MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_ | |
OLD | NEW |