diff options
author | alberth <alberth@openttd.org> | 2009-09-19 11:31:12 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-09-19 11:31:12 +0000 |
commit | 116c77c342d0f628235a7f5dbacfbb5bc3fb0829 (patch) | |
tree | d2dd74828426b0c82b4dab368e6aff5ff71f3bad /src/window.cpp | |
parent | 9d7fe9bd8688f2d4123dc98e2b222a5be70b306f (diff) | |
download | openttd-116c77c342d0f628235a7f5dbacfbb5bc3fb0829.tar.xz |
(svn r17572) -Codechange: Use the Window::GetWidget() function to access nested widgets through the nested_array.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/window.cpp b/src/window.cpp index f4bc5b9ca..69e7e41ed 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -164,12 +164,12 @@ bool Window::SetFocusedWidget(byte widget_index) assert(this->nested_array[widget_index] != NULL); // Setting focus to a non-existing widget is a bad idea. if (this->nested_focus != NULL) { - if (this->nested_array[widget_index] == this->nested_focus) return false; + if (this->GetWidget<NWidgetCore>(widget_index) == this->nested_focus) return false; /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */ this->nested_focus->SetDirty(this); } - this->nested_focus = this->nested_array[widget_index]; + this->nested_focus = this->GetWidget<NWidgetCore>(widget_index); return true; } NOT_REACHED(); @@ -486,7 +486,7 @@ static void DispatchMouseWheelEvent(Window *w, int widget, int wheel) } } - if (w->nested_array != NULL && (uint)widget < w->nested_array_size) sb = w->nested_array[widget]->FindScrollbar(w); + if (w->nested_array != NULL && (uint)widget < w->nested_array_size) sb = w->GetWidget<NWidgetCore>(widget)->FindScrollbar(w); if (sb != NULL && sb->GetCount() > sb->GetCapacity()) { sb->UpdatePosition(wheel); @@ -912,7 +912,7 @@ void Window::InitializeData(WindowClass cls, const Widget *widget, int window_nu /* If available, initialize nested widget tree. */ if (widget == NULL) { if (this->nested_array == NULL) { - this->nested_array = CallocT<NWidgetCore *>(this->nested_array_size); + this->nested_array = CallocT<NWidgetBase *>(this->nested_array_size); this->nested_root->SetupSmallestSize(this, true); } else { this->nested_root->SetupSmallestSize(this, false); @@ -1339,7 +1339,7 @@ void Window::CreateNestedTree(const WindowDesc *desc, bool fill_nested) this->nested_array_size = (uint)(biggest_index + 1); if (fill_nested) { - this->nested_array = CallocT<NWidgetCore *>(this->nested_array_size); + this->nested_array = CallocT<NWidgetBase *>(this->nested_array_size); this->nested_root->FillNestedArray(this->nested_array, this->nested_array_size); } } |