]> git.lyx.org Git - lyx.git/blob - src/Row.h
simplify GuiToc / TocWidget interaction. Much can still be simplified...
[lyx.git] / src / Row.h
1 // -*- C++ -*-
2 /**
3  * \file Row.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Matthias Ettrich
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  *
12  * Metrics for an on-screen text row.
13  */
14
15 #ifndef ROW_H
16 #define ROW_H
17
18 #include "support/types.h"
19
20 #include "Dimension.h"
21
22
23 namespace lyx {
24
25 /**
26  * An on-screen row of text. A paragraph is broken into a
27  * RowList for display. Each Row contains position pointers
28  * into the first and last character positions of that row.
29  */
30 class Row {
31 public:
32         ///
33         Row();
34         ///
35         Row(pos_type pos);
36         ///
37         bool changed() const { return changed_; }
38         ///
39         void setChanged(bool c) { changed_ = c; }
40         ///
41         void setCrc(size_type crc) const;
42         ///
43         void setSelection(pos_type sel_beg, pos_type sel_end);
44
45         ///
46         void pos(pos_type p);
47         ///
48         pos_type pos() const { return pos_; }
49         ///
50         void endpos(pos_type p);
51         ///
52         pos_type endpos() const { return end_; }
53         ///
54         void setDimension(Dimension const & dim);
55         ///
56         Dimension const & dimension() const { return dim_; }
57         ///
58         int height() const { return dim_.height(); }
59         ///
60         int width() const { return dim_.wid; }
61         ///
62         int ascent() const { return dim_.asc; }
63         ///
64         int descent() const { return dim_.des; }
65
66         /// current debugging only
67         void dump(char const * = "") const;
68
69         /// width of a separator (i.e. space)
70         double separator;
71         /// width of hfills in the label
72         double label_hfill;
73         /// the x position of the row
74         double x;
75         ///
76         pos_type sel_beg;
77         ///
78         pos_type sel_end;
79 private:
80         /// has the Row appearance changed since last drawing?
81         mutable bool changed_;
82         /// CRC of row contents.
83         mutable size_type crc_;
84         /// first pos covered by this row
85         pos_type pos_;
86         /// one behind last pos covered by this row
87         pos_type end_;
88         /// Row dimension.
89         Dimension dim_;
90 };
91
92
93 } // namespace lyx
94
95 #endif