4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
17 /// Simple wrapper around three ints
21 Dimension() = default;
23 Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
25 Dimension & operator=(Dimension const & dim) = default;
28 void operator+=(Dimension const & dim);
30 void clear() { wid = asc = des = 0; }
31 /// check whether box is empty
32 bool empty() const { return wid == 0 && asc == 0 && des == 0; }
34 int height() const { return asc + des; }
36 int ascent() const { return asc; }
38 int descent() const { return des; }
40 int width() const { return wid; }
42 /// add space for a frame
43 //void addFrame(int frame) const;
44 /// add space for bottom part of a frame
45 //void addFrameBottom(int frame) const;
48 /// these are intentionally public as things like
52 /// are used all over the place and "hiding" those behind
54 /// dim.ascent(dim.ascent() + 20);
56 /// makes the code neither faster nor clearer
66 bool operator==(Dimension const & a, Dimension const & b)
68 return a.wid == b.wid && a.asc == b.asc && a.des == b.des;
73 bool operator!=(Dimension const & a, Dimension const & b)