X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbox.h;h=6ba0997205e7893af0c5b290059b917a7dd0c857;hb=bc3e15c4c865a6b23e1e9efeca440784ff31e547;hp=a42a1b84c6768f4e6d6c8a140655f67d8d793730;hpb=1070702ea46b36ec5016bad2fe97649cec5e6148;p=lyx.git diff --git a/src/box.h b/src/box.h index a42a1b84c6..6ba0997205 100644 --- a/src/box.h +++ b/src/box.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** * \file box.h * Copyright 2001 the LyX Team @@ -9,31 +10,34 @@ #ifndef BOX_H #define BOX_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; + 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_) {} + /// 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 contained(int x, int y); }; - + + +std::ostream & operator<<(std::ostream &, Box const &); + #endif // BOX_H