summaryrefslogtreecommitdiff
path: root/src/newgrf_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-12-20 20:08:39 +0000
committeralberth <alberth@openttd.org>2009-12-20 20:08:39 +0000
commit5a083f183e5ece4e379a12d7f5b927e54a83d04a (patch)
tree1d1fa960c0fffff8e0462b8086f4c46434b91773 /src/newgrf_gui.cpp
parent20debea202d87ce595b2ebc353d22204e9820efc (diff)
downloadopenttd-5a083f183e5ece4e379a12d7f5b927e54a83d04a.tar.xz
(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r--src/newgrf_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 1515e4ba5..8b7e58ded 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -297,7 +297,7 @@ public:
virtual void OnResize()
{
- this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y / this->resize.step_height);
+ this->vscroll.SetCapacityFromWidget(this, ANGRFW_GRF_LIST);
}
virtual void OnPaint()
@@ -621,9 +621,8 @@ struct NewGRFWindow : public Window {
virtual void OnResize()
{
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST);
- this->vscroll.SetCapacity(nwi->current_y / this->resize.step_height);
- nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ this->vscroll.SetCapacityFromWidget(this, SNGRFS_FILE_LIST);
+ this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void SetStringParameters(int widget) const
@@ -970,7 +969,7 @@ struct NewGRFWindow : public Window {
for (c = this->list, i = 0; c != NULL; c = c->next, i++) {}
- this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SNGRFS_FILE_LIST)->current_y) / this->resize.step_height);
+ this->vscroll.SetCapacityFromWidget(this, SNGRFS_FILE_LIST);
this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->vscroll.SetCount(i);
break;