Fix large string dialogs not wrapping text and expanding to crazy widths
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user