]> git.lyx.org Git - lyx.git/blob - src/Row.h
Transfer current_font and real_current_font from Text to Cursor.
[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);
42         ///
43         void pos(pos_type p);
44         ///
45         pos_type pos() const { return pos_; }
46         ///
47         void endpos(pos_type p);
48         ///
49         pos_type endpos() const { return end_; }
50         ///
51         void setDimension(Dimension const & dim);
52         ///
53         Dimension const & dimension() const { return dim_; }
54         ///
55         int height() const { return dim_.height(); }
56         ///
57         int width() const { return dim_.wid; }
58         ///
59         int ascent() const { return dim_.asc; }
60         ///
61         int descent() const { return dim_.des; }
62
63         /// current debugging only
64         void dump(const char * = "") const;
65
66         /// width of a separator (i.e. space)
67         double separator;
68         /// width of hfills in the body
69         double hfill;
70         /// width of hfills in the label
71         double label_hfill;
72         /// the x position of the row
73         double x;
74
75 private:
76         /// has the Row appearance changed since last drawing?
77         bool changed_;
78         /// CRC of row contents.
79         size_type crc_;
80         /// first pos covered by this row
81         pos_type pos_;
82         /// one behind last pos covered by this row
83         pos_type end_;
84         /// Row dimension.
85         Dimension dim_;
86 };
87
88
89 } // namespace lyx
90
91 #endif