]> git.lyx.org Git - lyx.git/blob - src/RowPainter.h
Avoid full metrics computation with Update:FitCursor
[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         void paintBookmark(int num) const;
48
49 private:
50         void paintLanguageMarkings(Row::Element const & e) const;
51         void paintForeignMark(Row::Element const & e) const;
52         void paintNoSpellingMark(Row::Element const & e) const;
53         void paintStringAndSel(Row::Element const & e) const;
54         void paintTextDecoration(Row::Element const & e) const;
55         void paintMisspelledMark(Row::Element const & e) const;
56         void paintChange(Row::Element const & e) const;
57         void paintAppendixStart(int y) const;
58         void paintInset(Row::Element const & e) const;
59
60         /// return the label font for this row (end label when \c end is true)
61         FontInfo labelFont(bool end) const;
62
63         ///
64         void paintLabel() const;
65         ///
66         void paintTopLevelLabel() const;
67
68
69         /// contains painting related information.
70         PainterInfo & pi_;
71
72         /// Text for the row
73         Text const & text_;
74         TextMetrics const & tm_;
75
76         /// The row to paint
77         Row const & row_;
78
79         /// Row's paragraph
80         Paragraph const & par_;
81
82         // Looks ugly - is
83         double const xo_;
84         int const yo_;    // current baseline
85         double x_;
86 };
87
88 } // namespace lyx
89
90 #endif // ROWPAINTER_H