summaryrefslogtreecommitdiff
path: root/src/window_gui.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-18 20:44:35 +0000
committerrubidium <rubidium@openttd.org>2008-07-18 20:44:35 +0000
commit5f280d0e505098c237d79647ce75639eb2b87fb2 (patch)
treee136ec3291e0ec510230cfa16d7f876391e5962a /src/window_gui.h
parent3a799389ebf915cc59b6e85346d837621ebe771a (diff)
downloadopenttd-5f280d0e505098c237d79647ce75639eb2b87fb2.tar.xz
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r--src/window_gui.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/window_gui.h b/src/window_gui.h
index a499ae1e5..7d58962d6 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -238,6 +238,8 @@ public:
void LowerWidget(byte widget_index);
void RaiseWidget(byte widget_index);
bool IsWidgetLowered(byte widget_index) const;
+ void AlignWidgetRight(byte widget_index_a, byte widget_index_b);
+ int GetWidgetWidth(byte widget_index) const;
void RaiseButtons();
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
@@ -716,4 +718,29 @@ inline bool Window::IsWidgetLowered(byte widget_index) const
return HasBit(this->widget[widget_index].display_flags, WIDG_LOWERED);
}
+/**
+ * Align widgets a and b next to each other.
+ * @param widget_index_a the left widget
+ * @param widget_index_b the right widget (fixed)
+ */
+inline void Window::AlignWidgetRight(byte widget_index_a, byte widget_index_b)
+{
+ assert(widget_index_a < this->widget_count);
+ assert(widget_index_b < this->widget_count);
+ int w = this->widget[widget_index_a].right - this->widget[widget_index_a].left;
+ this->widget[widget_index_a].right = this->widget[widget_index_b].left - 1;
+ this->widget[widget_index_a].left = this->widget[widget_index_a].right - w;
+}
+
+/**
+ * Get the width of a widget.
+ * @param widget_index the widget
+ * @return width of the widget
+ */
+inline int Window::GetWidgetWidth(byte widget_index) const
+{
+ assert(widget_index < this->widget_count);
+ return this->widget[widget_index].right - this->widget[widget_index].left + 1;
+}
+
#endif /* WINDOW_GUI_H */