2002-09-11 08:26:02 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file dimension.h
|
|
|
|
|
*
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-07-09 08:44:30 +00:00
|
|
|
|
#ifndef DIMENSION_H
|
|
|
|
|
#define DIMENSION_H
|
|
|
|
|
|
2002-09-11 08:26:02 +00:00
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-07-16 18:22:45 +00:00
|
|
|
|
#include <iosfwd>
|
|
|
|
|
|
|
|
|
|
class LyXFont;
|
|
|
|
|
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/// Simple wrapper around three ints
|
2002-07-09 08:44:30 +00:00
|
|
|
|
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; }
|
2002-07-16 18:22:45 +00:00
|
|
|
|
/// set to empty box suitble for given font
|
|
|
|
|
void clear(LyXFont const & font);
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// get height
|
|
|
|
|
int height() const { return a + d; }
|
|
|
|
|
/// get ascent
|
|
|
|
|
int ascent() const { return a; }
|
2002-07-11 11:27:24 +00:00
|
|
|
|
/// get descent
|
|
|
|
|
int descent() const { return d; }
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// get width
|
|
|
|
|
int width() const { return w; }
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/// width
|
|
|
|
|
int w;
|
|
|
|
|
/// ascent
|
|
|
|
|
int a;
|
|
|
|
|
/// descent
|
|
|
|
|
int d;
|
|
|
|
|
};
|
|
|
|
|
|
2002-07-16 18:22:45 +00:00
|
|
|
|
std::ostream & operator<<(std::ostream & os, Dimension const & dim);
|
|
|
|
|
|
2002-07-09 08:44:30 +00:00
|
|
|
|
#endif
|