4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Stefan Schimanski
10 * Full author contact details are available in file CREDITS.
17 #include "ColorCode.h"
20 #include "support/strfwd.h"
21 #include "support/Changer.h"
29 namespace frontend { class Painter; }
35 /// Standard Sizes (mode styles)
36 /// note: These values are hard-coded in changeStyle
50 // This is the part common to MetricsInfo and PainterInfo
57 MetricsBase(BufferView * bv, FontInfo const & font, int textwidth);
63 /// current math style (display/text/script/..)
65 /// name of current font - mathed specific
67 /// This is the width available in pixels
70 /// Temporarily change a full font.
71 Changer changeFontSet(docstring const & font, bool cond = true);
72 Changer changeFontSet(char const * font, bool cond = true);
73 /// Temporarily change the font size and the math style.
74 Changer changeStyle(Styles style, bool cond = true);
75 // Temporarily change to the style suitable for use in fractions
76 Changer changeFrac(bool cond = true);
77 // Temporarily change the style to (script)script style
78 Changer changeScript(bool cond = true);
83 // This contains a MetricsBase and information that's only relevant during
84 // the first phase of the two-phase draw
91 MetricsInfo(BufferView * bv, FontInfo const & font, int textwidth, MacroContext const & mc);
95 /// The context to resolve macros
96 MacroContext const & macrocontext;
101 // This contains a MetricsBase and information that's only relevant during
102 // the second phase of the two-phase draw
107 PainterInfo(BufferView * bv, frontend::Painter & pain);
109 void draw(int x, int y, char_type c);
111 void draw(int x, int y, docstring const & str);
112 /// Determines the background color for the specified inset based on the
113 /// selection state, the background color inherited from the parent inset
114 /// and the inset's own background color.
115 /// \param sel whether to take the selection state into account
116 ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
118 /// Determines the text color based on the intended color, the
119 /// change tracking state and the selection state.
120 /// \param color what the color should be by default
121 Color textColor(Color const & color) const;
126 frontend::Painter & pain;
127 /// Whether the text at this point is right-to-left (for InsetNewline)
129 /// The change the parent is part of (change tracking)
131 /// Whether the parent is selected as a whole
133 /// Whether the spell checker is enabled for the parent
137 /// Current background color
138 ColorCode background_color;
141 class TextMetricsInfo {};