src/widget.cpp
changeset 8845 e0eac76d3d16
parent 8831 c13fdbe2783a
child 8907 5104ad700e31
--- a/src/widget.cpp	Fri Jan 18 03:48:29 2008 +0000
+++ b/src/widget.cpp	Fri Jan 18 10:36:55 2008 +0000
@@ -14,6 +14,9 @@
 #include "table/sprites.h"
 #include "table/strings.h"
 
+static const char *UPARROW   = "\xEE\x8A\x80";
+static const char *DOWNARROW = "\xEE\x8A\xAA";
+
 static Point HandleScrollbarHittest(const Scrollbar *sb, int top, int bottom)
 {
 	Point pt;
@@ -579,3 +582,16 @@
 		}
 	}
 }
+
+/** Draw a sort button's up or down arrow symbol.
+ * @param w Window of widget
+ * @param widget Sort button widget
+ * @param state State of sort button
+ */
+void DrawSortButtonState(const Window *w, int widget, SortButtonState state)
+{
+	if (state == SBS_OFF) return;
+
+	int offset = w->IsWidgetLowered(widget) ? 1 : 0;
+	DoDrawString(state == SBS_DOWN ? DOWNARROW : UPARROW, w->widget[widget].right - 11 + offset, w->widget[widget].top + 1 + offset, TC_BLACK);
+}