summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-02 00:59:48 +0000
committerbelugas <belugas@openttd.org>2007-12-02 00:59:48 +0000
commite2b4afaa4bee468f28949befb212a4817e02aa6f (patch)
tree68bdc5a0895c60e5fc244269181b673e4bb5c169 /src/window.cpp
parent7be55559b8772820bcd36e2cb02ff6bb8c4a24dc (diff)
downloadopenttd-e2b4afaa4bee468f28949befb212a4817e02aa6f.tar.xz
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
Ex: "Window::SetWidgetLoweredState(byte widget_index, bool lowered_stat)" is the member corresponding to "SetWindowWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat)"
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 789ef9603..b12e69b21 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -80,6 +80,70 @@ void RaiseWindowButtons(Window *w)
}
}
+void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...)
+{
+ va_list wdg_list;
+
+ va_start(wdg_list, widgets);
+
+ while (widgets != WIDGET_LIST_END) {
+ SetWidgetDisabledState(widgets, disab_stat);
+ widgets = va_arg(wdg_list, int);
+ }
+
+ va_end(wdg_list);
+}
+
+void CDECL Window::SetWidgetsHiddenState(bool hidden_stat, int widgets, ...)
+{
+ va_list wdg_list;
+
+ va_start(wdg_list, widgets);
+
+ while (widgets != WIDGET_LIST_END) {
+ SetWidgetHiddenState(widgets, hidden_stat);
+ widgets = va_arg(wdg_list, int);
+ }
+
+ va_end(wdg_list);
+}
+
+void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...)
+{
+ va_list wdg_list;
+
+ va_start(wdg_list, widgets);
+
+ while (widgets != WIDGET_LIST_END) {
+ SetWidgetLoweredState(widgets, lowered_stat);
+ widgets = va_arg(wdg_list, int);
+ }
+
+ va_end(wdg_list);
+}
+
+void Window::RaiseButtons()
+{
+ uint i;
+
+ for (i = 0; i < this->widget_count; i++) {
+ if (IsWidgetLowered(i)) {
+ RaiseWidget(i);
+ InvalidateWidget(i);
+ }
+ }
+}
+
+void Window::InvalidateWidget(byte widget_index)
+{
+ 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;
+
+ SetDirtyBlocks(this->left + wi->left, this->top + wi->top, this->left + wi->right + 1, this->top + wi->bottom + 1);
+}
+
void HandleButtonClick(Window *w, byte widget)
{
LowerWindowWidget(w, widget);