//
// Copyright © Vector Works, Inc. 2007.
// All Rights Reserved.
// 

#pragma once


namespace VectorWorks
{
	namespace PluginSupport
	{
		// ----------------------------------------------------------------------------------------------------
		// object itself component ID
		const TComponentTypeID		kObjectRootComponentTypeID		= (TComponentTypeID) -1;

		// ----------------------------------------------------------------------------------------------------
		enum EComponentTypeProp {
			eComponentTypeProp_HasFillStyle,
			eComponentTypeProp_HasPenStyle,
			eComponentTypeProp_HasMarkerBeginning,
			eComponentTypeProp_HasMarkerEnding,
			eComponentTypeProp_HasTextStyle,
			eComponentTypeProp_HasTexture,
		};

		// ----------------------------------------------------------------------------------------------------
		class DYNAMIC_ATTRIBUTE IWidgetsEditProvider : public IWidgetsProvider
		{
		public:
			virtual void	AddWidget(Sint32 widgetID, const TXString& paramName) = 0;
			virtual void	AddWidget(Sint32 widgetID, const TXString& paramName, const TXString& localizedName) = 0;
			virtual void	AddWidget(Sint32 widgetID, EWidgetType widgetType, const TXString& paramName, const TXString& localizedName) = 0;
			virtual void	AddWidget(Sint32 widgetID, EWidgetType widgetType, const TXString& localizedName) = 0;

			virtual void	InsertWidget(size_t beforeIndex, Sint32 widgetID, const TXString& paramName) = 0;
			virtual void	InsertWidget(size_t beforeIndex, Sint32 widgetID, const TXString& paramName, const TXString& localizedName) = 0;
			virtual void	InsertWidget(size_t beforeIndex, Sint32 widgetID, EWidgetType widgetType, const TXString& paramName, const TXString& localizedName) = 0;
			virtual void	InsertWidget(size_t beforeIndex, Sint32 widgetID, EWidgetType widgetType, const TXString& localizedName) = 0;

			virtual bool	SetWidget(size_t index, Sint32 widgetID, EWidgetType widgetType, const TXString& localizedName) = 0;

			virtual void	ClearWidgets() = 0;
			virtual bool	DeleteWidget(size_t index) = 0;

			virtual bool	FindWidgetIndex(Sint32 widgetID, size_t& outIndex) const = 0;
		};

		// ----------------------------------------------------------------------------------------------------
		// {2257EB99-E08E-480c-88A7-D66B5E2FB386}
		static const VWIID IID_ExtendedProps = { 0x2257eb99, 0xe08e, 0x480c, { 0x88, 0xa7, 0xd6, 0x6b, 0x5e, 0x2f, 0xb3, 0x86 } };

		class DYNAMIC_ATTRIBUTE IExtendedProps : public IVWSingletonUnknown
		{
		public:
			virtual VCOMError VCOM_CALLTYPE	GetCodeRefID(MCObjectHandle hObject, CodeRefID& outCodeRefID) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetCodeRefID(TParametricFileIndex fileIndex, CodeRefID& outCodeRefID) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetFileIndex(CodeRefID codeRef, TParametricFileIndex& outFileIndex) = 0;

