// GUIPath.h: interface for the GUIPath class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GUIPATH_H__C2450FAD_1BFE_4F8F_A58F_8529BFDEB6E0__INCLUDED_)
#define AFX_GUIPATH_H__C2450FAD_1BFE_4F8F_A58F_8529BFDEB6E0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include"GUIObjectList.h"
#include"EdGUIObject.h"
#include"GUINode.h"
#include<Stuff\Stuff.hpp>

namespace MechWarrior4
{
class Path;
};


class GUIBound:public GUIObjectList
{
protected:
	DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> > MyBound;
	void SyncNodesToData();
	void SyncDataToNodes();

public:
	EdGUIObject *Clone();
	EdGUIObject *InsertNodeAt(int idx,Point3D &pnt);
	void SaveTextInfo(NotationFile *not_file);
	bool CanTakeChildren() {return false;}
	void SortChildren() {} 
	void Draw(DrawInfo &dinf);
	EdGUIObject *AddNodeIfSelected(Point3D &pnt,bool insert);
	void OffsetSelection(Point3D &vct); 
	void RemoveObject(int idx);
	bool DeleteSelected(UndoCommand **delcom); 
	void SyncData()  {SyncDataToNodes();}
	bool IsConcave();

	void InsertObjectAt(int idx,EdGUIObject *gobj);
	int GroupSelected(UndoCommand **cmd) {return 0;}
	void ResetTo(Point3D tl,Point3D br);
	bool UnGroupSelected(UndoCommand **cmd) {return false;}
	void MoveToGroup(EdGUIObject *gobj) {}

	GUIBound(CString name="Bound");
	void SetBoundData(DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> > &BDat);
	void GetBoundData(DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> > *BDat) {Check_Object(BDat); *BDat=MyBound;}
	virtual ~GUIBound();
	int GetUnSelIcon() {return ICON_BOUND; }
	int GetSelIcon()   {return ICON_BOUND; }

	void UpdateVisibility(DWORD visflag) { SetHide(visflag&SHOW_BOUNDS?false:true);}
};

class GUIPath:public GUIObjectList
{
private:

protected:
	void Copy(GUIPath &obj);
	MechWarrior4::Path *MyPath;
	void SyncNodesToData();
	void SyncDataToNodes();
	void Build();
public:
	EdGUIObject *Clone();
	
	GUIPath();
	GUIPath(CString &name);

	void RemoveFromMap();
	void AddToMap();

	void InsertObjectAt(int idx,EdGUIObject *gobj);
	void SortChildren() {} 
	void SaveTextInfo(NotationFile *not_file);
	void AssociateTo(MechWarrior4::Path *path);
	void OffsetSelection(Point3D &vct); 
	bool DeleteSelected(UndoCommand **delcom); 
	EdGUIObject *AddNodeAtEnd(Point3D &pnt);
	EdGUIObject *InsertNodeAt(int idx,Point3D &pnt);
	void SetName(CString &name);
	void Dissociate() {  MyPath=NULL;}
	int GroupSelected(UndoCommand **cmd) {return 0;}
	bool UnGroupSelected(UndoCommand **cmd) {return false;}
	void MoveToGroup(EdGUIObject *gobj) {}
	void SyncData() {SyncDataToNodes();}

	void Draw(DrawInfo &dinf);
	EdGUIObject *AddNodeIfSelected(Point3D &pnt,bool insert);
	void RemoveObject(int idx);

	void UpdateVisibility(DWORD visflag) { SetHide(visflag&SHOW_PATHS?false:true);}

	HTREEITEM AddToBranch(CTreeCtrl *tree,HTREEITEM itm);
	int GetUnSelIcon() {return ICON_PATH; }
	int GetSelIcon()   {return ICON_PATH; }
	CString GetTypeName() {return ("Path");} 

virtual ~GUIPath();

};





#endif // !defined(AFX_GUIPATH_H__C2450FAD_1BFE_4F8F_A58F_8529BFDEB6E0__INCLUDED_)
