2002-01-07 14:36:10 +00:00
|
|
|
// -*- C++ -*-
|
2001-12-17 14:25:04 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file Box.h
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-12-17 14:25:04 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-12-17 14:25:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BOX_H
|
|
|
|
#define BOX_H
|
|
|
|
|
2002-01-07 14:36:10 +00:00
|
|
|
#include <iosfwd>
|
2002-01-07 14:17:54 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2001-12-17 14:25:04 +00:00
|
|
|
/**
|
|
|
|
* A simple class representing rectangular regions.
|
|
|
|
* It is expected that the box be constructed in
|
|
|
|
* normalised form, that is to say : x1,y1 is top-left,
|
|
|
|
* x2,y2 is bottom-right.
|
2002-01-07 10:17:44 +00:00
|
|
|
*
|
|
|
|
* Negative values are allowed.
|
2001-12-17 14:25:04 +00:00
|
|
|
*/
|
2005-01-19 15:03:31 +00:00
|
|
|
class Box {
|
|
|
|
public:
|
2002-01-07 10:17:44 +00:00
|
|
|
int x1;
|
|
|
|
int x2;
|
|
|
|
int y1;
|
|
|
|
int y2;
|
2001-12-17 14:25:04 +00:00
|
|
|
|
2003-09-04 14:02:05 +00:00
|
|
|
/// Zero-initialise the member variables.
|
|
|
|
Box();
|
2002-01-07 14:36:10 +00:00
|
|
|
/// Initialise the member variables.
|
|
|
|
Box(int x1_, int x2_, int y1_, int y2_);
|
2001-12-17 14:25:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given co-ordinates are within
|
|
|
|
* the box. Check is exclusive (point on a border
|
|
|
|
* returns false).
|
|
|
|
*/
|
2003-09-02 20:42:28 +00:00
|
|
|
bool contains(int x, int y);
|
2001-12-17 14:25:04 +00:00
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-01-07 14:36:10 +00:00
|
|
|
|
2002-01-08 13:34:39 +00:00
|
|
|
std::ostream & operator<<(std::ostream &, Box const &);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-12-17 14:25:04 +00:00
|
|
|
#endif // BOX_H
|