]> git.lyx.org Git - lyx.git/blob - src/box.h
ignore one more file
[lyx.git] / src / box.h
1 /**
2  * \file box.h
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #ifndef BOX_H
10 #define BOX_H
11
12 /**
13  * A simple class representing rectangular regions.
14  * It is expected that the box be constructed in
15  * normalised form, that is to say : x1,y1 is top-left,
16  * x2,y2 is bottom-right.
17  */
18 struct Box {
19         unsigned int x1;
20         unsigned int x2;
21         unsigned int y1;
22         unsigned int y2;
23
24         Box(unsigned int x1_, unsigned int x2_,
25                 unsigned int y1_, unsigned int y2_) :
26                 x1(x1_), x2(x2_), y1(y1_), y2(y2_) {}
27
28         /**
29          * Returns true if the given co-ordinates are within
30          * the box. Check is exclusive (point on a border
31          * returns false).
32          */
33         bool contained(unsigned int x, unsigned int y) {
34                 return (x1 < x && x2 > x &&
35                         y1 < y && y2 > y);
36         }
37 };
38  
39 #endif // BOX_H