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