]> git.lyx.org Git - lyx.git/blob - src/RowPainter.h
Account for old versions of Pygments
[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 Text;
33 class TextMetrics;
34
35 namespace frontend { class Painter; }
36
37 /**
38  * A class used for painting an individual row of text.
39  * FIXME: get rid of that class.
40  */
41 class RowPainter {
42 public:
43         /// initialise and run painter
44         RowPainter(PainterInfo & pi, Text const & text,
45                    Row const & row, int x, int y);
46
47         /// paint various parts
48         /// FIXME: transfer to TextMetrics
49         void paintAppendix() const;
50         void paintDepthBar() const;
51         void paintChangeBar() const;
52         void paintTooLargeMarks(bool const left, bool const right) const;
53         void paintFirst() const;
54         void paintLast() const;
55         void paintText();
56         void paintOnlyInsets();
57         void paintSelection() const;
58
59 private:
60         void paintForeignMark(Row::Element const & e) const;
61         void paintStringAndSel(Row::Element const & e) const;
62         void paintMisspelledMark(Row::Element const & e) const;
63         void paintChange(Row::Element const & e) const;
64         void paintAppendixStart(int y) const;
65         void paintInset(Row::Element const & e) const;
66
67         /// return the label font for this row
68         FontInfo labelFont() const;
69
70         ///
71         void paintLabel() const;
72         ///
73         void paintTopLevelLabel() const;
74
75
76         /// contains painting related information.
77         PainterInfo & pi_;
78
79         /// Text for the row
80         Text const & text_;
81         TextMetrics const & tm_;
82         ParagraphList const & pars_;
83
84         /// The row to paint
85         Row const & row_;
86
87         /// Row's paragraph
88         Paragraph const & par_;
89
90         /// row changed? (change tracking)
91         Change const change_;
92
93         // Looks ugly - is
94         double const xo_;
95         int const yo_;    // current baseline
96         double x_;
97 };
98
99 } // namespace lyx
100
101 #endif // ROWPAINTER_H