Loading...
Searching...
No Matches
Focusable.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
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:
55 void onFocus(std::function<void()> callback, bool overwrite = true);
56
64 void onFocus(std::function<void(const std::optional<sf::Event>&)> callback, bool overwrite = true);
65
73 void onBlur(std::function<void()> callback, bool overwrite = true);
74
82 void onBlur(std::function<void(const std::optional<sf::Event>&)> callback, bool overwrite = true);
83 };
84
85} // namespace ml
86
87#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 onBlur(std::function< void(const std::optional< sf::Event > &)> callback, bool overwrite=true)
Register a callback invoked when this component loses keyboard focus, receiving the raw SFML event.
void onBlur(std::function< void()> callback, bool overwrite=true)
Register a no-argument callback invoked when this component loses keyboard focus.
void onFocus(std::function< void()> callback, bool overwrite=true)
Register a no-argument callback invoked when this component gains keyboard focus.
void onFocus(std::function< void(const std::optional< sf::Event > &)> callback, bool overwrite=true)
Register a callback invoked when this component gains keyboard focus, receiving the raw SFML event.
#define MALENA_API
Definition Component.h:22