1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

IrrlichtMt: Import code from guiEditBox.cpp

This does not include the scrollbar.
This commit is contained in:
SmallJoker 2025-09-09 19:36:40 +02:00 committed by SmallJoker
parent 2cab46280b
commit 70fbef112c
3 changed files with 306 additions and 259 deletions

View file

@ -133,7 +133,10 @@ public:
void updateAbsolutePosition() override;
//! Returns whether the element takes input from the IME
bool acceptsIME() override;
bool acceptsIME() override { return isEnabled() && IsWritable; };
//! set true if this EditBox is writable
void setWritable(bool writable) { IsWritable = writable; }
protected:
//! Breaks the single text line.
@ -154,10 +157,21 @@ protected:
void sendGuiEvent(EGUI_EVENT_TYPE type);
//! set text markers
void setTextMarkers(s32 begin, s32 end);
//! delete current selection or next char
bool keyDelete();
bool processKey(const SEvent &event);
//! KEY_LEFT / KEY_RIGHT inputs
void processKeyLR(const SEvent::SKeyInput &input, s32 &new_mark_begin,
s32 &new_mark_end);
bool onKeyUp(const SEvent &event, s32 &mark_begin, s32 &mark_end);
bool onKeyDown(const SEvent &event, s32 &mark_begin, s32 &mark_end);
void onKeyControlC(const SEvent &event);
bool onKeyControlX(const SEvent &event, s32 &mark_begin, s32 &mark_end);
bool onKeyControlV(const SEvent &event, s32 &mark_begin, s32 &mark_end);
bool onKeyBack();
//! delete current selection or next char
bool onKeyDelete();
bool processMouse(const SEvent &event);
s32 getCursorPos(s32 x, s32 y);
@ -180,7 +194,12 @@ protected:
s32 HScrollPos, VScrollPos; // scroll position in characters
u32 Max;
bool WordWrap, MultiLine, AutoScroll, PasswordBox;
bool WordWrap = false,
MultiLine = false,
AutoScroll = false,
PasswordBox = false,
IsWritable = true;
wchar_t PasswordChar;
EGUI_ALIGNMENT HAlign, VAlign;