X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbox.h;h=002ba6d96b146b76f0864ca7e263e1c5930e66ae;hb=e94889a041628203c50b66b9a4add63210de6928;hp=1d8b6483bcd49609a445f4d7c4294d785eb72808;hpb=6774c17368a3474f11c1e011cf1ce482e42f4867;p=lyx.git diff --git a/src/box.h b/src/box.h index 1d8b6483bc..002ba6d96b 100644 --- a/src/box.h +++ b/src/box.h @@ -1,43 +1,48 @@ +// -*- C++ -*- /** * \file box.h - * Copyright 2001 the LyX Team - * Read the file COPYING + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author John Levon + * \author John Levon + * + * Full author contact details are available in file CREDITS. */ #ifndef BOX_H #define BOX_H -#include - -#include "debug.h" - +#include + /** * 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. + * + * Negative values are allowed. */ -struct Box { - unsigned int x1; - unsigned int x2; - unsigned int y1; - unsigned int y2; +class Box { +public: + int x1; + int x2; + int y1; + int y2; - Box(unsigned int x1_, unsigned int x2_, - unsigned int y1_, unsigned int y2_) : - x1(x1_), x2(x2_), y1(y1_), y2(y2_) {} + /// Zero-initialise the member variables. + Box(); + /// Initialise the member variables. + Box(int x1_, int x2_, int y1_, int y2_); /** * Returns true if the given co-ordinates are within * the box. Check is exclusive (point on a border * returns false). */ - bool contained(unsigned int x, unsigned int y) { - return (x1 < x && x2 > x && - y1 < y && y2 > y); - } + bool contains(int x, int y); }; - + + +std::ostream & operator<<(std::ostream &, Box const &); + #endif // BOX_H