From 736d068866d3ae06a3d228209d9fd4f984f1ca54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 9 Jul 2002 08:44:30 +0000 Subject: [PATCH] forgotten files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4560 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/dimension.C | 11 +++++++++++ src/mathed/dimension.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/mathed/dimension.C create mode 100644 src/mathed/dimension.h diff --git a/src/mathed/dimension.C b/src/mathed/dimension.C new file mode 100644 index 0000000000..a756c7bf4f --- /dev/null +++ b/src/mathed/dimension.C @@ -0,0 +1,11 @@ + +#include "dimension.h" + +void Dimension::operator+=(Dimension const & dim) +{ + if (a < dim.a) + a = dim.a; + if (d < dim.d) + d = dim.d; + w += dim.w; +} diff --git a/src/mathed/dimension.h b/src/mathed/dimension.h new file mode 100644 index 0000000000..a65893aef6 --- /dev/null +++ b/src/mathed/dimension.h @@ -0,0 +1,31 @@ +#ifndef DIMENSION_H +#define DIMENSION_H + +class Dimension { +public: + /// constructor + Dimension() : w(0), a(0), d(0) {} + /// initialize data + Dimension(int ww, int aa, int dd) : w(ww), a(aa), d(dd) {} + + /// glue horizontally + void operator+=(Dimension const & dim); + /// set to empty box + void clear() { w = a = d = 0; } + /// get height + int height() const { return a + d; } + /// get ascent + int ascent() const { return a; } + /// get width + int width() const { return w; } + +public: + /// width + int w; + /// ascent + int a; + /// descent + int d; +}; + +#endif