/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                   Copyright (c) 2002 Zanoza Software.                   *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler's native rectange
 *--------------------------------------------------------------------------
 * @histroy: 18.10.2002. Created
 */
#ifndef zrect_h_included
#define zrect_h_included

#ifndef zsequence_h_included
# include "zsequence.h"
#endif
#include "zpoint.h"

//------------------------------------------------------
//  ZRect - ZModeler's native rectangular area
//------------------------------------------------------
class DLL_LINKAGE ZRect
{
public:
  ZRect();
  ZRect(const ZRect& rc);
  ZRect(const int x, const int y, const int w, const int h);
  ~ZRect();
  ZRect(LPCRECT);
  operator LPCRECT() const;
  operator LPRECT();

  ZRect& operator = (LPCRECT prect);
  ZRect& operator = (const ZRect& rect);
  bool operator != (const ZRect& rect) const;
  bool operator == (const ZRect& rect) const;
  bool operator <  (const ZRect& rect) const;

  bool contains( const  ZPoint& p) const;
  bool contains( const  ZRect& r) const;
  bool intersects( const  ZRect& r) const;
  //
  // corners
  //
  inline ZPoint topLeft() const     { return ZPoint(m_Rect.left, m_Rect.top); }
  inline ZPoint topRight() const    { return ZPoint(m_Rect.right, m_Rect.top); }
  inline ZPoint bottomLeft() const  { return ZPoint(m_Rect.left, m_Rect.bottom); }
  inline ZPoint bottomRight() const { return ZPoint(m_Rect.right, m_Rect.bottom); }

  long area(void) const;

  long width(void) const;
  void width(long _w);
  long height(void) const;
  void height(long _h);

  long x(void) const;
  void x(long _x);
  long y(void) const;
  void y(long _y);

  ZRect& expand(const ZRect& rect);

private:
  RECT  m_Rect;
};

typedef ZSequence<ZRect>  ZRectSeq;



#endif //zrect_h_included

