/*  GadTools layout toolkit
**
**  Copyright © 1993-1995 by Olaf `Olsen' Barthel
**  Freely distributable.
*/

#include "gtlayout_global.h"

VOID __regargs
LTP_DrawPicker(struct RastPort *RPort,BOOLEAN UpDirection,LONG Left,LONG Top,LONG Width,LONG Height)
{
	LONG i,Len,ArrowHeight,ArrowWidth,LineHeight,Start;

	LineHeight	= (Height + 15) / 16;
	ArrowHeight	= Height - (Height + 7) / 8;
	ArrowWidth	= Width;

	if(UpDirection)
	{
		for(i = 0 ; i < ArrowHeight ; i++)
		{
			Len	= ((ArrowWidth * (i + 1)) / ArrowHeight) & ~1;

			if(Len < ArrowWidth)
				Len++;

			Start	= Left + (ArrowWidth - Len) / 2;

			Move(RPort,Start,Top + i);
			Draw(RPort,Start + Len - 1,Top + i);
		}
	}
	else
	{
		for(i = 0 ; i < ArrowHeight ; i++)
		{
			Len	= ((ArrowWidth * (i + 1)) / ArrowHeight) & ~1;

			if(Len < ArrowWidth)
				Len++;

			Start	= Left + (ArrowWidth - Len) / 2;

			Move(RPort,Start,Top + ArrowHeight - 1 - i);
			Draw(RPort,Start + Len - 1,Top + ArrowHeight - 1 - i);
		}
	}

	for(i = 0 ; i < LineHeight ; i++)
	{
		Move(RPort,Left,Top + Height - 1 - i);
		Draw(RPort,Left + Width - 1,Top + Height - 1 - i);
	}
}
