FifeGUI 0.3.0
A C++ GUI library designed for games.
fcn::TextInputEvent Class Reference

#include <textinputevent.hpp>

Inheritance diagram for fcn::TextInputEvent:
fcn::InputEvent fcn::Event

Public Types

enum class  Type : std::uint8_t { Input = 0 , Editing }

Public Member Functions

std::string const & getText () const
Type getType () const
 TextInputEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, std::string text, Type type=Type::Input)
Public Member Functions inherited from fcn::InputEvent
void consume ()
WidgetgetDistributor () const
uint16_t getModMask () const
 InputEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
bool isAltPressed () const
bool isConsumed () const
bool isControlPressed () const
bool isMetaPressed () const
bool isShiftPressed () const
Public Member Functions inherited from fcn::Event
 Event (Widget *source)
WidgetgetSource () const

Protected Attributes

std::string mText
Type mType {Type::Input}
Protected Attributes inherited from fcn::InputEvent
WidgetmDistributor
bool mIsConsumed
uint16_t mModMask {0}
Protected Attributes inherited from fcn::Event
WidgetmSource {nullptr}

Additional Inherited Members

Static Public Attributes inherited from fcn::InputEvent
static constexpr uint16_t ModAlt = 1 << 2
static constexpr uint16_t ModControl = 1 << 1
static constexpr uint16_t ModMeta = 1 << 3
static constexpr uint16_t ModShift = 1 << 0

Detailed Description

Text input event for IME (input method editor) composition, dead keys, and pasted text.

Fired on SDL_EVENT_TEXT_INPUT. Carries UTF-8 text and remains separate from KeyEvent so composed input is not collapsed into a single keycode.

Inherits InputEvent, including modifier-state queries (isShiftPressed(), etc.) and the consume() mechanism. This allows IME-aware widgets such as TextField to consume text input before the originating keystrokes are processed as hotkeys.

Definition at line 35 of file textinputevent.hpp.

Member Enumeration Documentation

◆ Type

enum class fcn::TextInputEvent::Type : std::uint8_t
strong

Text event types.

Enumerator
Input 

Text was input (SDL_EVENT_TEXT_INPUT).

Editing 

IME composition in progress (SDL_EVENT_TEXT_EDITING).

Definition at line 41 of file textinputevent.hpp.

Constructor & Destructor Documentation

◆ TextInputEvent()

fcn::TextInputEvent::TextInputEvent ( Widget * source,
Widget * distributor,
bool isShiftPressed,
bool isControlPressed,
bool isAltPressed,
bool isMetaPressed,
std::string text,
Type type = Type::Input )

Constructor.

Parameters
sourceThe source widget.
distributorThe distributor of the event.
isShiftPressedTrue if shift is pressed.
isControlPressedTrue if control is pressed.
isAltPressedTrue if alt is pressed.
isMetaPressedTrue if meta is pressed.
textThe UTF-8 text that was input.
typeThe type of text event.

Definition at line 13 of file textinputevent.cpp.

References fcn::InputEvent::InputEvent(), fcn::InputEvent::isAltPressed(), fcn::InputEvent::isControlPressed(), fcn::InputEvent::isMetaPressed(), fcn::InputEvent::isShiftPressed(), mText, and mType.

Member Function Documentation

◆ getText()

std::string const & fcn::TextInputEvent::getText ( ) const

Gets the text of the event.

Returns
The UTF-8 text.

Definition at line 28 of file textinputevent.cpp.

References mText.

◆ getType()

TextInputEvent::Type fcn::TextInputEvent::getType ( ) const

Gets the type of text event.

Returns
The type.

Definition at line 33 of file textinputevent.cpp.

References mType.

Member Data Documentation

◆ mText

std::string fcn::TextInputEvent::mText
protected

The UTF-8 text.

Definition at line 85 of file textinputevent.hpp.

Referenced by getText(), and TextInputEvent().

◆ mType

Type fcn::TextInputEvent::mType {Type::Input}
protected

The type of text event.

Definition at line 88 of file textinputevent.hpp.

Referenced by getType(), and TextInputEvent().


The documentation for this class was generated from the following files: