/*************************************************************************\
* "$RCSfile: CRegion.h,v $"                                               *
***************************************************************************
* Information by CVS or VSS:                                              *
*     Last check in on: $Date: 2009/04/28 09:22:22 $                      *
*     by                $Author: schluckebier $
*     Revision        : $Revision: 1.8 $                                  *
\*************************************************************************/
/*! \file CRegion.h
*	\brief Header CRegion Class
**************************************************************************/

#ifndef _CREGION_H_
#define _CREGION_H_

/*************************************************************************/
/*! @brief Region class

	Management of regions
**************************************************************************/
class CRegion
{
public:
	//! Constructor
	CRegion() { m_bAutoClip = false; }
	void NewWH(int x, int y, int Width, int Height, const char *pName = NULL);
	void NewXY(int x1, int y1, int x2, int y2, const char *pName = NULL);
	void Clip(int Width, int Height);
	void AlignWH(int AlignW, int AlignH = 0);
	void AlignXY(int AlignX, int AlignY = 0);
	void Scale(float Factor);
	void MoveCenter(int x, int y);

	//! Returns width of region.
	int GetWidth()
		{ m_Width = m_Right - m_Left; return m_Width; }

	//! Returns height of region.
	int GetHeight()
		{ m_Height = m_Bottom - m_Top; return m_Height; }

	//! Disables automatic clipping of region.
	void DisableAutoClip()
		{ m_bAutoClip = false; }

	//! @brief Enables automatic clipping of region.
	//! @param w Width of clipping window
	//! @param h Height of clipping window
	void SetAutoClip(int w, int h)
		{ m_ClipWidth = w; m_ClipHeight = h, m_bAutoClip = true; }

	int m_Left;		//!< Left border
	int m_Top;		//!< Top border
	int m_Bottom;	//!< Bottom border
	int m_Right;	//!< Right border
	int m_Width;	//!< Width
	int m_Height;	//!< Height
	char m_Name[32];//!< Name

protected:
	bool m_bAutoClip;	//!< Region is clipped
	int m_ClipWidth;	//!< Width of clipping window
	int m_ClipHeight;	//!< Height of clipping window
};

#endif

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