]> git.lyx.org Git - lyx.git/blob - src/Row.h
Added Liviu Andronic, and modified generate_contributions.py to match what was in...
[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         /// Set the selection begin and end.
43         /**
44           * This is const because we update the selection status only at draw()
45           * time.
46           */
47         void setSelection(pos_type sel_beg, pos_type sel_end) const;
48
49         ///
50         void pos(pos_type p);
51         ///
52         pos_type pos() const { return pos_; }
53         ///
54         void endpos(pos_type p);
55         ///
56         pos_type endpos() const { return end_; }
57         ///
58         void setDimension(Dimension const & dim);
59         ///
60         Dimension const & dimension() const { return dim_; }
61         ///
62         int height() const { return dim_.height(); }
63         ///
64         int width() const { return dim_.wid; }
65         ///
66         int ascent() const { return dim_.asc; }
67         ///
68         int descent() const { return dim_.des; }
69
70         /// current debugging only
71         void dump(char const * = "") const;
72
73         /// width of a separator (i.e. space)
74         double separator;
75         /// width of hfills in the label
76         double label_hfill;
77         /// the x position of the row
78         double x;
79         ///
80         mutable pos_type sel_beg;
81         ///
82         mutable pos_type sel_end;
83 private:
84         /// has the Row appearance changed since last drawing?
85         mutable bool changed_;
86         /// CRC of row contents.
87         mutable size_type crc_;
88         /// first pos covered by this row
89         pos_type pos_;
90         /// one behind last pos covered by this row
91         pos_type end_;
92         /// Row dimension.
93         Dimension dim_;
94 };
95
96
97 } // namespace lyx
98
99 #endif