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

Added right click pop-up for text inputs

This commit is contained in:
nordsoft
2023-08-26 14:01:19 +04:00
parent 614a285fb8
commit de8bd48398
4 changed files with 18 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
#include "../gui/CGuiHandler.h"
#include "../gui/Shortcut.h"
#include "../windows/CMessage.h"
#include "../windows/InfoWindows.h"
#include "../adventureMap/CInGameConsole.h"
#include "../renderSDL/SDL_Extensions.h"
#include "../render/Canvas.h"
@@ -495,7 +496,7 @@ CTextInput::CTextInput(const Rect & Pos, EFonts font, const CFunctionList<void(c
pos.h = Pos.h;
pos.w = Pos.w;
background.reset();
addUsedEvents(LCLICK | KEYBOARD | TEXTINPUT);
addUsedEvents(LCLICK | SHOW_POPUP | KEYBOARD | TEXTINPUT);
#if !defined(VCMI_MOBILE)
giveFocus();
@@ -511,7 +512,7 @@ CTextInput::CTextInput(const Rect & Pos, const Point & bgOffset, const std::stri
OBJ_CONSTRUCTION;
background = std::make_shared<CPicture>(bgName, bgOffset.x, bgOffset.y);
addUsedEvents(LCLICK | KEYBOARD | TEXTINPUT);
addUsedEvents(LCLICK | SHOW_POPUP | KEYBOARD | TEXTINPUT);
#if !defined(VCMI_MOBILE)
giveFocus();
@@ -604,6 +605,13 @@ void CTextInput::keyPressed(EShortcut key)
}
}
void CTextInput::showPopupWindow(const Point & cursorPosition)
{
if(helpBox.size()) //there is no point to show window with nothing inside...
CRClickPopup::createAndPush(helpBox);
}
void CTextInput::setText(const std::string & nText)
{
setText(nText, false);