//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#include "StdAfx.h"

using namespace VWFC;
using namespace VWFC::VWObjects;
using namespace VWFC::Tools;

VWClassAttr::VWClassAttr(InternalIndex classIndex)
{
	fClassIndex	= classIndex;
}

VWClassAttr::~VWClassAttr()
{
}

CRGBColor VWClassAttr::GetPenForeColor() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	return CRGBColor( color.penFore );
}

CRGBColor VWClassAttr::GetPenBackColor() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	return CRGBColor( color.penBack );
}

void VWClassAttr::SetPenForeColor(const CRGBColor& clr)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	color.penFore		= clr.GetColorIndex();
	::GS_SetClColor( gCBP, fClassIndex, color );
}

void VWClassAttr::SetPenBackColor(const CRGBColor& clr)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	color.penBack		= clr.GetColorIndex();
	::GS_SetClColor( gCBP, fClassIndex, color );
}

CRGBColor VWClassAttr::GetFillForeColor() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	return CRGBColor( color.fillFore );
}

CRGBColor VWClassAttr::GetFillBackColor() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	return CRGBColor( color.fillBack );
}

void VWClassAttr::SetFillForeColor(const CRGBColor& clr)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	color.fillFore		= clr.GetColorIndex();
	::GS_SetClColor( gCBP, fClassIndex, color );
}

void VWClassAttr::SetFillBackColor(const CRGBColor& clr)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	ObjectColorType		color;
	::GS_GetClColor( gCBP, fClassIndex, color );
	color.fillBack		= clr.GetColorIndex();
	::GS_SetClColor( gCBP, fClassIndex, color );
}

short VWClassAttr::GetLineWeightInMils() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	return ::GS_GetClLineWeight( gCBP, fClassIndex );
}

void VWClassAttr::SetLineWeightInMils(short mils)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	::GS_SetClLineWeight( gCBP, fClassIndex, mils );
}

MarkerType VWClassAttr::GetMarker(short& size, short& angle) const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	MarkerType	style;
	::GS_GetClMarker( gCBP, fClassIndex, style, size, angle );
	return style;
}

void VWClassAttr::SetMarker(MarkerType marker, short size, short angle)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	::GS_SetClMarker( gCBP, fClassIndex, (MarkerType) marker, size, angle );
}

VWPattern VWClassAttr::GetPenPattern() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	return VWPattern( ::GS_GetClPenPat( gCBP, fClassIndex ) );
}

void VWClassAttr::SetPenPattern(const VWPattern& pattern)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	::GS_SetClPenPat( gCBP, fClassIndex, pattern );
}

VWPattern VWClassAttr::GetFillPattern() const
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	return VWPattern( ::GS_GetClFillPat( gCBP, fClassIndex ) );
}

void VWClassAttr::SetFillPattern(const VWPattern& pattern)
{
	VWFC_ASSERT( VWClass::IsValidClassIndex( fClassIndex ) );
	::GS_SetClFillPat( gCBP, fClassIndex, pattern );
}




