// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxrow.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Matthias Ettrich
+ * \author Lars Gullik Bjønnes
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
+ * Full author contact details are available in file CREDITS.
*
- * ====================================================== */
+ * Metrics for an on-screen text row.
+ */
#ifndef LYXROW_H
#define LYXROW_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
#include "support/types.h"
-class Paragraph;
-///
+namespace lyx {
+
+/**
+ * An on-screen row of text. A paragraph is broken into a
+ * RowList for display. Each Row contains position pointers
+ * into the first and last character positions of that row.
+ */
class Row {
public:
///
Row();
-
- ///
- void par(Paragraph * p);
- ///
- Paragraph * par();
- ///
- Paragraph * par() const;
- ///
- void pos(lyx::pos_type p);
- ///
- lyx::pos_type pos() const;
- ///
- void fill(int f);
- ///
- int fill() const;
///
- void height(unsigned short h);
+ Row(pos_type pos);
///
- unsigned short height() const;
+ void pos(pos_type p);
///
- void width(unsigned int w);
+ pos_type pos() const;
///
- unsigned int width() const;
+ void endpos(pos_type p);
///
- void ascent_of_text(unsigned short a);
+ pos_type endpos() const;
///
- unsigned short ascent_of_text() const;
+ int height() const { return ascent_ + descent_; }
///
- void baseline(unsigned int b);
+ void width(int w);
///
- unsigned int baseline() const;
+ int width() const;
///
- void next(Row * r);
+ void ascent(int b);
///
- Row * next() const;
+ int ascent() const;
///
- void previous(Row * r);
+ void descent(int b) { descent_ = b; }
///
- Row * previous() const;
+ int descent() const { return descent_; }
+ /// current debugging only
+ void dump(const char * = "") const;
+
private:
+ /// first pos covered by this row
+ pos_type pos_;
+ /// one behind last pos covered by this row
+ pos_type end_;
///
- Paragraph * par_;
- ///
- lyx::pos_type pos_;
- /** what is missing to a full row can be negative.
- Needed for hfills, flushright, block etc. */
- mutable int fill_;
- ///
- unsigned short height_;
- ///
- unsigned int width_;
- ///
- unsigned short ascent_of_text_;
- ///
- unsigned int baseline_;
+ int ascent_;
///
- Row * next_;
+ int descent_;
///
- Row * previous_;
+ int width_;
};
-inline
-Paragraph * Row::par()
-{
- return par_;
-}
-
-
-inline
-Paragraph * Row::par() const
-{
- return par_;
-}
-
+class RowMetrics {
+public:
+ RowMetrics();
+ /// width of a separator (i.e. space)
+ double separator;
+ /// width of hfills in the body
+ double hfill;
+ /// width of hfills in the label
+ double label_hfill;
+ /// the x position of the row
+ double x;
+};
-inline
-unsigned short Row::height() const
-{
- return height_;
-}
-inline
-Row * Row::next() const
-{
- return next_;
-}
+} // namespace lyx
#endif