summaryrefslogtreecommitdiff
path: root/src/signs_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-02 08:28:50 +0000
committerrubidium <rubidium@openttd.org>2009-09-02 08:28:50 +0000
commit1dfa38bb1f546c4f0a9ac7838be088ffbe4bc37b (patch)
tree070d371c55c5776bb25e5efb7fd613353cfec6ed /src/signs_gui.cpp
parent7aeaa4f132aaa9c70cc32db5c6c82496df9387b7 (diff)
downloadopenttd-1dfa38bb1f546c4f0a9ac7838be088ffbe4bc37b.tar.xz
(svn r17372) -Codechange: make the settings, rail and sign GUIs use the scrollbar wrappers
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r--src/signs_gui.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 1824a7ee3..5c67173fc 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -90,7 +90,7 @@ enum SignListWidgets {
struct SignListWindow : Window, SignList {
SignListWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
- this->vscroll.cap = 12;
+ this->vscroll.SetCapacity(12);
this->resize.step_height = 10;
this->resize.height = this->height - 10 * 7; // minimum if 5 in the list
@@ -105,20 +105,20 @@ struct SignListWindow : Window, SignList {
BuildSignsList();
SortSignsList();
- SetVScrollCount(this, this->signs.Length());
+ this->vscroll.SetCount(this->signs.Length()); // Update the scrollbar
- SetDParam(0, this->vscroll.count);
+ SetDParam(0, this->vscroll.GetCount());
this->DrawWidgets();
/* No signs? */
int y = this->widget[SLW_LIST].top + 2; // offset from top of widget
- if (this->vscroll.count == 0) {
+ if (this->vscroll.GetCount() == 0) {
DrawString(this->widget[SLW_LIST].left + 2, this->widget[SLW_LIST].right, y, STR_STATION_LIST_NONE);
return;
}
/* Start drawing the signs */
- for (uint16 i = this->vscroll.pos; i < this->vscroll.cap + this->vscroll.pos && i < this->vscroll.count; i++) {
+ for (uint16 i = this->vscroll.GetPosition(); this->vscroll.IsVisible(i) && i < this->vscroll.GetCount(); i++) {
const Sign *si = this->signs[i];
if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, this->widget[SLW_LIST].left + 4, y + 1);
@@ -134,9 +134,9 @@ struct SignListWindow : Window, SignList {
if (widget == SLW_LIST) {
uint32 id_v = (pt.y - this->widget[SLW_LIST].top - 1) / 10;
- if (id_v >= this->vscroll.cap) return;
- id_v += this->vscroll.pos;
- if (id_v >= this->vscroll.count) return;
+ if (id_v >= this->vscroll.GetCapacity()) return;
+ id_v += this->vscroll.GetPosition();
+ if (id_v >= this->vscroll.GetCount()) return;
const Sign *si = this->signs[id_v];
ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
@@ -145,7 +145,7 @@ struct SignListWindow : Window, SignList {
virtual void OnResize(Point delta)
{
- this->vscroll.cap += delta.y / 10;
+ this->vscroll.UpdateCapacity(delta.y / 10);
}
virtual void OnInvalidateData(int data)