]> git.lyx.org Git - lyx.git/blob - src/Box.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / Box.h
1 // -*- C++ -*-
2 /**
3  * \file Box.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef BOX_H
13 #define BOX_H
14
15 #include "support/strfwd.h"
16
17
18 namespace lyx {
19
20 /**
21  * A simple class representing rectangular regions.
22  * It is expected that the box be constructed in
23  * normalised form, that is to say : x1,y1 is top-left,
24  * x2,y2 is bottom-right.
25  *
26  * Negative values are allowed.
27  */
28 class Box {
29 public:
30         int x1;
31         int x2;
32         int y1;
33         int y2;
34
35         /// Zero-initialise the member variables.
36         Box();
37         /// Initialise the member variables.
38         Box(int x1_, int x2_, int y1_, int y2_);
39
40         /**
41          * Returns true if the given co-ordinates are within
42          * the box. Check is exclusive (point on a border
43          * returns false).
44          */
45         bool contains(int x, int y) const;
46 };
47
48
49 std::ostream & operator<<(std::ostream &, Box const &);
50
51
52 } // namespace lyx
53
54 #endif // BOX_H