]> git.lyx.org Git - lyx.git/blob - src/rowpainter.h
Alfredo's second patch
[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  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #ifndef ROWPAINTER_H
14 #define ROWPAINTER_H
15
16 #include <config.h>
17
18 #include "RowList.h"
19 #include "LString.h"
20 #include "support/types.h"
21
22 class LyXText;
23 class BufferView;
24 class Paragraph;
25 class Painter;
26 class LyXFont;
27 class VSpace;
28
29 /**
30  * A class used for painting an individual row of text.
31  */
32 class RowPainter {
33 public:
34         /// initialise painter
35         RowPainter(BufferView const & bv, LyXText const & text, RowList::iterator rit);
36
37         /// paint the row.
38         void paint(int y_offset, int x_offset, int y);
39
40 private:
41         // paint various parts
42         void paintBackground();
43         void paintSelection();
44         void paintAppendix();
45         void paintDepthBar();
46         void paintChangeBar();
47         void paintFirst();
48         void paintLast();
49         void paintForeignMark(float const orig_x, LyXFont const & orig_font);
50         void paintHebrewComposeChar(lyx::pos_type & vpos);
51         void paintArabicComposeChar(lyx::pos_type & vpos);
52         void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
53         int paintPageBreak(string const & label, int y);
54         int paintAppendixStart(int y);
55         int paintLengthMarker(string const & prefix, VSpace const & vsp, int start);
56         void paintText();
57         void paintFromPos(lyx::pos_type & vpos);
58         void paintInset(lyx::pos_type const pos);
59
60         /// return left margin
61         int leftMargin() const;
62
63         /// return the font at the given pos
64         LyXFont const getFont(lyx::pos_type pos) const;
65
66         /// return the label font for this row
67         LyXFont const getLabelFont() const;
68
69         char const transformChar(char c, lyx::pos_type pos) const;
70
71         /// return pixel width for the given pos
72         int singleWidth(lyx::pos_type pos) const;
73         int singleWidth(lyx::pos_type pos, char c) const;
74
75         /// bufferview to paint on
76         BufferView const & bv_;
77
78         /// Painter to use
79         Painter & pain_;
80
81         /// LyXText for the row
82         LyXText const & text_;
83
84         /// The row to paint
85         RowList::iterator row_;
86
87         /// Row's paragraph
88         mutable ParagraphList::iterator  pit_;
89
90         // Looks ugly - is
91         int xo_;
92         int yo_;
93         float x_;
94         int y_;
95         int width_;
96         float separator_;
97         float hfill_;
98         float label_hfill_;
99 };
100
101 /// return the pixel height of a space marker before/after a par
102 int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp);
103
104 #endif // ROWPAINTER_H