			virtual VCOMError VCOM_CALLTYPE	InitObjectProperties(CodeRefID codeRef) = 0;
			virtual VCOMError VCOM_CALLTYPE	ClearAllObjectProperties() = 0;
			virtual VCOMError VCOM_CALLTYPE	ClearObjectProperties(CodeRefID codeRefID) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, bool value) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, Sint8 value) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, double value) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, bool& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, Sint8& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(CodeRefID codeRefID, ObjectPropID propID, double& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(MCObjectHandle hObject, ObjectPropID propID, bool& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(MCObjectHandle hObject, ObjectPropID propID, Sint8& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjectProperty(MCObjectHandle hObject, ObjectPropID propID, double& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetTypeProperty(Sint16 objType, ObjectPropID propID, bool& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetTypeProperty(Sint16 objType, ObjectPropID propID, Sint8& outValue) = 0;

			virtual VCOMError VCOM_CALLTYPE	InitToolProperties(CodeRefID codeRef) = 0;
			virtual VCOMError VCOM_CALLTYPE	ClearAllToolProperties() = 0;
			virtual VCOMError VCOM_CALLTYPE	ClearToolProperties(CodeRefID codeRefID) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetToolProperty(CodeRefID codeRefID, ToolPropID propID, bool value) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetToolProperty(CodeRefID codeRefID, ToolPropID propID, Sint8 value) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetToolProperty(CodeRefID codeRefID, ToolPropID propID, bool& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetToolProperty(CodeRefID codeRefID, ToolPropID propID, Sint8& outValue) = 0;

			virtual VCOMError VCOM_CALLTYPE	HandleObjectEvent(MCObjectHandle hObject, ObjectEventID eventID, Sint32& ioData) = 0;
			virtual VCOMError VCOM_CALLTYPE	HandleObjectEvent(CodeRefID codeRefID, ObjectEventID eventID, Sint32& ioData) = 0;

			virtual VCOMError VCOM_CALLTYPE	AddObjComponentType(CodeRefID inCodeRefID, TComponentTypeID typeID, const TXString& localizedName) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeName(CodeRefID inCodeRefID, TComponentTypeID typeID, TXString& outLocalizedName) = 0;

			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeProps(CodeRefID inCodeRefID, TComponentTypeID typeID, EComponentTypeProp propID, bool value) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefColors(CodeRefID inCodeRefID, TComponentTypeID typeID, const ObjectColorType& style, bool bPenByClass, bool bFilLByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefMarker(CodeRefID inCodeRefID, TComponentTypeID typeID, bool bBeginingMarker, const SMarkerStyle& style, bool bVisible, bool bByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefTextStyle(CodeRefID inCodeRefID, TComponentTypeID typeID, const STextStyle& style, bool bByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefFillPat(CodeRefID inCodeRefID, TComponentTypeID typeID, InternalIndex objIndex, bool bByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefPenPat(CodeRefID inCodeRefID, TComponentTypeID typeID, Sint16 penPat, bool bByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefLineWeight(CodeRefID inCodeRefID, TComponentTypeID typeID, Sint16 lineWeight, bool bByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	SetObjComponentTypeDefTexture(CodeRefID inCodeRefID, TComponentTypeID typeID, InternalIndex objIndex, bool bByClass) = 0;

			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeProps(CodeRefID inCodeRefID, TComponentTypeID typeID, EComponentTypeProp propID, bool& outValue) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefColors(CodeRefID inCodeRefID, TComponentTypeID typeID, ObjectColorType& outStyle, bool& bOutPenByClass, bool& bOutFilLByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefMarker(CodeRefID inCodeRefID, TComponentTypeID typeID, bool bBeginingMarker, SMarkerStyle& outStyle, bool& bOutVisible, bool& bOutByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefTextStyle(CodeRefID inCodeRefID, TComponentTypeID typeID, STextStyle& outStyle, bool& bOutByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefFillPat(CodeRefID inCodeRefID, TComponentTypeID typeID, InternalIndex& outObjIndex, bool& bOutByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefPenPat(CodeRefID inCodeRefID, TComponentTypeID typeID, Sint16* outPenPat, bool& bOutByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefLineWeight(CodeRefID inCodeRefID, TComponentTypeID typeID, Sint16& outLineWeight, bool& bOutByClass) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeDefTexture(CodeRefID inCodeRefID, TComponentTypeID typeID, InternalIndex& outObjIndex, bool& bOutByClass) = 0;

			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeWidgets(CodeRefID inCodeRefID, TComponentTypeID typeID, IWidgetsProvider*& outWidgetProvider) = 0;
			virtual VCOMError VCOM_CALLTYPE	GetObjComponentTypeWidgets(CodeRefID inCodeRefID, TComponentTypeID typeID, IWidgetsEditProvider*& outWidgetEditProvider) = 0;
		};
	}
}


