X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fdimension.h;h=5dd32d3bebd2583314cfeec6e55158fc0b2f345a;hb=b9aa557b359463dfb0a2132b665570c8d1e5d605;hp=2b732584ff9988dcb627213ba8827b8c838e20db;hpb=a8e8e755fc32233e91bf787d5032fd81147d0909;p=lyx.git diff --git a/src/dimension.h b/src/dimension.h index 2b732584ff..5dd32d3beb 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -1,36 +1,37 @@ // -*- C++ -*- - /** - * \file dimension.h - * - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. + * \file dimension.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * - * Full author contact details are available in file CREDITS. + * Full author contact details are available in file CREDITS. */ #ifndef DIMENSION_H #define DIMENSION_H - -class LyXFont; +namespace lyx { /// Simple wrapper around three ints -struct Dimension { +class Dimension { public: /// constructor Dimension() : wid(0), asc(0), des(0) {} /// initialize data Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {} + Dimension & operator=(Dimension const & dim) { + wid = dim.wid; + asc = dim.asc; + des = dim.des; + return *this; + } /// glue horizontally void operator+=(Dimension const & dim); /// set to empty box void clear() { wid = asc = des = 0; } - /// set to empty box suitble for given font - void clear(LyXFont const & font); /// get height int height() const { return asc + des; } /// get ascent @@ -40,10 +41,15 @@ public: /// get width int width() const { return wid; } + /// add space for a frame + //void addFrame(int frame) const; + /// add space for bottom part of a frame + //void addFrameBottom(int frame) const; + public: /// these are intentionally public as things like /// - /// dim.asc += 20; + /// dim.asc += 20; /// /// are used all over the place and "hiding" those behind /// @@ -58,4 +64,20 @@ public: int des; }; +inline +bool operator==(Dimension const & a, Dimension const & b) +{ + return a.wid == b.wid && a.asc == b.asc && a.des == b.des ; +} + + +inline +bool operator!=(Dimension const & a, Dimension const & b) +{ + return a.wid != b.wid || a.asc != b.asc || a.des != b.des ; +} + + +} // namespace lyx + #endif