X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbox.h;h=adcb4958c49fa94c6cc0b5beb96585e68b5b533b;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=60efc7556298d393503c1c309896796dec7f6ac0;hpb=61ccd8b8b58f7b6235ae4516a0ed2b1702af6286;p=lyx.git diff --git a/src/box.h b/src/box.h index 60efc75562..adcb4958c4 100644 --- a/src/box.h +++ b/src/box.h @@ -1,14 +1,22 @@ +// -*- 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 + + +namespace lyx { + /** * A simple class representing rectangular regions. * It is expected that the box be constructed in @@ -17,33 +25,30 @@ * * Negative values are allowed. */ -struct Box { +class Box { +public: int x1; int x2; int y1; int y2; - Box(int x1_, int x2_, - int y1_, 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(int x, int y) { - return (x1 < x && x2 > x && - y1 < y && y2 > y); - } - - + bool contains(int x, int y); }; - -inline std::ostream & operator<<(std::ostream & o, Box & b) -{ - return o << "x1,y1: " << b.x1 << "," << b.y1 - << " x2,y2: " << b.x2 << "," << b.y2 << std::endl; -} - + + +std::ostream & operator<<(std::ostream &, Box const &); + + +} // namespace lyx + #endif // BOX_H