]> git.lyx.org Git - lyx.git/blob - src/mathed/dimension.h
split inset -> inset + updatableinset
[lyx.git] / src / mathed / dimension.h
1 // -*- C++ -*-
2
3 /**
4  *  \file dimension.h
5  *
6  *  This file is part of LyX, the document processor.
7  *  Licence details can be found in the file COPYING.
8  *
9  *  \author André Pönitz
10  *
11  *  Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef DIMENSION_H
15 #define DIMENSION_H
16
17
18 #include <iosfwd>
19
20 class LyXFont;
21
22 /// Simple wrapper around three ints
23 class Dimension {
24 public:
25         /// constructor
26         Dimension() : w(0), a(0), d(0) {}
27         /// initialize data
28         Dimension(int ww, int aa, int dd) : w(ww), a(aa), d(dd) {}
29
30         /// glue horizontally
31         void operator+=(Dimension const & dim);
32         /// set to empty box
33         void clear() { w = a = d = 0; }
34         /// set to empty box suitble for given font
35         void clear(LyXFont const & font);
36         /// get height
37         int height() const { return a + d; }
38         /// get ascent
39         int ascent() const { return a; }
40         /// get descent
41         int descent() const { return d; }
42         /// get width
43         int width() const { return w; }
44
45 public:
46         /// width
47         int w;
48         /// ascent
49         int a;
50         /// descent
51         int d;
52 };
53
54 std::ostream & operator<<(std::ostream & os, Dimension const & dim);
55
56 #endif