2002-09-11 08:26:02 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-12-01 22:59:25 +00:00
|
|
|
|
/**
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \file dimension.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-09-11 08:26:02 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
2002-09-11 08:26:02 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-11 08:26:02 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2002-07-09 08:44:30 +00:00
|
|
|
|
#ifndef DIMENSION_H
|
|
|
|
|
#define DIMENSION_H
|
|
|
|
|
|
2002-09-11 08:26:02 +00:00
|
|
|
|
|
2002-07-16 18:22:45 +00:00
|
|
|
|
class LyXFont;
|
|
|
|
|
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/// Simple wrapper around three ints
|
2003-05-19 17:03:12 +00:00
|
|
|
|
struct Dimension {
|
2002-07-09 08:44:30 +00:00
|
|
|
|
public:
|
|
|
|
|
/// constructor
|
2003-05-27 13:55:03 +00:00
|
|
|
|
Dimension() : wid(0), asc(0), des(0) {}
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// initialize data
|
2003-05-27 13:55:03 +00:00
|
|
|
|
Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
|
2002-07-09 08:44:30 +00:00
|
|
|
|
|
|
|
|
|
/// glue horizontally
|
|
|
|
|
void operator+=(Dimension const & dim);
|
|
|
|
|
/// set to empty box
|
2003-05-27 13:55:03 +00:00
|
|
|
|
void clear() { wid = asc = des = 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
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int height() const { return asc + des; }
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// get ascent
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int ascent() const { return asc; }
|
2002-07-11 11:27:24 +00:00
|
|
|
|
/// get descent
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int descent() const { return des; }
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// get width
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int width() const { return wid; }
|
2002-07-09 08:44:30 +00:00
|
|
|
|
|
2003-05-28 13:22:36 +00:00
|
|
|
|
/// add space for a frame
|
|
|
|
|
//void addFrame(int frame) const;
|
|
|
|
|
/// add space for bottom part of a frame
|
|
|
|
|
//void addFrameBottom(int frame) const;
|
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
public:
|
2003-05-19 17:03:12 +00:00
|
|
|
|
/// these are intentionally public as things like
|
|
|
|
|
///
|
2003-09-09 18:27:24 +00:00
|
|
|
|
/// dim.asc += 20;
|
2003-05-19 17:03:12 +00:00
|
|
|
|
///
|
|
|
|
|
/// are used all over the place and "hiding" those behind
|
|
|
|
|
///
|
|
|
|
|
/// dim.ascent(dim.ascent() + 20);
|
|
|
|
|
///
|
|
|
|
|
/// makes the code neither faster nor clearer
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// width
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int wid;
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// ascent
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int asc;
|
2002-07-09 08:44:30 +00:00
|
|
|
|
/// descent
|
2003-05-27 13:55:03 +00:00
|
|
|
|
int des;
|
2002-07-09 08:44:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|