diff options
author | rubidium <rubidium@openttd.org> | 2009-09-02 08:58:20 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-02 08:58:20 +0000 |
commit | 5cb22df0f56420759e727b9e9fd16e379a358fb2 (patch) | |
tree | 23e18970c93398f1879757bed924b5be3a861ac7 /src/widget.cpp | |
parent | 900aedf270319b5fbcd3373dfa268a5a5c1cfc78 (diff) | |
download | openttd-5cb22df0f56420759e727b9e9fd16e379a358fb2.tar.xz |
(svn r17375) -Codechange: remove last direct usage of scrollbar variables
Diffstat (limited to 'src/widget.cpp')
-rw-r--r-- | src/widget.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/widget.cpp b/src/widget.cpp index ab0582698..e3307bd69 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -42,9 +42,9 @@ static Point HandleScrollbarHittest(const Scrollbar *sb, int top, int bottom) height = (bottom - top); - pos = sb->pos; - count = sb->count; - cap = sb->cap; + pos = sb->GetPosition(); + count = sb->GetCount(); + cap = sb->GetCapacity(); if (count != 0) top += height * pos / count; @@ -102,7 +102,7 @@ static void ScrollbarClickPositioning(Window *w, WidgetType wtp, int x, int y, i w->flags4 |= WF_SCROLL_UP; if (_scroller_click_timeout == 0) { _scroller_click_timeout = 6; - if (sb->pos != 0) sb->pos--; + sb->UpdatePosition(-1); } _left_button_clicked = false; } else if (pos >= ma - 10) { @@ -111,16 +111,16 @@ static void ScrollbarClickPositioning(Window *w, WidgetType wtp, int x, int y, i if (_scroller_click_timeout == 0) { _scroller_click_timeout = 6; - if (sb->pos + sb->cap < sb->count) sb->pos++; + sb->UpdatePosition(1); } _left_button_clicked = false; } else { Point pt = HandleScrollbarHittest(sb, mi, ma); if (pos < pt.x) { - sb->pos = max(sb->pos - sb->cap, 0); + sb->UpdatePosition(-sb->GetCapacity()); } else if (pos > pt.y) { - sb->pos = min(sb->pos + sb->cap, max(sb->count - sb->cap, 0)); + sb->UpdatePosition(sb->GetCapacity()); } else { _scrollbar_start_pos = pt.x - mi - 9; _scrollbar_size = ma - mi - 23; |