Loading...
Searching...
No Matches
Focusable.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave Smith on 3/21/26.
6//
7
8#ifndef MALENA_FOCUSABLE_H
9#define MALENA_FOCUSABLE_H
10
13#include <optional>
14namespace ml
15{
46 {
47 public:
54 void onFocus(std::function<void()> callback);
55
62 void onFocus(std::function<void(const std::optional<sf::Event>&)> callback);
63
70 void onBlur(std::function<void()> callback);
71
78 void onBlur(std::function<void(const std::optional<sf::Event>&)> callback);
79 };
80
81} // namespace ml
82
83#endif // MALENA_FOCUSABLE_H
Base class for all event-receiving traits.
Trait that adds keyboard-focus and blur callbacks to any Core object.
Definition Focusable.h:46
void onFocus(std::function< void(const std::optional< sf::Event > &)> callback)
Register a callback invoked when this component gains keyboard focus, receiving the raw SFML event.
void onBlur(std::function< void()> callback)
Register a no-argument callback invoked when this component loses keyboard focus.
void onBlur(std::function< void(const std::optional< sf::Event > &)> callback)
Register a callback invoked when this component loses keyboard focus, receiving the raw SFML event.
void onFocus(std::function< void()> callback)
Register a no-argument callback invoked when this component gains keyboard focus.
#define MALENA_API
Definition Component.h:22