1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

add help text

This commit is contained in:
Laserlicht
2024-07-29 00:54:58 +02:00
committed by GitHub
parent 2e2d8f8833
commit 6adc49b814
5 changed files with 33 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ CTextInput::CTextInput(const Rect & Pos)
pos.h = Pos.h;
pos.w = Pos.w;
addUsedEvents(LCLICK | KEYBOARD | TEXTINPUT);
addUsedEvents(LCLICK | SHOW_POPUP | KEYBOARD | TEXTINPUT);
}
void CTextInput::createLabel(bool giveFocusToInput)
@@ -106,6 +106,11 @@ void CTextInput::setCallback(const TextEditedCallback & cb)
onTextEdited = cb;
}
void CTextInput::setPopupCallback(const std::function<void()> & cb)
{
callbackPopup = cb;
}
void CTextInput::setFilterFilename()
{
assert(!onTextFiltering);
@@ -122,6 +127,12 @@ std::string CTextInput::getVisibleText() const
return hasFocus() ? currentText + composedText + "_" : currentText;
}
void CTextInput::showPopupWindow(const Point & cursorPosition)
{
if(callbackPopup)
callbackPopup();
}
void CTextInput::clickPressed(const Point & cursorPosition)
{
// attempt to give focus unconditionally, even if we already have it