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() : wid(0), asc(0), des(0) {}
23 Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
25 Dimension & operator=(Dimension const & dim) {
32 void operator+=(Dimension const & dim);
34 void clear() { wid = asc = des = 0; }
35 /// check if box is empty
36 bool empty() const { return wid == 0 && asc == 0 && wid == 0; }
38 int height() const { return asc + des; }
40 int ascent() const { return asc; }
42 int descent() const { return des; }
44 int width() const { return wid; }
46 /// add space for a frame
47 //void addFrame(int frame) const;
48 /// add space for bottom part of a frame
49 //void addFrameBottom(int frame) const;
52 /// these are intentionally public as things like
56 /// are used all over the place and "hiding" those behind
58 /// dim.ascent(dim.ascent() + 20);
60 /// makes the code neither faster nor clearer
70 bool operator==(Dimension const & a, Dimension const & b)
72 return a.wid == b.wid && a.asc == b.asc && a.des == b.des ;
77 bool operator!=(Dimension const & a, Dimension const & b)
79 return a.wid != b.wid || a.asc != b.asc || a.des != b.des ;