//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#pragma once

namespace VWFC
{
	namespace VWObjects
	{
		class VWGroupObj : public VWObject
		{
		public:
								VWGroupObj();
								VWGroupObj(MCObjectHandle hGroup);
								VWGroupObj(const VWGroupObj& src);
			virtual				~VWGroupObj();

			VWGroupObj&			operator=(const VWGroupObj& src);

		public:
			// add specified object into this container
			void				AddObject(MCObjectHandle hObj);

			// delete objects inside the group
			void				DeleteAllInnerObjects();
			
			// Return the first object in this container
			MCObjectHandle		GetFirstMemberObject() const;
			// Return iterator to the first object in this container
			VWObjectIterator	GetFirstMemberIterator() const;
			
			// Returns the last object in this container
			MCObjectHandle		GetLastMemberObject() const;
			// Return iterator to the last object in this container
			VWObjectIterator	GetLastMemberIterator() const;

			// Find a handle in a list (searching children and aux lists).
			// Return true if the handle is found. 
			Boolean				FindHandleDeep(MCObjectHandle hObj);

			// move all objects within the group
			void				MoveObjectDeep(const VWPoint2D& offset);
			void				Move3DObjectDeep(const VWPoint3D& offset);

			// set the specified transformation to all objects within this group
			// and to all other going reqursively down the groups
			void				ApplyTransformDeep(const VWTransformMatrix& matrix);

			// tool
		public:
			// Create group containing all selected objects
			static MCObjectHandle	GroupSelection();

			// Return true if the specified object handle is group
			static bool			IsGroupObject(MCObjectHandle hObj);
			static bool			IsGroupLikeObject(MCObjectHandle hObj);

		protected:
			// this is constructor for inheritant of this class
			// so this class will not create a new group but let the inheritant do that job
								VWGroupObj(int);

		private:
			void			ApplyTransformDeepReq(MCObjectHandle hObject, const VWTransformMatrix& matrix);
			void			MoveDeepReq(MCObjectHandle hObject, const VWPoint2D& offset);
			void			MoveDeepReq(MCObjectHandle hObject, const VWPoint3D& offset);
		};
	}
}