#ifdef CVCLUVIZST_EXPORTS
	#define CLUVIZDLL_API __declspec(dllexport)
#else
	#define CLUVIZDLL_API __declspec(dllimport)
#endif

#include <string>
#include <vector>
using namespace std;

#include "Rx.Core/RxString.h"
#include "Rx.Core.Ex/RxArrayString.h"
#include "Rx.Core.Ex/RxStdVbo.h"
#include "Rx.CluViz.Core.Base\CLUVizDefines.h"
#include "Rx.CluViz.Core.Base\CLUVizTypes.h"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// namespace: CLUViz.ST
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace CLUViz
{
	namespace ST
	{
		// Start the CLUViz Engine.
		CLUVIZDLL_API void Start();

		// End the engine
		CLUVIZDLL_API void End();

		// Get the error text of the last error that occurred
		CLUVIZDLL_API bool GetLastError(char* pcError, int iMaxLen);

		// Embed a CLUViz window into the window given by hWnd
		CLUVIZDLL_API void EmbedWindow(int& iHandle, __int64 hWnd, bool bCreateSRC = false, __int64* phGlRc = 0);

		// Release a CLUViz Window
		CLUVIZDLL_API void ReleaseWindow(int iHandle);
		// Release all CLUViz Windows
		CLUVIZDLL_API void ReleaseAll();

		// Sets a mouse event callback function
		CLUVIZDLL_API void SetMouseEventHandler(int iHandle, CLUViz::TFuncMouseEventCallback pFunc, void* pvContext);
		// Removes the mouse event callback function
		CLUVIZDLL_API void RemoveMouseEventHandler(int iHandle);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Sets the error event handler.
		/// </summary>
		///
		/// <param name="iHandle">   The handle of the view. </param>
		/// <param name="pFunc">	 If non-null, the callback function. </param>
		/// <param name="pvContext"> [in,out] If non-null, a context pointer. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CLUVIZDLL_API void SetErrorEventHandler(int iHandle, CLUViz::TFuncErrorEventCallback pFunc, void* pvContext);

		// Functions to update OGLWin when window GL Window is embedded in has changed
		CLUVIZDLL_API void EW_Display(int iHandle, bool bWait = false);
		CLUVIZDLL_API void EW_Reshape(int iHandle, int iWidth, int iHeight);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Gets the width and the height of the view port associated with the given handle.
		/// </summary>
		///
		/// <param name="iHandle"> The handle of the view. </param>
		/// <param name="iWidth">  [out] The width of the view port. </param>
		/// <param name="iHeight"> [out] The height of the view port. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CLUVIZDLL_API void EW_GetShape(int iHandle, int& iWidth, int& iHeight);

		CLUVIZDLL_API void EW_Mouse(int iHandle, int iButton, int iState, int iX, int iY);
		CLUVIZDLL_API void EW_ActiveMouseMove(int iHandle, int iX, int iY);
		CLUVIZDLL_API void EW_PassiveMouseMove(int iHandle, int iX, int iY);
		CLUVIZDLL_API void EW_SetKeyModifierStates(int iHandle, bool bShift, bool bCtrl, bool bAlt, bool bNumLock, bool bCapsLock, bool bScrollLock);
		CLUVIZDLL_API void EW_Keyboard(int iHandle, int iKey, bool bKeyDown);
		CLUVIZDLL_API void EW_LoadScript(int iHandle, const char* pcFilename, const char* pcPass = 0);
		CLUVIZDLL_API void EW_SetScript(int iHandle, const char* pcScript, bool bResetEnv = false);
		CLUVIZDLL_API void EW_ExecUser(int iHandle, const char* pcToolName = 0);
		CLUVIZDLL_API void EW_LockVis(int iHandle, bool bLock);
		CLUVIZDLL_API void EW_MakeCurrentSRC(int iHandle);

		CLUVIZDLL_API void EnableVisualization(int iHandle, bool bVal);
		CLUVIZDLL_API void EnableDrawing(int iHandle, bool bVal, bool bDoRedisplay);

		CLUVIZDLL_API void GetScriptOutput(int iHandle, char* pcText, int iMaxLen, bool& bIsError);
		CLUVIZDLL_API void GetScriptOutput(int iHandle, Rx::CRxString& sxOutput, bool& bIsError);
		CLUVIZDLL_API void GetSceneGraphPrint(int iHandle, Rx::CRxString& sxOutput);

		CLUVIZDLL_API void SetScriptPath(const char* pcPath);

		CLUVIZDLL_API void SetVarNumber(int iHandle, const char* pcVarName, int iVal);
		CLUVIZDLL_API void GetVarNumber(int iHandle, const char* pcVarName, int& iVal);

		CLUVIZDLL_API void SetVarNumber(int iHandle, const char* pcVarName, double dVal);
		CLUVIZDLL_API void GetVarNumber(int iHandle, const char* pcVarName, double& dVal);

		CLUVIZDLL_API void SetVarString(int iHandle, const char* pcVarName, const char* pcString);
		CLUVIZDLL_API void GetVarString(int iHandle, const char* pcVarName, char* pcString, int iMaxLen);

		CLUVIZDLL_API void SetVarStringList(int iHandle, const char* pcVarName, const Rx::CRxArrayString& aString);

		CLUVIZDLL_API void SetVarTensor(int iHandle, const char* pcVarName, int iDimCnt, const int* piDim, const double* pdData);
		CLUVIZDLL_API void GetVarTensorProp(int iHandle, const char* pcVarName, unsigned& uDimCnt, unsigned& uElCnt);
		CLUVIZDLL_API void GetVarTensorData(int iHandle, const char* pcVarName, unsigned* puDim, double* pdData);

		CLUVIZDLL_API void SetVarImage(int iHandle, const char* pcVarName, int iWidth, int iHeight, int iImgType, int iDataType, const void* pvData);
		CLUVIZDLL_API void GetVarImageProp(int iHandle, const char* pcVarName, int& iWidth, int& iHeight, int& iImgType, int& iDataType, int& iBytesPerPixel);
		CLUVIZDLL_API void GetVarImageData(int iHandle, const char* pcVarName, void* pvData);

		CLUVIZDLL_API void SetVarColor(int iHandle, const char* pcVarName, double dRed, double dGreen, double dBlue, double dAlpha);
		CLUVIZDLL_API void SetVarColor(int iHandle, const char* pcVarName, double* pdColor4);
		CLUVIZDLL_API void GetVarColor(int iHandle, const char* pcVarName, double& dRed, double& dGreen, double& dBlue, double& dAlpha);
		CLUVIZDLL_API void GetVarColor(int iHandle, const char* pcVarName, double* pdColor4);

		CLUVIZDLL_API void SetVarObject(int iHandle, const char* pcVarName, const Rx::SStdVbo* pData);
	}
}
