summaryrefslogtreecommitdiff
path: root/src/fios_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-12 08:37:01 +0000
committerfrosch <frosch@openttd.org>2010-08-12 08:37:01 +0000
commit71ca58c2bb1b72a088acec5b70423a43512ec195 (patch)
treeb0e875a8626ce26d7fed7597328409f2cb937dbe /src/fios_gui.cpp
parent10339c60c0e53ccc90f0cc379763be6582d87bf2 (diff)
downloadopenttd-71ca58c2bb1b72a088acec5b70423a43512ec195.tar.xz
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
Note: All windows get individual members with the same names, which are initialised via Window::GetScrollbar(). This caching is not required at all, but simplifies conversion.
Diffstat (limited to 'src/fios_gui.cpp')
-rw-r--r--src/fios_gui.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 4f83c309f..a8c45dbb8 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -240,6 +240,7 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
private:
FiosItem o_dir;
const FiosItem *selected;
+ Scrollbar *vscroll;
public:
void GenerateFileName()
@@ -269,9 +270,10 @@ public:
this->afilter = CS_ALPHANUMERAL;
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 240);
- this->CreateNestedTree(desc);
+ this->CreateNestedTree(desc, true);
if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL);
this->GetWidget<NWidgetCore>(SLWW_WINDOWTITLE)->widget_data = saveload_captions[mode];
+ this->vscroll = this->GetScrollbar(SLWW_SCROLLBAR);
this->FinishInitNested(desc, 0);
@@ -353,7 +355,7 @@ public:
GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, 0xD7);
uint y = r.top + WD_FRAMERECT_TOP;
- for (uint pos = this->vscroll.GetPosition(); pos < _fios_items.Length(); pos++) {
+ for (uint pos = this->vscroll->GetPosition(); pos < _fios_items.Length(); pos++) {
const FiosItem *item = _fios_items.Get(pos);
if (item == this->selected) {
@@ -361,7 +363,7 @@ public:
}
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, item->title, _fios_colours[item->type]);
y += this->resize.step_height;
- if (y >= this->vscroll.GetCapacity() * this->resize.step_height + r.top + WD_FRAMERECT_TOP) break;
+ if (y >= this->vscroll->GetCapacity() * this->resize.step_height + r.top + WD_FRAMERECT_TOP) break;
}
break;
}
@@ -483,7 +485,7 @@ public:
MakeSortedSaveGameList();
}
- this->vscroll.SetCount(_fios_items.Length());
+ this->vscroll->SetCount(_fios_items.Length());
this->DrawWidgets();
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
@@ -534,7 +536,7 @@ public:
break;
case SLWW_DRIVES_DIRECTORIES_LIST: { // Click the listbox
- int y = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SLWW_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP);
+ int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SLWW_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP);
if (y == INT_MAX) return;
const FiosItem *file = _fios_items.Get(y);
@@ -647,7 +649,7 @@ public:
virtual void OnResize()
{
- this->vscroll.SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST);
+ this->vscroll->SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST);
}
virtual void OnInvalidateData(int data)