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