diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-18 10:36:55 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-18 10:36:55 +0000 |
commit | 68707808c015db1cda0723882ffce99977d4593c (patch) | |
tree | 4a7f2fbd16bbc5ad48c890141c722273c2efea2e /src/widget.cpp | |
parent | b7f50533c29ea74e9973ac641ec677eb69411d5d (diff) | |
download | openttd-68707808c015db1cda0723882ffce99977d4593c.tar.xz |
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
Diffstat (limited to 'src/widget.cpp')
-rw-r--r-- | src/widget.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/widget.cpp b/src/widget.cpp index 9cb767149..d13352f77 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -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 @@ void ResizeButtons(Window *w, byte left, byte right) } } } + +/** 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); +} |