diff options
author | frosch <frosch@openttd.org> | 2010-08-12 09:07:45 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-08-12 09:07:45 +0000 |
commit | 66e48dfdce40b2fac38ae5931581d24fded4265e (patch) | |
tree | 4af677a6a91a4168f1ae36937d9157eab723eb09 /src/window.cpp | |
parent | 037d2ed436f0c8a357fcb2e6f8a63400f2bd4746 (diff) | |
download | openttd-66e48dfdce40b2fac38ae5931581d24fded4265e.tar.xz |
(svn r20456) -Codechange: Add separate nested widget class for scrollbars.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/window.cpp b/src/window.cpp index 1261a66d0..cba0f799e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -137,13 +137,7 @@ void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding) */ const Scrollbar *Window::GetScrollbar(uint widnum) const { - const NWidgetLeaf *wid = this->GetWidget<NWidgetLeaf>(widnum); - switch (wid->type) { - case WWT_HSCROLLBAR: return &this->old_hscroll; - case WWT_SCROLLBAR: return &this->old_vscroll; - case WWT_SCROLL2BAR: return &this->old_vscroll2; - default: NOT_REACHED(); - } + return this->GetWidget<NWidgetScrollbar>(widnum)->GetScrollbar(this); } /** @@ -153,13 +147,7 @@ const Scrollbar *Window::GetScrollbar(uint widnum) const */ Scrollbar *Window::GetScrollbar(uint widnum) { - NWidgetLeaf *wid = this->GetWidget<NWidgetLeaf>(widnum); - switch (wid->type) { - case WWT_HSCROLLBAR: return &this->old_hscroll; - case WWT_SCROLLBAR: return &this->old_vscroll; - case WWT_SCROLL2BAR: return &this->old_vscroll2; - default: NOT_REACHED(); - } + return this->GetWidget<NWidgetScrollbar>(widnum)->GetScrollbar(this); } |