/******************************************************************************
** Copyright (C) 2001, University of Alabama in Huntsville. All rights 
** reserved.
**
** File   : DrawableElement.h
**
** Author : Satish Hota
**
** Description:
**    This file provides interface for CDrawableElement class.
**
** History:
** 15-Nov-01 Satish Hota
**     File Created
** 20-Nov-01 Satish Hota
**     Added new methods
** 24-Nov-01 Satish Hota
**     Added new methods and renamed and modified existing methods
** 25-Nov-01 Satish Hota
**     Temporarily made the GetText method unpure virtual to enable instantiation
**     of this class in the document constructor.
** 26-Nov-01 Satish Hota
**     Added static class member c_nTextClearance to hold the clearance in logical
**     units.  Also added a temporary member m_strText to hold testing text.
** 26-Nov-01 Edwin Chan
**     Added method OnEditProperties, Intersects, and IsSelected
** 28-Nov-01 Satish Hota
**     Renamed this class from CDrawable to CDrawableElement.  Created a 
**     CDrawable super-class which has usurped some of the methods and member
**     variables of this class.
** 30-Nov-01 Satish Hota
**     Added the ClipLine method.
** 02-Dec-01 Edwin Chan, Satish Hota
**     Added DoJoin and DoDetach methods.
******************************************************************************/

#if !defined(AFX_DRAWABLEELEMENT_H__CD105D8B_8879_4238_B321_246C3A91C003__INCLUDED_)
#define AFX_DRAWABLEELEMENT_H__CD105D8B_8879_4238_B321_246C3A91C003__INCLUDED_

#include "MFCDevConHelper.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include <string>
#include "ConGraT.h"
#include "Drawable.h"

class CDrawableElement:public CDrawable
{
public:
	virtual void DoDetach();
	virtual void DoJoin(CDrawableElement* pInElement);
	virtual long ClipLine(int *pnFromX, int *pnFromY, int *pnToX, int *pnToY);
	// The following methods are static methods on the class
    static void SetDevConHelper(CMFCDevConHelper* pDevConHelper);

    // The following methods should be implemented by sub-classes
    //virtual long GetText(std::string& strText) = 0;
    virtual long GetText(std::string& strText);

    // The following methods may be overridden by the sub-classes
	virtual ~CDrawableElement(); // Default destructor
	virtual long TranslateBy(int nDeltaX, int nDeltaY);
	virtual void SetToLocation(int nToX, int nToY);
	virtual void SetFromLocation(int nFromX, int nFromY);
	virtual long HitTest(int nXCoor, int nYCoor);
	virtual void OnEditProperties(CmdType eCmd);
	
    // The following methods cannot be overridden in sub-classes
	CDrawableElement(); // Default constructor
    void UnSelect(void);
	void Select(void);
	bool Intersects(const CRect& rect);
	bool IsSelected();

	// Return codes that can be returned by methods of this class
    enum eReturnCodes
	{
		RC_S_HitSucess = 2,
		RC_S_HitFailue,
	};

protected:
	bool m_bSelected;

protected:
    std::string m_strText;
	static CMFCDevConHelper* c_pDevConHelper;
	static const int c_nTextClearance;
};

typedef std::vector<CDrawableElement*> VDrawableElement;

#endif // !defined(AFX_DRAWABLEELEMENT_H__CD105D8B_8879_4238_B321_246C3A91C003__INCLUDED_)
