]> git.lyx.org Git - lyx.git/blob - src/RowPainter.h
FindAdv: Amend ec387b6d: Handle search for '{' and '}'
[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 "Row.h"
18
19 namespace lyx {
20
21 class PainterInfo;
22 class Paragraph;
23 class Text;
24 class TextMetrics;
25
26 /**
27  * A class used for painting an individual row of text.
28  * FIXME: get rid of that class.
29  */
30 class RowPainter {
31 public:
32         /// initialise and run painter
33         RowPainter(PainterInfo & pi, Text const & text,
34                    Row const & row, int x, int y);
35
36         /// paint various parts
37         /// FIXME: transfer to TextMetrics
38         void paintAppendix() const;
39         void paintDepthBar() const;
40         void paintChangeBar() const;
41         void paintTooLargeMarks(bool const left, bool const right) const;
42         void paintFirst() const;
43         void paintLast() const;
44         void paintText();
45         void paintOnlyInsets();
46         void paintSelection() const;
47
48 private:
49         void paintLanguageMarkings(Row::Element const & e) const;
50         void paintForeignMark(Row::Element const & e) const;
51         void paintNoSpellingMark(Row::Element const & e) const;
52         void paintStringAndSel(Row::Element const & e) const;
53         void paintTextDecoration(Row::Element const & e) const;
54         void paintMisspelledMark(Row::Element const & e) const;
55         void paintChange(Row::Element const & e) const;
56         void paintAppendixStart(int y) const;
57         void paintInset(Row::Element const & e) const;
58
59         /// return the label font for this row (end label when \c end is true)
60         FontInfo labelFont(bool end) const;
61
62         ///
63         void paintLabel() const;
64         ///
65         void paintTopLevelLabel() const;
66
67
68         /// contains painting related information.
69         PainterInfo & pi_;
70
71         /// Text for the row
72         Text const & text_;
73         TextMetrics const & tm_;
74
75         /// The row to paint
76         Row const & row_;
77
78         /// Row's paragraph
79         Paragraph const & par_;
80
81         // Looks ugly - is
82         double const xo_;
83         int const yo_;    // current baseline
84         double x_;
85 };
86
87 } // namespace lyx
88
89 #endif // ROWPAINTER_H