Merge branch 'master' into feat-CSimpleEditBox-OnEscapePressed-branch

This commit is contained in:
fallenoak 2025-10-05 10:32:49 -05:00 committed by GitHub
commit cb4b06f62a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -769,6 +769,11 @@ void CSimpleEditBox::OnEscapePressed() {
// TODO this->DispatchAction(EVENT_ESCAPE);
}
void CSimpleEditBox::OnTabPressed() {
this->RunOnTabPressedScript();
// TODO this->DispatchAction(EVENT_TAB);
}
void CSimpleEditBox::OnFrameSizeChanged(float width, float height) {
CSimpleFrame::OnFrameSizeChanged(width, height);
this->UpdateSizes();
@ -880,6 +885,10 @@ int32_t CSimpleEditBox::OnLayerKeyDown(const CKeyEvent& evt) {
return 1;
}
case KEY_TAB: {
this->OnTabPressed();
}
// TODO
// - remaining keys
@ -1026,6 +1035,12 @@ void CSimpleEditBox::RunOnEscapePressedScript() {
}
}
void CSimpleEditBox::RunOnTabPressedScript() {
if (this->m_onTabPressed.luaRef) {
this->RunScript(this->m_onTabPressed, 0, nullptr);
}
}
void CSimpleEditBox::RunOnTextChangedScript(int32_t changed) {
if (this->m_onTextChanged.luaRef) {
auto L = FrameScript_GetContext();

View File

@ -93,6 +93,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
void MoveForward(int32_t highlight);
void OnEnterPressed();
void OnEscapePressed();
void OnTabPressed();
void OnTextChanged();
int32_t PrevCharOffset(int32_t offset);
void RunOnCursorChangedScript(float x, float y, float w, float h);
@ -100,6 +101,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
void RunOnEditFocusLostScript();
void RunOnEnterPressedScript();
void RunOnEscapePressedScript();
void RunOnTabPressedScript();
void RunOnTextChangedScript(int32_t changed);
void SetCursorPosition(int32_t position);
void SetHistoryLines(int32_t a2);