summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-02 08:58:20 +0000
committerrubidium <rubidium@openttd.org>2009-09-02 08:58:20 +0000
commit5cb22df0f56420759e727b9e9fd16e379a358fb2 (patch)
tree23e18970c93398f1879757bed924b5be3a861ac7 /src/widgets
parent900aedf270319b5fbcd3373dfa268a5a5c1cfc78 (diff)
downloadopenttd-5cb22df0f56420759e727b9e9fd16e379a358fb2.tar.xz
(svn r17375) -Codechange: remove last direct usage of scrollbar variables
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dropdown.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index 6da4989e3..04c27de88 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -116,7 +116,7 @@ struct DropdownWindow : Window {
int y = _cursor.pos.y - this->top - 2;
int width = this->widget[0].right - 3;
- int pos = this->vscroll.pos;
+ int pos = this->vscroll.GetPosition();
const DropDownList *list = this->list;
@@ -150,7 +150,7 @@ struct DropdownWindow : Window {
int width = this->widget[0].right - 2;
int right = this->widget[0].right;
int bottom = this->widget[0].bottom;
- int pos = this->vscroll.pos;
+ int pos = this->vscroll.GetPosition();
DropDownList *list = this->list;
@@ -189,14 +189,7 @@ struct DropdownWindow : Window {
virtual void OnTick()
{
- if (this->scrolling == -1) {
- this->vscroll.pos = max(0, this->vscroll.pos - 1);
- this->SetDirty();
- } else if (this->scrolling == 1) {
- this->vscroll.pos = min(this->vscroll.count - this->vscroll.cap, this->vscroll.pos + 1);
- this->SetDirty();
- }
- this->scrolling = 0;
+ this->vscroll.UpdatePosition(this->scrolling);
}
virtual void OnMouseLoop()
@@ -354,8 +347,8 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u
dw->widget[0].right -= 12;
/* Capacity is the average number of items visible */
- dw->vscroll.cap = height * (uint16)list->size() / list_height;
- dw->vscroll.count = (uint16)list->size();
+ dw->vscroll.SetCapacity(height * (uint16)list->size() / list_height);
+ dw->vscroll.SetCount((uint16)list->size());
}
dw->desc_flags = WDF_DEF_WIDGET;