Fix large string dialogs not wrapping text and expanding to crazy widths

This commit is contained in:
2023-01-04 20:50:21 -05:00
parent 98fe49ad32
commit e7ae84ee2a
3 changed files with 7 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ void cThreeChoice::init_strings(std::vector<std::string>& strings, unsigned shor
cur_text_rect.bottom = cur_text_rect.top + str_height;
cTextMsg* str = new cTextMsg(*me);
str->setText(strings[j]);
str->setFixed(true, false);
me->add(str, cur_text_rect, sout.str());
cur_text_rect.top = cur_text_rect.bottom + 8;
}

View File

@@ -90,6 +90,11 @@ void cTextMsg::validatePostParse(ticpp::Element& who, std::string fname, const s
if(attrs.count("height")) fixedHeight = true;
}
void cTextMsg::setFixed(bool w, bool h) {
fixedWidth = w;
fixedHeight = h;
}
void cTextMsg::recalcRect() {
if(fixedWidth && fixedHeight) return;
TextStyle style;

View File

@@ -36,6 +36,7 @@ public:
bool isClickable() override;
bool isFocusable() override;
bool isScrollable() override;
void setFixed(bool w, bool h);
virtual ~cTextMsg();
void draw() override;
void recalcRect() override;