// -*- C++ -*-
-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright (C) 1995 Matthias Ettrich
+/**
+ * \file lyxrow.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- *======================================================*/
-
-#ifndef _LYXROW_H
-#define _LYXROW_H
+ * \author Matthias Ettrich
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ *
+ * Metrics for an on-screen text row.
+ */
-//#include "lyxparagraph.h"
+#ifndef LYXROW_H
+#define LYXROW_H
-class LyXParagraph;
+#include "support/types.h"
-///
-struct Row {
+/**
+ * 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();
+ ///
+ Row(lyx::pos_type pos);
+ ///
+ void pos(lyx::pos_type p);
+ ///
+ lyx::pos_type pos() const;
+ ///
+ void endpos(lyx::pos_type p);
///
- LyXParagraph *par;
+ lyx::pos_type endpos() const;
///
- int pos;
+ int height() const { return ascent_ + descent_; }
///
- unsigned short baseline;
+ void width(int w);
///
- /** what is missing to a full row can be negative.
- Needed for hfills, flushright, block etc. */
- int fill;
+ int width() const;
///
- unsigned short height;
+ void ascent(int b);
///
- unsigned short ascent_of_text;
-
+ int ascent() const;
///
- Row* next;
+ void descent(int b) { descent_ = b; }
///
- Row* previous;
+ int descent() const { return descent_; }
+ /// current debugging only
+ void dump(const char * = "") const;
+
+private:
+ /// first pos covered by this row
+ lyx::pos_type pos_;
+ /// one behind last pos covered by this row
+ lyx::pos_type end_;
+ ///
+ int ascent_;
+ ///
+ int descent_;
+ ///
+ int width_;
};
+
+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;
+};
+
+
#endif