1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

different max width

This commit is contained in:
Laserlicht 2024-01-08 00:08:05 +01:00 committed by GitHub
parent 24d4816a36
commit 056dccda30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -866,11 +866,13 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<ElementInfo> info, bool
iconLossCondition->disable();
labelNumberOfCampaignMaps->disable();
labelName->enable();
labelName->setMaxWidth(316);
labelName->setText(info->folderName);
labelName->setColor(color);
return;
}
labelName->enable();
if(info->campaign)
{
labelAmountOfPlayers->disable();
@ -885,6 +887,7 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<ElementInfo> info, bool
ostr << info->campaign->scenariosCount();
labelNumberOfCampaignMaps->setText(ostr.str());
labelNumberOfCampaignMaps->setColor(color);
labelName->setMaxWidth(316);
}
else
{
@ -905,8 +908,8 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<ElementInfo> info, bool
iconVictoryCondition->setFrame(info->mapHeader->victoryIconIndex, 0);
iconLossCondition->enable();
iconLossCondition->setFrame(info->mapHeader->defeatIconIndex, 0);
labelName->setMaxWidth(185);
}
labelName->enable();
labelName->setText(info->getNameForList());
labelName->setColor(color);
}

View File

@ -95,6 +95,11 @@ void CLabel::setText(const std::string & Txt)
}
}
void CLabel::setMaxWidth(int width)
{
maxWidth = width;
}
void CLabel::trimText()
{
if(maxWidth > 0)

View File

@ -55,6 +55,7 @@ public:
std::string getText();
virtual void setAutoRedraw(bool option);
virtual void setText(const std::string & Txt);
virtual void setMaxWidth(int width);
virtual void setColor(const ColorRGBA & Color);
size_t getWidth();