]> git.lyx.org Git - lyx.git/blob - src/RowPainter.h
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / RowPainter.h
1 // -*- C++ -*-
2 /**
3  * \file RowPainter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author various
8  * \author John Levon
9  * \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef ROWPAINTER_H
15 #define ROWPAINTER_H
16
17 #include "Changes.h"
18 #include "Row.h"
19
20 #include "support/types.h"
21
22 namespace lyx {
23
24 class BufferView;
25 class Font;
26 class FontInfo;
27 class Inset;
28 class Language;
29 class PainterInfo;
30 class Paragraph;
31 class ParagraphList;
32 class ParagraphMetrics;
33 class Text;
34 class TextMetrics;
35
36 namespace frontend { class Painter; }
37
38 /**
39  * A class used for painting an individual row of text.
40  * FIXME: get rid of that class.
41  */
42 class RowPainter {
43 public:
44         /// initialise and run painter
45         RowPainter(PainterInfo & pi, Text const & text,
46                    Row const & row, int x, int y);
47
48         /// paint various parts
49         /// FIXME: transfer to TextMetrics
50         void paintAppendix() const;
51         void paintDepthBar() const;
52         void paintChangeBar() const;
53         void paintTooLargeMarks(bool const left, bool const right) const;
54         void paintFirst() const;
55         void paintLast() const;
56         void paintText();
57         void paintOnlyInsets();
58         void paintSelection() const;
59
60 private:
61         void paintForeignMark(Row::Element const & e) const;
62         void paintStringAndSel(Row::Element const & e) const;
63         void paintMisspelledMark(Row::Element const & e) const;
64         void paintChange(Row::Element const & e) const;
65         void paintAppendixStart(int y) const;
66         void paintInset(Row::Element const & e) const;
67
68         /// return the label font for this row
69         FontInfo labelFont() const;
70
71         ///
72         void paintLabel() const;
73         ///
74         void paintTopLevelLabel() const;
75
76
77         /// contains painting related information.
78         PainterInfo & pi_;
79
80         /// Text for the row
81         Text const & text_;
82         TextMetrics const & text_metrics_;
83         ParagraphList const & pars_;
84
85         /// The row to paint
86         Row const & row_;
87
88         /// Row's paragraph
89         Paragraph const & par_;
90         ParagraphMetrics const & pm_;
91
92         /// row changed? (change tracking)
93         Change const change_;
94
95         // Looks ugly - is
96         double const xo_;
97         int const yo_;    // current baseline
98         double x_;
99         int width_;
100 };
101
102 } // namespace lyx
103
104 #endif // ROWPAINTER_H