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

View File

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