FifeGUI 0.3.0
A C++ GUI library designed for games.
textinputevent.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
3
4#ifndef INCLUDE_FIFECHAN_TEXTINPUTEVENT_HPP_
5#define INCLUDE_FIFECHAN_TEXTINPUTEVENT_HPP_
6
7// Standard library includes
8#include <cstdint>
9#include <string>
10#include <utility>
11
12// Platform config include
13#include "fifechan/platform.hpp"
14
15// Project headers (subdirs before local)
16#include "fifechan/events/inputevent.hpp"
17
18namespace fcn
19{
35 class FIFEGUI_API TextInputEvent : public InputEvent
36 {
37 public:
41 enum class Type : std::uint8_t
42 {
43 Input = 0,
44 Editing
45 };
46
60 Widget* source,
61 Widget* distributor,
62 bool isShiftPressed,
63 bool isControlPressed,
64 bool isAltPressed,
65 bool isMetaPressed,
66 std::string text,
67 Type type = Type::Input);
68
74 std::string const & getText() const;
75
81 Type getType() const;
82
83 protected:
85 std::string mText;
86
89 };
90} // namespace fcn
91
92#endif // INCLUDE_FIFECHAN_TEXTINPUTEVENT_HPP_
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
Abstract interface for polling user input devices.
Definition input.hpp:37
Text input event for IME (input method editor) composition, dead keys, and pasted text.
Type
Text event types.
@ Input
Text was input (SDL_EVENT_TEXT_INPUT).
Type mType
The type of text event.
std::string mText
The UTF-8 text.
TextInputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, std::string text, Type type=Type::Input)
Constructor.
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition widget.hpp:56
Used replacement tokens by configure_file():