summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-06-03 21:13:13 +0000
committeralberth <alberth@openttd.org>2009-06-03 21:13:13 +0000
commit5c9071fcffc54eb1bf32d671cf521fadd407491d (patch)
tree4232b83afa175dbbb6476b839bb368e240d067d3 /src/window.cpp
parent1ba3755aa7383c34042f781c85a28f76417962cd (diff)
downloadopenttd-5c9071fcffc54eb1bf32d671cf521fadd407491d.tar.xz
(svn r16514) -Codechange: Add widget flags, and drawing and invalidating.
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/window.cpp b/src/window.cpp
index d2a493fe2..da14e0fd3 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -191,10 +191,20 @@ void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...)
*/
void Window::RaiseButtons()
{
- for (uint i = 0; i < this->widget_count; i++) {
- if (this->IsWidgetLowered(i)) {
- this->RaiseWidget(i);
- this->InvalidateWidget(i);
+ if (this->widget != NULL) {
+ for (uint i = 0; i < this->widget_count; i++) {
+ if (this->IsWidgetLowered(i)) {
+ this->RaiseWidget(i);
+ this->InvalidateWidget(i);
+ }
+ }
+ }
+ if (this->nested_array != NULL) {
+ for (uint i = 0; i < this->nested_array_size; i++) {
+ if (this->IsWidgetLowered(i)) {
+ this->RaiseWidget(i);
+ this->InvalidateWidget(i);
+ }
}
}
}
@@ -205,12 +215,15 @@ void Window::RaiseButtons()
*/
void Window::InvalidateWidget(byte widget_index) const
{
- const Widget *wi = &this->widget[widget_index];
+ if (this->widget != NULL) {
+ const Widget *wi = &this->widget[widget_index];
- /* Don't redraw the window if the widget is invisible or of no-type */
- if (wi->type == WWT_EMPTY || IsWidgetHidden(widget_index)) return;
+ /* Don't redraw the window if the widget is invisible or of no-type */
+ if (wi->type == WWT_EMPTY || IsWidgetHidden(widget_index)) return;
- SetDirtyBlocks(this->left + wi->left, this->top + wi->top, this->left + wi->right + 1, this->top + wi->bottom + 1);
+ SetDirtyBlocks(this->left + wi->left, this->top + wi->top, this->left + wi->right + 1, this->top + wi->bottom + 1);
+ }
+ if (this->nested_array != NULL) this->nested_array[widget_index]->Invalidate(this);
}
/**