17#ifndef _FGE_C_OBJTEXTINPUTBOX_HPP_INCLUDED
18#define _FGE_C_OBJTEXTINPUTBOX_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_guiElement.hpp"
22#include "FastEngine/object/C_objRectangleShape.hpp"
23#include "FastEngine/object/C_objText.hpp"
24#include "FastEngine/object/C_object.hpp"
26#define FGE_OBJTEXTINBOX_CLASSNAME "FGE:OBJ:TEXTINBOX"
36 uint16_t maxLength = 10,
37 fge::Vector2f
const& pos = fge::Vector2f());
41 fge::
GuiElement* getGuiElement()
override {
return this; }
43 void setString(tiny_utf8::string
string);
45 void setCharacterSize(fge::CharacterSize size);
46 void setHideTextFlag(
bool flag);
47 void setMaxLength(uint16_t length);
49 void setActiveStat(
bool active);
51 void setBoxSize(fge::Vector2f
const& size);
52 void setBoxSize(
float w,
float h);
55 void setBoxOutlineColor(
fge::Color const& color);
58 tiny_utf8::string
const& getString()
const;
59 fge::CharacterSize getCharacterSize()
const;
60 bool isTextHide()
const;
61 uint16_t getMaxLength()
const;
63 bool getActiveStat()
const;
65 fge::Vector2f
const& getBoxSize()
const;
73 FGE_OBJ_UPDATE_DECLARE
93 void onTextInput(
fge::Event const& evt, SDL_TextInputEvent
const& arg);
94 void onKeyDown(
fge::Event const& evt, SDL_KeyboardEvent
const& arg);
98 std::chrono::milliseconds g_cursorBlinkTime{0};
100 uint16_t g_maxLength{10};
106 tiny_utf8::string g_string;
111 fge::Vector2f g_boxSize{120.0f, 18.0f};
113 bool g_statActive{
false};
This class is used to handle callbacks in a safe way.
Definition C_callback.hpp:189
Definition C_color.hpp:35
static Color const Black
Black predefined color.
Definition C_color.hpp:140
static Color const White
White predefined color.
Definition C_color.hpp:141
This class is a wrapper for SDL events.
Definition C_event.hpp:59
This class is a wrapper for the font manager to allow easy manipulation.
Definition C_font.hpp:35
A class to handle highest priority selection of GUI elements.
Definition C_guiElement.hpp:235
A base class for all GUI elements.
Definition C_guiElement.hpp:120
Definition C_objRectangleShape.hpp:36
Definition C_objTextinputbox.hpp:32
char const * getReadableClassName() const override
Get a readable version of the class name.
fge::RectFloat getGlobalBounds() const override
Get the global bounds of the object.
void callbackRegister(fge::Event &event, fge::GuiElementHandler *guiElementHandlerPtr) override
Ask the object to register all callbacks it needs to receive events.
fge::RectFloat getLocalBounds() const override
Get the local bounds of the object (without any transformations)
void load(nlohmann::json &jsonObject, fge::Scene *scene) override
Load the object from a json object.
void pack(fge::net::Packet &pck) override
Pack the object into a packet.
char const * getClassName() const override
Get the unique class name of the object.
FGE_OBJ_UPDATE_DECLARE FGE_OBJ_DRAW_DECLARE void save(nlohmann::json &jsonObject, fge::Scene *scene) override
Save the object to a json object.
void unpack(fge::net::Packet const &pck) override
Unpack the object from a packet.
Definition C_objText.hpp:90
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
A scene contain a collection of object and handle them.
Definition C_scene.hpp:450
This class is a useful utility to "link" multiple objects around.
Definition C_subscription.hpp:150
Definition C_packet.hpp:70
Definition C_guiElement.hpp:45