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

#pragma once

#include "Control.h"

namespace VectorWorks
{
	namespace VWUI
	{
		// -----------------------------------------------------------------------------
		enum EItemTextJustification {
			kItemTextJustificationLeft		= 1,
			kItemTextJustificationCenter	= 2,
			kItemTextJustificationRight		= 3
		};

		// -----------------------------------------------------------------------------
		enum EItemTextStyle {
			kItemTextStylePlain				= 0,
			kItemTextStyleBold				= 1,
			kItemTextStyleItalic			= 2,
			kItemTextStyleBoldAndItalic		= 3,
			kItemTextStyleUnderline			= 4,
			kItemTextStyleInvalid			= 8
		};

		// -----------------------------------------------------------------------------
		class VWListBrowserCtrl;

		// -----------------------------------------------------------------------------
		class VWListBrowserItem
		{
		friend class VWListBrowserCtrl;
		protected:
										VWListBrowserItem(TControlID dialogID, TControlID controlID, short columnID, short rowID);
		public:
										VWListBrowserItem (const VWListBrowserItem& item);
										~VWListBrowserItem();

			VWListBrowserItem&			operator=(const VWListBrowserItem& item);

		// item specific function
		public:
			void						SetItemText(const TXString& text);
			void						SetItemImage(size_t imageIndex);
			void						SetItemInfo(const TXString& text, size_t imageIndex);
			TXString					GetItemText() const;
			size_t						GetItemImage() const;
			bool						GetItemInfo(TXString& outText, size_t& outImage) const;
			bool						SetItemData( const long userData );
			bool						GetItemData( long &outUserData );

			bool						IsItemVisible() const;
			void						EnableItem(bool enable);

			void						SetItemTextStyle(EItemTextStyle textStyle);
			EItemTextStyle				GetItemTextStyle();

			void						SetItemTextJustification(EItemTextJustification justification);
			EItemTextJustification		GetItemTextJustification();

			void						SetMultImageIndexes(size_t imageIndex0, size_t imageIndex1 = (size_t) -1, size_t imageIndex2 = (size_t) -1);
			bool						GetMultImageIndexes(size_t& outImageIndex0, size_t& outImageIndex1, size_t& outImageIndex2);

			void						SetOwnerDrawnType(EListBrowserOwnerDrawnType ownerDrawnType);
			EListBrowserOwnerDrawnType	GetOwnerDrawnType();

			void						SetItemUsingColumnDataItem(size_t columnDataItemIndex);
			bool						GetColumnDataItemInfo();

		// attributes
		public:
			void						SetItemTextColor(size_t redIndex, size_t greenIndex, size_t blueIndex);
			bool						GetItemTextColor();

			void						SetItemDashStyle(size_t styleIndex, size_t lineWeight);
			bool						GetItemDashStyle();

			void						SetItemFillForeColor(size_t redIndex, size_t greenIndex, size_t blueIndex);
			void						SetItemNoFillForeColor();
			bool						GetItemFillForeColor( size_t &redIndex, size_t &greenIndex, size_t &blueIndex );

			void						SetItemFillBackColor(size_t redIndex, size_t greenIndex, size_t blueIndex);
			bool						GetItemFillBackColor();

			void						SetItemPenForeColor(size_t redIndex, size_t greenIndex, size_t blueIndex);
			bool						GetItemPenForeColor();

			void						SetItemPenBackColor(size_t redIndex, size_t greenIndex, size_t blueIndex);
			bool						GetItemPenBackColor();

			void						SetItemGradientOrImageRefNumber(size_t refNumber);
			size_t						GetItemGradientOrImageRefNumber();

		protected:
			short						fRowID;
			short						fColumnID;
			TControlID					fControlID;
			TControlID					fDialogID;
		};
	}
}