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

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

		Author:	Arnaud
		Date:	5/15/2003

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

#ifndef __BasicPropertiesClient__
#define __BasicPropertiesClient__

#if CP_PRAGMA_ONCE
#pragma once
#endif


#include "BasicCOMImplementations.h"
#include "IChangeManagement.h"
#include "IPropertiesModule.h"
#include "MCCountedPtr.h"

/// \addtogroup BaseClass
/// \{

/// Basic Properties Client class.  Derive from this for a default implementation of IPropertiesClient.
/// Don't forget STANDARD_RELEASE in your derived class.
/// \see IPropertiesClient
class TBasicPropertiesClient :	public TBasicUnknown,
								public IChangeListener,
								public IPropertiesClient
{
public:	
	TBasicPropertiesClient						(IPropertiesModule*		inPropertiesModule);
	~TBasicPropertiesClient();
	
	//IMCUnknown methods
	MCCOMErr	MCCOMAPI 	QueryInterface		(const MCIID& riid, void** ppvObj);
	uint32		MCCOMAPI 	AddRef 				()										{ return TBasicUnknown::AddRef(); }
	uint32		MCCOMAPI	Release();
	//Don't forget STANDARD_RELEASE in your derived class
	

	// IChangeListener methods
	void 		MCCOMAPI 	DataChanged			(	IChangeChannel* 	channel, 
													IDType 				changeKind, 
													IMCUnknown* 		changedData)	
	{
		//Put the following code in you overide method if you are doing other things
		//if (!fPropertiesModule->GetThisModule()->GetIsHydrated())
		//	return;
	}
	
	// IPropertiesClient methods
	void		MCCOMAPI	GetSelectionChannel	(	IChangeChannel**	outChannel);
	
	ResourceID	MCCOMAPI	GetToolPropResID()	{ return -1; }
	int32		MCCOMAPI	GetToolTabSize()	{ return 0; }

	void		MCCOMAPI	LoadPageData		(	IMFPart* 			inTopPart)	{ fPropertiesModule->SetCurrentSelectionType(GetPropResID()); }
	void		MCCOMAPI	LoadToolPageData	(	IMFPart* 			inTopPart)	{ }
	
	boolean		MCCOMAPI	HandlePageHit		(	IMFPart*			inTopPart,
													int32				inMessage,
													IMFResponder*		inResponder,
													void*				inData)			{ return false; }
	boolean		MCCOMAPI	HandleToolPageHit	(	IMFPart*			inTopPart,
													int32				inMessage,
													IMFResponder*		inResponder,
													void*				inData)			{ return false; }
	
	void		MCCOMAPI	GetExtraPart		(IMFPart**				outExtraPart);
	void		MCCOMAPI	GetExtraTabs		(TMCClassArray<TPropertyTab>& extraTabs);
	void		MCCOMAPI	ExtraTabsLoaded		(IMFPart*				inHostPart)		{ }
	void		MCCOMAPI	UnLoadProperties	(IMFSplitBarPart*	inPropertiesSplitBar);
	void		MCCOMAPI	PreLoadProperties	(IMFSplitBarPart*	inPropertiesSplitBar);

	void		MCCOMAPI	Validate			()							{ }

protected:
	//required overrides:	

	//outPreferedSize should come from your prefs, 
	//	it represents in pixels the prefered size given to the part above or below the split bar
	// if outForTopPart is true, outPreferedSize is for the part above the split bar (else below)
	virtual void			GetPreferedSplit	(int32& outPreferedSize, boolean& outForTopPart)= 0;

	//you should put the given value in your prefs.
	virtual void			StorePreferedSplit	(int32 inPreferedSize)= 0;

protected:
	TMCCountedPtr<IPropertiesModule> fPropertiesModule;
};


/// \}
#endif
