(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.

This commit is contained in:
peter1138
2008-01-18 10:36:55 +00:00
parent b7f50533c2
commit 68707808c0
11 changed files with 38 additions and 28 deletions

View File

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