1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Code review tweaks

This commit is contained in:
nordsoft
2023-08-27 21:39:45 +04:00
parent 44791b6665
commit 49a76ac14c
3 changed files with 17 additions and 5 deletions

View File

@@ -607,7 +607,7 @@ void CTextInput::keyPressed(EShortcut key)
void CTextInput::showPopupWindow(const Point & cursorPosition)
{
if(helpBox.size()) //there is no point to show window with nothing inside...
if(!helpBox.empty()) //there is no point to show window with nothing inside...
CRClickPopup::createAndPush(helpBox);
}
@@ -624,6 +624,11 @@ void CTextInput::setText(const std::string & nText, bool callCb)
cb(text);
}
void CTextInput::setHelpText(const std::string & text)
{
helpBox = text;
}
void CTextInput::textInputed(const std::string & enteredText)
{
if(!focus)

View File

@@ -209,16 +209,16 @@ public:
class CTextInput : public CLabel, public CFocusable
{
std::string newText;
std::string helpBox; //for right-click help
protected:
std::string visibleText() override;
public:
std::string helpBox; //for right-click help
CFunctionList<void(const std::string &)> cb;
CFunctionList<void(std::string &, const std::string &)> filters;
void setText(const std::string & nText) override;
void setText(const std::string & nText, bool callCb);
void setHelpText(const std::string &);
CTextInput(const Rect & Pos, EFonts font, const CFunctionList<void(const std::string &)> & CB);
CTextInput(const Rect & Pos, const Point & bgOffset, const std::string & bgName, const CFunctionList<void(const std::string &)> & CB);