]> git.lyx.org Git - lyx.git/blob - src/mathed/dimension.h
small up/down tweaking
[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 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include <iosfwd>
22
23 class LyXFont;
24
25 /// Simple wrapper around three ints
26 class Dimension {
27 public:
28         /// constructor
29         Dimension() : w(0), a(0), d(0) {}
30         /// initialize data
31         Dimension(int ww, int aa, int dd) : w(ww), a(aa), d(dd) {}
32
33         /// glue horizontally
34         void operator+=(Dimension const & dim);
35         /// set to empty box
36         void clear() { w = a = d = 0; }
37         /// set to empty box suitble for given font
38         void clear(LyXFont const & font);
39         /// get height
40         int height() const { return a + d; }
41         /// get ascent
42         int ascent() const { return a; }
43         /// get descent
44         int descent() const { return d; }
45         /// get width
46         int width() const { return w; }
47
48 public:
49         /// width
50         int w;
51         /// ascent
52         int a;
53         /// descent
54         int d;
55 };
56
57 std::ostream & operator<<(std::ostream & os, Dimension const & dim);
58
59 #endif