mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Initial commit
This commit is contained in:
32
arm9/source/gui/FocusManager.h
Normal file
32
arm9/source/gui/FocusManager.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
class View;
|
||||
class InputProvider;
|
||||
|
||||
/// @brief Class for managing focus.
|
||||
class FocusManager
|
||||
{
|
||||
public:
|
||||
/// @brief Focuses the given view.
|
||||
/// @param newFocus The view to focus.
|
||||
void Focus(View* newFocus);
|
||||
|
||||
/// @brief Clears the current focus.
|
||||
void Unfocus();
|
||||
|
||||
/// @brief Updates the focus using the given input provider.
|
||||
/// @param inputProvider The input provider to use.
|
||||
void Update(const InputProvider& inputProvider);
|
||||
|
||||
/// @brief Gets the currently focused view.
|
||||
/// @return A pointer to the view that is currently focused, or null if none.
|
||||
constexpr View* GetCurrentFocus() const { return _currentFocus; }
|
||||
|
||||
/// @brief Checks whether the current focus lies inside the given view.
|
||||
/// @param view The view to check for.
|
||||
/// @return True if the current focus lies inside the given view, or false otherwise.
|
||||
bool IsFocusInside(const View* view) const;
|
||||
|
||||
private:
|
||||
View* _currentFocus = nullptr;
|
||||
};
|
||||
Reference in New Issue
Block a user