1#ifndef SCREEN_TEXT_ENTRY_H
2#define SCREEN_TEXT_ENTRY_H
6#include "Etterna/Actor/Base/BitmapText.h"
7#include "Etterna/Models/Misc/InputEventPlus.h"
8#include "RageUtil/Sound/RageSound.h"
9#include "ScreenWithMenuElements.h"
10#include "Etterna/Models/Misc/ThemeMetric.h"
27#define FOREACH_KeyboardRow(i) FOREACH_ENUM(KeyboardRow, i)
29const int KEYS_PER_ROW = 13;
31enum KeyboardRowSpecialKey
43 void SetTextEntrySettings(
44 std::string sQuestion,
45 std::string sInitialAnswer,
47 bool (*Validate)(
const std::string& sAnswer,
48 std::string& sErrorOut) =
nullptr,
49 void (*OnOK)(
const std::string& sAnswer) =
nullptr,
50 void (*OnCancel)() =
nullptr,
51 bool bPassword =
false,
52 bool (*ValidateAppend)(
const std::string& sAnswerBeforeChar,
53 const std::string& sAppend) =
nullptr,
54 std::string (*FormatAnswerForDisplay)(
const std::string& sAnswer) =
56 void SetTextEntrySettings(
57 std::string sQuestion,
58 std::string sInitialAnswer,
65 bool (*Validate)(
const std::string& sAnswer,
66 std::string& sErrorOut) =
nullptr,
67 void (*OnOK)(
const std::string& sAnswer) =
nullptr,
68 void (*OnCancel)() =
nullptr,
69 bool bPassword =
false,
70 bool (*ValidateAppend)(
const std::string& sAnswerBeforeChar,
71 const std::string& sAppend) =
nullptr,
72 std::string (*FormatAnswerForDisplay)(
const std::string& sAnswer) =
74 static void TextEntry(
75 ScreenMessage smSendOnPop,
76 std::string sQuestion,
77 std::string sInitialAnswer,
79 bool (*Validate)(
const std::string& sAnswer,
80 std::string& sErrorOut) =
nullptr,
81 void (*OnOK)(
const std::string& sAnswer) =
nullptr,
82 void (*OnCancel)() =
nullptr,
83 bool bPassword =
false,
84 bool (*ValidateAppend)(
const std::string& sAnswerBeforeChar,
85 const std::string& sAppend) =
nullptr,
86 std::string (*FormatAnswerForDisplay)(
const std::string& sAnswer) =
88 static void Password(ScreenMessage smSendOnPop,
89 const std::string& sQuestion,
90 void (*OnOK)(
const std::string& sPassword) =
nullptr,
91 void (*OnCancel)() =
nullptr)
93 TextEntry(std::move(smSendOnPop),
113 , FormatAnswerForDisplay()
116 ScreenMessage smSendOnPop;
117 std::string sQuestion;
118 std::string sInitialAnswer;
119 int iMaxInputLength{ 0 };
136 void FromStack(lua_State* L);
138 void LoadFromTextEntrySettings(
const TextEntrySettings& settings);
140 static bool FloatValidate(
const std::string& sAnswer,
141 std::string& sErrorOut);
142 static bool IntValidate(
const std::string& sAnswer, std::string& sErrorOut);
144 std::string sQuestion{
"" };
145 std::string sInitialAnswer{
"" };
146 int iMaxInputLength{ 0 };
147 bool (*pValidate)(
const std::string& sAnswer,
148 std::string& sErrorOut){
nullptr };
149 void (*pOnOK)(
const std::string& sAnswer){
nullptr };
150 void (*pOnCancel)(){
nullptr };
151 bool bPassword{
false };
152 bool (*pValidateAppend)(
const std::string& sAnswerBeforeChar,
153 const std::string& sAppend){
nullptr };
154 std::string (*pFormatAnswerForDisplay)(
const std::string& sAnswer){
165 void Init()
override;
169 void Update(
float fDelta)
override;
172 static std::string s_sLastAnswer;
173 static bool s_bCancelledLast;
175 static bool s_bMustResetInputRedirAtClose;
176 static bool s_bResetInputRedirTo;
177 virtual void End(
bool bCancelled);
179 void UpdateAnswerText();
182 void PushSelf(lua_State* L)
override;
185 void TryAppendToAnswer(
const std::string& s);
186 void BackspaceInAnswer();
187 virtual void TextEnteredDirectly() {}
195 std::wstring m_sAnswer;
196 bool m_bShowAnswerCaret =
false;
215 void Init()
override;
219 void MoveX(
int iDir);
220 void MoveY(
int iDir);
221 void PositionCursor();
223 void TextEnteredDirectly()
override;
233 KeyboardRow m_iFocusY;
236 BitmapText* m_ptextKeys[NUM_KeyboardRow][KEYS_PER_ROW];
A smart pointer for Actor.
Definition AutoActor.h:13
An actor that holds a Font and draws text to the screen.
Definition BitmapText.h:11
A self-cleaning Lua reference.
Definition LuaReference.h:10
Definition RageSound.h:130
Displays a text entry box and keyboard over the top of another screen.
Definition ScreenTextEntry.h:212
void BeginScreen() override
This is called immediately before the screen is used.
Definition ScreenTextEntry.cpp:820
void Init() override
This is called immediately after construction, to allow initializing after all derived classes exist.
Definition ScreenTextEntry.cpp:773
Displays a text entry box over the top of another screen.
Definition ScreenTextEntry.h:41
void BeginScreen() override
This is called immediately before the screen is used.
Definition ScreenTextEntry.cpp:383
void Init() override
This is called immediately after construction, to allow initializing after all derived classes exist.
Definition ScreenTextEntry.cpp:359
void EndScreen() override
This is called when the screen is popped.
Definition ScreenTextEntry.cpp:551
The theme specific data.
Definition ThemeMetric.h:52
Definition ScreenTextEntry.h:104
bool bPassword
Is there a password involved with this setting?
Definition ScreenTextEntry.h:123