2002-01-07 14:36:10 +00:00
|
|
|
// -*- C++ -*-
|
2001-12-17 14:25:04 +00:00
|
|
|
/**
|
|
|
|
* \file box.h
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BOX_H
|
|
|
|
#define BOX_H
|
|
|
|
|
2002-01-07 14:36:10 +00:00
|
|
|
#include <iosfwd>
|
2002-01-07 14:17:54 +00:00
|
|
|
|
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
|
|
|
*/
|
|
|
|
struct Box {
|
2002-01-07 10:17:44 +00:00
|
|
|
int x1;
|
|
|
|
int x2;
|
|
|
|
int y1;
|
|
|
|
int y2;
|
2001-12-17 14:25:04 +00:00
|
|
|
|
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).
|
|
|
|
*/
|
2002-01-07 14:36:10 +00:00
|
|
|
bool contained(int x, int y);
|
2001-12-17 14:25:04 +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-01-07 10:17:44 +00:00
|
|
|
|
2001-12-17 14:25:04 +00:00
|
|
|
#endif // BOX_H
|