diff options
author | rubidium <rubidium@openttd.org> | 2009-09-02 08:48:29 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-02 08:48:29 +0000 |
commit | 900aedf270319b5fbcd3373dfa268a5a5c1cfc78 (patch) | |
tree | 12c8b9cbfe1dcb5857bf5d0c4ef870616775cfa4 /src/town_gui.cpp | |
parent | 7aa9f8e3fb29d70635d5cef8cc67133cf7718061 (diff) | |
download | openttd-900aedf270319b5fbcd3373dfa268a5a5c1cfc78.tar.xz |
(svn r17374) -Codechange: make the town and vehicle GUIs use the scrollbar wrappers
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r-- | src/town_gui.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp index b1b192e3c..1a090f10e 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -108,7 +108,7 @@ public: Window(desc, window_number), sel_index(-1) { this->town = Town::Get(this->window_number); - this->vscroll.cap = 5; + this->vscroll.SetCapacity(5); this->FindWindowPlacementAndResize(desc); } @@ -118,7 +118,7 @@ public: int numact; uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town); - SetVScrollCount(this, numact + 1); + this->vscroll.SetCount(numact + 1); if (this->sel_index != -1 && !HasBit(buttons, this->sel_index)) { this->sel_index = -1; @@ -172,7 +172,7 @@ public: } y = this->widget[TWA_COMMAND_LIST].top + 1; - int pos = this->vscroll.pos; + int pos = this->vscroll.GetPosition(); if (--pos < 0) { DrawString(this->widget[TWA_COMMAND_LIST].left + 2, this->widget[TWA_COMMAND_LIST].right - 2, y, STR_LOCAL_AUTHORITY_ACTIONS_TITLE); @@ -206,7 +206,7 @@ public: if (!IsInsideMM(y, 0, 5)) return; - y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_company, this->town), y + this->vscroll.pos - 1); + y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_company, this->town), y + this->vscroll.GetPosition() - 1); if (y >= 0) { this->sel_index = y; this->SetDirty(); @@ -558,7 +558,7 @@ private: this->towns.Compact(); this->towns.RebuildDone(); - SetVScrollCount(this, this->towns.Length()); // Update scrollbar as well. + this->vscroll.SetCount(this->towns.Length()); // Update scrollbar as well. } /* Always sort the towns. */ this->last_town = NULL; @@ -603,7 +603,7 @@ public: this->BuildSortTownList(); this->InitNested(desc, 0); - this->vscroll.cap = this->nested_array[TDW_CENTERTOWN]->current_y / (int)this->resize.step_height; + this->vscroll.SetCapacity(this->nested_array[TDW_CENTERTOWN]->current_y / (int)this->resize.step_height); } ~TownDirectoryWindow() @@ -635,7 +635,7 @@ public: case TDW_CENTERTOWN: { int n = 0; int y = r.top + WD_FRAMERECT_TOP; - for (uint i = this->vscroll.pos; i < this->towns.Length(); i++) { + for (uint i = this->vscroll.GetPosition(); i < this->towns.Length(); i++) { const Town *t = this->towns[i]; assert(t->xy != INVALID_TILE); @@ -645,7 +645,7 @@ public: DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_TOWN_DIRECTORY_TOWN); y += this->resize.step_height; - if (++n == this->vscroll.cap) break; // max number of towns in 1 window + if (++n == this->vscroll.GetCapacity()) break; // max number of towns in 1 window } } break; } @@ -716,9 +716,9 @@ public: case TDW_CENTERTOWN: { // Click on Town Matrix uint16 id_v = (pt.y - this->nested_array[widget]->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height; - if (id_v >= this->vscroll.cap) return; // click out of bounds + if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds - id_v += this->vscroll.pos; + id_v += this->vscroll.GetPosition(); if (id_v >= this->towns.Length()) return; // click out of town bounds @@ -742,7 +742,7 @@ public: virtual void OnResize(Point delta) { - this->vscroll.cap += delta.y / (int)this->resize.step_height; + this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height); } virtual void OnInvalidateData(int data) |