1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-23 22:49:09 +00:00

(svn r16514) -Codechange: Add widget flags, and drawing and invalidating.

This commit is contained in:
alberth
2009-06-03 21:13:13 +00:00
parent 1ba3755aa7
commit 5c9071fcff
4 changed files with 325 additions and 20 deletions

View File

@@ -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);
}
/**