2002-01-07 14:36:10 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file Box.cpp
|
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
|
|
|
*/
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
// Code moved out of line and out of Box.h by Angus (7 Jan 2002)
|
2002-01-07 14:36:10 +00:00
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Box.h"
|
2002-01-07 14:36:10 +00:00
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
#include "support/std_ostream.h"
|
2002-01-07 14:36:10 +00:00
|
|
|
|
2007-07-17 17:40:44 +00:00
|
|
|
using std::ostream;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
2003-09-09 18:27:24 +00:00
|
|
|
Box::Box()
|
2003-09-04 17:01:00 +00:00
|
|
|
: x1(0), x2(0), y1(0), y2(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-09-04 14:02:05 +00:00
|
|
|
Box::Box(int x1_, int x2_, int y1_, int y2_)
|
|
|
|
: x1(x1_), x2(x2_), y1(y1_), y2(y2_)
|
2002-01-07 14:36:10 +00:00
|
|
|
{}
|
|
|
|
|
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
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|