mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): add CSimpleEditBox::SetText
This commit is contained in:
parent
66950e312f
commit
9e7b9e5040
@ -1058,6 +1058,14 @@ void CSimpleEditBox::RunOnTextChangedScript(int32_t changed) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleEditBox::RunOnTextSetScript(const char* a2) {
|
||||||
|
if (this->m_onTextSet.luaRef) {
|
||||||
|
this->RunScript(this->m_onTextSet, 0, a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO action
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleEditBox::SetCursorPosition(int32_t position) {
|
void CSimpleEditBox::SetCursorPosition(int32_t position) {
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
this->m_cursorPos = std::min(this->m_textLength, position);
|
this->m_cursorPos = std::min(this->m_textLength, position);
|
||||||
@ -1102,6 +1110,21 @@ void CSimpleEditBox::SetMultiLine(int32_t enabled) {
|
|||||||
this->UpdateSizes();
|
this->UpdateSizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleEditBox::SetText(const char* text, const char* a3) {
|
||||||
|
if (this->m_highlightLeft != this->m_highlightRight) {
|
||||||
|
this->m_dirtyFlags |= 0x2;
|
||||||
|
this->m_highlightRight = 0;
|
||||||
|
this->m_highlightLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SStrCmp(text, this->m_text)) {
|
||||||
|
this->DeleteSubstring(0, this->m_textLength, 1);
|
||||||
|
this->m_visiblePos = 0;
|
||||||
|
this->Insert(text, a3, 0, 0, 1);
|
||||||
|
this->RunOnTextSetScript(a3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleEditBox::StartHighlight() {
|
void CSimpleEditBox::StartHighlight() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,9 +120,11 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
|||||||
void RunOnEscapePressedScript();
|
void RunOnEscapePressedScript();
|
||||||
void RunOnTabPressedScript();
|
void RunOnTabPressedScript();
|
||||||
void RunOnTextChangedScript(int32_t changed);
|
void RunOnTextChangedScript(int32_t changed);
|
||||||
|
void RunOnTextSetScript(const char* a2);
|
||||||
void SetCursorPosition(int32_t position);
|
void SetCursorPosition(int32_t position);
|
||||||
void SetHistoryLines(int32_t a2);
|
void SetHistoryLines(int32_t a2);
|
||||||
void SetMultiLine(int32_t enabled);
|
void SetMultiLine(int32_t enabled);
|
||||||
|
void SetText(const char* text, const char* a3);
|
||||||
void StartHighlight();
|
void StartHighlight();
|
||||||
void UpdateDirtyBits();
|
void UpdateDirtyBits();
|
||||||
void UpdateSizes();
|
void UpdateSizes();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user