// ------------------------------------------------------------------------------------ //
//																						//
//	File: Asura_GUIMenu_Widget_Group.h													//
//																						//
//	Description: group widget class													//
//																						//
//	Created: Steve Keen - 9/11/06														//
//																						//
//	Copyright (C) 2006 Rebellion (Derby), All Rights Reserved.							//
// ------------------------------------------------------------------------------------ //

#ifndef __ASURA_GUIMENU_WIDGET_GROUP_H__
#define __ASURA_GUIMENU_WIDGET_GROUP_H__

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifdef ASURA_USE_GUI_MENU_SYSTEM
#include "Asura_GUIMenu_Widget_Base.h"

// -- Typedef -------------------------------------------------------------------------

// -- Enums ---------------------------------------------------------------------------

// -- Defines -------------------------------------------------------------------------
#define ASURA_GUIMENU_WIDGET_GROUP_LOCAL_FLAG_START	16

// 1: Added in the linked group information
#define ASURA_CHUNK_WIDGET_GROUP_VERSION	1

// -- Structures ----------------------------------------------------------------------

// -- Class ---------------------------------------------------------------------------

class Asura_GUIMenu_Widget_Group : public Asura_GUIMenu_Widget_Base
{
	// -- Functions -----------------------------------------------------------------------
public:
	enum Asura_GUIMenu_Inherit_Flag_Widget_Group_Type
	{
		//ASURA_GUIMENU_WIDGET_GROUP_OVERIDE_MAX is here to stop another programmer adding past bit flag 31
		ASURA_GUIMENU_WIDGET_GROUP_LOCAL_FLAG_MAX	= (1<<(ASURA_GUIMENU_WIDGET_GROUP_LOCAL_FLAG_START+15))
	};

	Asura_GUIMenu_Widget_Group();
	virtual ~Asura_GUIMenu_Widget_Group();

	virtual void				Render( u_int uState );

	virtual bool				OnDeInit( const Asura_Message_GUIMenu_Notify* pxMessage){	return false;	}

	//Does a recursive search for a selectable widget at the given location
	virtual Asura_GUIMenu_Widget_Base*  FindSelectableWidgetAtPos(const Asura_Vector_2& xPos);

#ifdef ASURA_TOOLS
	virtual void				UpdateLocalDataFromStyle( void);
	bool						CheckForCyclicLink(Asura_Hash_ID uHashID);
	void						SetLinkedGroup(Asura_Hash_ID uHashID);
	Asura_Hash_ID				GetLinkedGroup() { return m_uLinkedID; }
	void						RemoveLink()	{ m_uLinkedID = ASURA_HASH_ID_UNSET; }
	virtual void				WriteToChunkStream( Asura_Chunk_Stream& xStream) const;
	virtual void				ExportToXML(Tools_GUIMenu_XMLExporter* pxExporter) const;

#endif

	virtual void				ReadFromChunkStream( Asura_Chunk_Stream& xStream, Asura_GUIMenu_Root* pxParentObject, u_int uChunkVersion);
protected:
	void						SetupDefaultElements( void);

private:

	// -- Variables -----------------------------------------------------------------------
public:

protected:

private:
	typedef Asura_GUIMenu_Widget_Base PARENT;

	// The id of the group this group is linked to
	Asura_Hash_ID				m_uLinkedID;
};
#endif // ASURA_USE_GUI_MENU_SYSTEM
#endif // __ASURA_GUIMENU_WIDGET_GROUP_H__
