diff options
author | zuu <zuu@openttd.org> | 2013-09-14 12:18:36 +0000 |
---|---|---|
committer | zuu <zuu@openttd.org> | 2013-09-14 12:18:36 +0000 |
commit | f8f9e30f801e2c4bd764321f6c9ca6108080ca88 (patch) | |
tree | 9133e107b87b79192933928751c8b73662a7f311 | |
parent | 7adc4534733120527b9c4e2b9c3841deb4b99b96 (diff) | |
download | openttd-f8f9e30f801e2c4bd764321f6c9ca6108080ca88.tar.xz |
(svn r25771) -Fix (r25344): If story book content changed height due a string parameter changing length, the scrollbar was not updated
-rw-r--r-- | src/story_gui.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/story_gui.cpp b/src/story_gui.cpp index 49913bbbf..defbb6449 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -479,6 +479,21 @@ public: } } + virtual void OnPaint() + { + /* Detect if content has changed height. This can happen if a + * multi-line text contains eg. {COMPANY} and that company is + * renamed. + */ + if (this->vscroll->GetCount() != this->GetContentHeight()) { + this->vscroll->SetCount(this->GetContentHeight()); + this->SetWidgetDirty(WID_SB_SCROLLBAR); + this->SetWidgetDirty(WID_SB_PAGE_PANEL); + } + + this->DrawWidgets(); + } + virtual void DrawWidget(const Rect &r, int widget) const { if (widget != WID_SB_PAGE_PANEL) return; |