2002-01-07 14:36:10 +00:00
|
|
|
/**
|
|
|
|
* \file box.C
|
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.
|
2002-01-07 14:36:10 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-01-07 14:36:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Code moved out of line and out of box.h by Angus (7 Jan 2002)
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2002-01-07 14:36:10 +00:00
|
|
|
#include "box.h"
|
|
|
|
|
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
2002-01-07 14:36:10 +00:00
|
|
|
Box::Box(int x1_, int x2_, int y1_, int y2_) :
|
|
|
|
x1(x1_), x2(x2_), y1(y1_), y2(y2_)
|
|
|
|
{}
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
2003-09-02 20:42:28 +00:00
|
|
|
bool Box::contains(int x, int y)
|
2002-01-07 14:36:10 +00:00
|
|
|
{
|
2003-08-11 09:09:01 +00:00
|
|
|
return (x1 < x && x2 > x && y1 < y && y2 > y);
|
2002-01-07 14:36:10 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2003-08-11 09:09:01 +00:00
|
|
|
ostream & operator<<(ostream & os, Box const & b)
|
2002-01-07 14:36:10 +00:00
|
|
|
{
|
2003-08-11 09:09:01 +00:00
|
|
|
return os << "x1,y1: " << b.x1 << ',' << b.y1
|
2002-11-27 10:30:28 +00:00
|
|
|
<< " x2,y2: " << b.x2 << ',' << b.y2
|
2002-11-04 00:15:56 +00:00
|
|
|
<< std::endl;
|
2002-01-07 14:36:10 +00:00
|
|
|
}
|