An interface for a focus engine. Focus engines manage focus navigation within You.i Engine.
A focus engine instance is created as part of the app's initialization.
#include <focus/YiFocusEngine.h>
Public Types | |
enum | FocusabilityStatus { FocusabilityStatus::CanBeFocused = 0x00, FocusabilityStatus::ViewNull = 0x01, FocusabilityStatus::ViewNotFocusable = 0x02, FocusabilityStatus::ViewInvisible = 0x04, FocusabilityStatus::ViewNotStaged = 0x08, FocusabilityStatus::FocusEngineSpecific = 0x10 } |
Public Attributes | |
CYISignal< CYISceneView * > | ViewWithFocusChanged |
|
strong |
An enum that lists the possible focusability states for a view.
Enumerator | |
---|---|
CanBeFocused | The view can be focused. |
ViewNull | The view can't be focused because it's null. |
ViewNotFocusable | The view can't be focused because it's not marked as focusable.
|
ViewInvisible | The view can't be focused because it's invisible.
|
ViewNotStaged | The view can't be focused because it's not part of the scene tree.
|
FocusEngineSpecific | The view can't be focused due to an unspecified focus engine-specific reason. |
CYIFocusEngine::CYIFocusEngine | ( | ) |
|
virtualdefault |
bool CYIFocusEngine::CanBeFocused | ( | const CYISceneView * | pView | ) | const |
Returns true if the given view can receive focus.
In order to receive focus a view must be reachable, have its visibility set to true, and be set to focusable.
|
pure virtual |
Cancels any in-progress trackpad swipes.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Clears the currently focused view, if any.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Finds the next view that can take focus in direction direction, searching from pSearchFrom. If pSearchFrom is nullptr, a search from 'nothing' is performed. Returns nullptr if no new focus target could be found.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Returns details about whether a view can be focused.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Returns the view that currently has focus, or null if no view has focus.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
CYISceneView* CYIFocusEngine::GetViewWithFocus | ( | ) |
Returns the view that currently has focus, or null if no view has focus.
const CYISceneView* CYIFocusEngine::GetViewWithFocus | ( | const CYISceneNode * | pRootNode | ) | const |
Returns the view that currently has focus, or null if no view has focus. Returns null if the view with focus is not a descendant of pRootNode and is not pRootNode itself.
CYISceneView* CYIFocusEngine::GetViewWithFocus | ( | const CYISceneNode * | pRootNode | ) |
Returns the view that currently has focus, or null if no view has focus. Returns null if the view with focus is not a descendant of pRootNode and is not pRootNode itself.
|
pure virtual |
Handles focus changes given a CYIEvent::Type::KeyDown event.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Handles focus changes given a trackpad event. This generates focus moves requests (as necessary) as the trackpad events are received.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Initializes this focus engine. Returns false if initialization failed.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
'Moves' the focus in direction direction, relative to the view that currently has focus. If no view currently has focus, a focus search is started from the current focus root.
options can be used to further restrict the set of valid focus candidates.
Returns true if focus was successfully moved.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Requests that pViewToFocus receive focus. The view will receive focus if it is focusable. Returns true if pViewToFocus obtained focus or had focus before the request.
For a view to take focus, it must meet the following requirements: it is visible, attached to the tree, and focusable.
focusRootRule dictates whether the focus system will allow the focus request to move to a view outside of the current focus root. When CYIFocus::FocusRootRule::DescendantsUpdateContext is provided this method will return true if pViewToFocus's focus root is updated with pViewToFocus as the current focus in that context.
pViewToFocus must be non-null. If focus needs to be cleared, ClearFocus can be used.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
|
pure virtual |
Called by CYISceneManager after the scene tree is updated. This allows the focus engine to update focus after modifications have been made to the scene tree.
Implemented in CYIYouiFocusEngine, and CYINullFocusEngine.
CYISignal<CYISceneView *> CYIFocusEngine::ViewWithFocusChanged |
A signal called whenever the view with focus has changed. This signal may be called with null when no view has focus. Unlike CYIEvent::Type::FocusIn and CYIEvent::Type::FocusOut, this function is called synchronously as soon as the focus is moved.