4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Matthias Ettrich
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
12 * Metrics for an on-screen text row.
18 #include "support/types.h"
20 #include "Dimension.h"
28 * An on-screen row of text. A paragraph is broken into a
29 * RowList for display. Each Row contains position pointers
30 * into the first and last character positions of that row.
39 bool changed() const { return changed_; }
41 void setChanged(bool c) { changed_ = c; }
43 void setCrc(size_type crc) const;
44 /// Set the selection begin and end.
46 * This is const because we update the selection status only at draw()
49 void setSelection(pos_type sel_beg, pos_type sel_end) const;
51 bool selection() const;
52 /// Set the selection begin and end and whether the left and/or right
53 /// margins are selected.
54 void setSelectionAndMargins(DocIterator const & beg,
55 DocIterator const & end) const;
60 pos_type pos() const { return pos_; }
62 void endpos(pos_type p);
64 pos_type endpos() const { return end_; }
66 void setDimension(Dimension const & dim);
68 Dimension const & dimension() const { return dim_; }
70 int height() const { return dim_.height(); }
72 int width() const { return dim_.wid; }
74 int ascent() const { return dim_.asc; }
76 int descent() const { return dim_.des; }
78 /// current debugging only
79 void dump(char const * = "") const;
81 /// width of a separator (i.e. space)
83 /// width of hfills in the label
85 /// the x position of the row
88 mutable pos_type sel_beg;
90 mutable pos_type sel_end;
92 mutable bool left_margin_sel;
94 mutable bool right_margin_sel;
97 /// Decides whether the margin is selected.
103 bool isMarginSelected(bool left_margin, DocIterator const & beg,
104 DocIterator const & end) const;
106 /// has the Row appearance changed since last drawing?
107 mutable bool changed_;
108 /// CRC of row contents.
109 mutable size_type crc_;
110 /// first pos covered by this row
112 /// one behind last pos covered by this row