#ifndef __I3DImageDocument__
#define __I3DImageDocument__
/****************************************************************************************


		I3DImageDocument.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Emil
		Date:	1/7/99

		Revision History

		when		who			what & why
		==========	==========	======================================================
		11/19/99	dsm			added SetFrameNumber for frame number display in the title bar

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

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "LayerTypes.h"

//****** Globally Unique Ids *************************************************

MCDEFINE_GUID(IID_I3DImageDocument, 0x5e6cfb7e, 0xa660, 0x11d2, 0x8b, 0x5e, 0x0, 0x60, 0x97, 0xb, 0xc5, 0x21);

class  TMCRect;

struct IShRasterLayer;
struct TPSIOParameter;
struct TGBuffer32List;
struct TPSOptions;
struct IShLayerList;

typedef boolean (*TWarnWhenClosingCallback)(void* closeInfo);	

/*****************************************************************************\
*                                                                             *
*  I3DImageDocument		                                                      *
*                                                                             *
\*****************************************************************************/

/// \addtogroup ShellInterface
/// \{

/// This interface is used to access an image document in Carrara. It can be
/// used to access the image after the rendering.
///
struct I3DImageDocument : public IMCUnknown
{
	// ****************************************************************************
	//								InitializeRasterLayer
	// 
	/// Creates a raster layer for the image document and the default channels
	/// 
	/// \param width      width of the layer
	/// \param height     height of the layer
	/// \param colorType  type of the layer (RGB or RGBA)
	/// \param dpi        resolution of the layer in dot per inch
	/// 
	virtual MCCOMErr MCCOMAPI InitializeRasterLayer(uint32 width, uint32 height,ELayerColorType colorType, real32 dpi = 72.0f) = 0;
	
	// ****************************************************************************
	//								LoadFromDisk
	// 
	/// Loads the image from a file on the disc.
	/// 
	/// \param aFile   The file that contains the image.
	/// \param format  The ID of the file format
	/// \param param   Optional parameters.
	/// 
	virtual MCCOMErr MCCOMAPI LoadFromDisk(IMCFile * aFile, IDType format, TPSIOParameter *param = nil) = 0;
	
	// ****************************************************************************
	//								SaveToDisk
	// 
	/// Saves the image into a file on the disc
	/// 
	/// \param aFile            A pointer to the file where the image should be saved.
	/// \param format           The file format.
	/// \param displayOptions   True if the option dialog box should be displayed
	/// \param pluginOptions    
	/// \param param            Optional parameters
	/// 
	virtual MCCOMErr MCCOMAPI SaveToDisk(IMCFile * aFile,IDType format,boolean displayOptions = true, 
										 TPSOptions* pluginOptions = nil,TPSIOParameter *param = nil) = 0;

	// ****************************************************************************
	//								GetRasterLayer
	// 
	/// Returns a pointer to the rasterlayer that contains the image.
	/// 
	/// \param rasterLayer  The rasterlayer that is returned.
	/// 
	virtual MCCOMErr MCCOMAPI GetRasterLayer(IShRasterLayer ** rasterLayer) = 0;


	// ****************************************************************************
	//								SetRasterLayer
	// 
	/// Sets the rasterlayer that contains the image of the document.
	/// 
	/// \param rasterLayer  The image.
	/// 
	virtual MCCOMErr MCCOMAPI SetRasterLayer(IShRasterLayer * rasterLayer) = 0;
	
	// ****************************************************************************
	//								CreateNewRasterLayer
	// 
	/// Creates a new empty image in the document.
	/// 
	/// \param rasterLayer  A pointer to the rasterlayer that is created.
	/// 
	virtual MCCOMErr MCCOMAPI CreateNewRasterLayer(IShRasterLayer ** rasterLayer) = 0;

	// ****************************************************************************
	//								SetGBuffers32
	// 
	/// Sets the GBuffers associated with the current image.
	/// 
	/// \param GBufferList  A list of GBuffers.
	/// 
	virtual void MCCOMAPI SetGBuffers32(const TGBuffer32List& GBufferList) = 0;

	// ****************************************************************************
	//								SetLayerList
	// 
	/// Sets the layer list to use.
	/// 
	virtual void MCCOMAPI SetLayerList(IShLayerList* layerList) = 0;

	// ****************************************************************************
	//								UpdateRect
	// 
	/// Updates a rectangle of the image on the screen.
	/// 
	/// \param rect  The rectangle that should be updated.
	/// 
	virtual MCCOMErr MCCOMAPI UpdateRect(const TMCRect & rect) = 0;
	
	// ****************************************************************************
	//								CloseWindow
	// 
	/// Close the document window.
	/// 
	/// 
	virtual MCCOMErr MCCOMAPI CloseWindow() = 0;

	//
	//
	// ****************************************************************************
	//								SetWarnWhenClosing
	// 
	/// Set the callback if you need to authorize the image closing
	/// (You don't want the image to be closed when you render it)
	/// closeInfo is deleted in the destructor of image3DDocument.
	/// 
	/// \param warnWhenClosing  The callback that should be called if the user tries to close the document window.
	/// \param closeInfo        Some private data that are passed to the callback.
	/// 
	virtual	void	MCCOMAPI SetWarnWhenClosing(TWarnWhenClosingCallback warnWhenClosing, void *  closeInfo) = 0;

	
	// ****************************************************************************
	//								SetScratchDocFullPathName
	// 
	/// Sets the path of a file temporary file where the image can be stored.
	/// 
	/// \param fullPathName  The full pathname of the temporary document.
	/// 
	virtual	void	MCCOMAPI SetScratchDocFullPathName(const TMCString& fullPathName) = 0;

	// ****************************************************************************
	//								SetFrameNumber
	// 
	/// Used for title display (curFrame/maxFrame).
	/// 
	/// \param displayFrame  True if the frame count should be displayed
	/// \param curFrame      The current frame
	/// \param maxFrame      The total number of frame.
	/// 
	virtual void	MCCOMAPI SetFrameNumber(boolean displayFrame, uint curFrame, uint maxFrame) = 0;


	// ****************************************************************************
	//								SetIsPreview
	// 
	/// Called when this image document is used as a preview Window. The preview
	/// window is only hidden when the close button is clicked on. It's title is
	/// always preview.
	/// 
	/// \param trueOrFalse  True if it is a preview window (as used for rendering).
	/// 
	virtual void	MCCOMAPI SetIsPreview(boolean trueOrFalse) = 0;

	// ****************************************************************************
	//								IsPreview
	// 
	/// Returns true if the document is a preview window
	/// 
	virtual boolean MCCOMAPI IsPreview() = 0;

	// ****************************************************************************
	//								ShowWindow
	// 
	/// Makes the document window visible and put it in front of the other windows
	///
	virtual void	MCCOMAPI ShowWindow() = 0;

	// ****************************************************************************
	//								AdjustWindowSize
	// 
	/// Resize the document window to the raster layer size
	///
	virtual void	MCCOMAPI AdjustWindowSize() = 0;
};

/// \}


#endif

