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

#include "gtlayout_global.h"

ULONG __regargs
LTP_GetSizeWidth(struct LayoutHandle *handle)
{
	Object	*SizeImage;
	ULONG	 SizeWidth;
	UWORD	 SizeType;

	if(handle -> Screen -> Flags & SCREENHIRES)
	{
		SizeWidth	= 18;
		SizeType	= SYSISIZE_MEDRES;
	}
	else
	{
		SizeWidth	= 13;
		SizeType	= SYSISIZE_LOWRES;
	}

	if(SizeImage = NewObject(NULL,SYSICLASS,
		SYSIA_Size,	SizeType,
		SYSIA_Which,	SIZEIMAGE,
		SYSIA_DrawInfo,	handle -> DrawInfo,
	TAG_DONE))
	{
		GetAttr(IA_Width,SizeImage,&SizeWidth);

		DisposeObject(SizeImage);
	}

	if(SizeWidth < handle -> Screen -> WBorRight)
		return(handle -> Screen -> WBorRight);
	else
		return(SizeWidth);
}


/*****************************************************************************/


ULONG __regargs
LTP_GetSizeHeight(struct LayoutHandle *handle)
{
	Object	*SizeImage;
	ULONG	 SizeHeight;
	UWORD	 SizeType;

	if(handle -> Screen -> Flags & SCREENHIRES)
	{
		SizeHeight	= 10;
		SizeType	= SYSISIZE_MEDRES;
	}
	else
	{
		SizeHeight	= 11;
		SizeType	= SYSISIZE_LOWRES;
	}

	if(SizeImage = NewObject(NULL,SYSICLASS,
		SYSIA_Size,	SizeType,
		SYSIA_Which,	SIZEIMAGE,
		SYSIA_DrawInfo,	handle -> DrawInfo,
	TAG_DONE))
	{
		GetAttr(IA_Height,SizeImage,&SizeHeight);

		DisposeObject(SizeImage);
	}

	if(SizeHeight < handle -> Screen -> WBorBottom)
		return(handle -> Screen -> WBorBottom);
	else
		return(SizeHeight);
}
