mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(ui): handle tab key events in CSimpleEditBox (#102)
This commit is contained in:
parent
9cac949796
commit
5055e03f65
@ -768,6 +768,11 @@ void CSimpleEditBox::OnEscapePressed() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleEditBox::OnTabPressed() {
|
||||||
|
this->RunOnTabPressedScript();
|
||||||
|
// TODO this->DispatchAction(EVENT_TAB);
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleEditBox::OnFrameSizeChanged(float width, float height) {
|
void CSimpleEditBox::OnFrameSizeChanged(float width, float height) {
|
||||||
CSimpleFrame::OnFrameSizeChanged(width, height);
|
CSimpleFrame::OnFrameSizeChanged(width, height);
|
||||||
this->UpdateSizes();
|
this->UpdateSizes();
|
||||||
@ -879,6 +884,10 @@ int32_t CSimpleEditBox::OnLayerKeyDown(const CKeyEvent& evt) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case KEY_TAB: {
|
||||||
|
this->OnTabPressed();
|
||||||
|
}
|
||||||
// TODO
|
// TODO
|
||||||
// - remaining keys
|
// - remaining keys
|
||||||
|
|
||||||
@ -1019,6 +1028,12 @@ void CSimpleEditBox::RunOnEnterPressedScript() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleEditBox::RunOnTabPressedScript() {
|
||||||
|
if (this->m_onTabPressed.luaRef) {
|
||||||
|
this->RunScript(this->m_onTabPressed, 0, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleEditBox::RunOnTextChangedScript(int32_t changed) {
|
void CSimpleEditBox::RunOnTextChangedScript(int32_t changed) {
|
||||||
if (this->m_onTextChanged.luaRef) {
|
if (this->m_onTextChanged.luaRef) {
|
||||||
auto L = FrameScript_GetContext();
|
auto L = FrameScript_GetContext();
|
||||||
|
|||||||
@ -93,12 +93,14 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
|||||||
void MoveForward(int32_t highlight);
|
void MoveForward(int32_t highlight);
|
||||||
void OnEnterPressed();
|
void OnEnterPressed();
|
||||||
void OnEscapePressed();
|
void OnEscapePressed();
|
||||||
|
void OnTabPressed();
|
||||||
void OnTextChanged();
|
void OnTextChanged();
|
||||||
int32_t PrevCharOffset(int32_t offset);
|
int32_t PrevCharOffset(int32_t offset);
|
||||||
void RunOnCursorChangedScript(float x, float y, float w, float h);
|
void RunOnCursorChangedScript(float x, float y, float w, float h);
|
||||||
void RunOnEditFocusGainedScript();
|
void RunOnEditFocusGainedScript();
|
||||||
void RunOnEditFocusLostScript();
|
void RunOnEditFocusLostScript();
|
||||||
void RunOnEnterPressedScript();
|
void RunOnEnterPressedScript();
|
||||||
|
void RunOnTabPressedScript();
|
||||||
void RunOnTextChangedScript(int32_t changed);
|
void RunOnTextChangedScript(int32_t changed);
|
||||||
void SetCursorPosition(int32_t position);
|
void SetCursorPosition(int32_t position);
|
||||||
void SetHistoryLines(int32_t a2);
|
void SetHistoryLines(int32_t a2);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user