comparison libgui/languages/build_ts/octave-qsci/Qsci/qscistyle.h @ 31537:5ceb4bfcdb0f stable

add tools and files for updating the gui's language files for translation * libgui/languages/build_ts/README.md: readme for updating language files * libgui/languages/build_ts/octave-qsci: QScintilla source files for languages without translation provided by QScintilla * libgui/languages/build_ts/octave-qt: Qt source files for languages without translation provided by Qt
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 24 Nov 2022 06:48:25 +0100
parents
children dd5ece3664ed
comparison
equal deleted inserted replaced
31535:4b80982e0af8 31537:5ceb4bfcdb0f
1 // This module defines interface to the QsciStyle class.
2 //
3 // Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
4 //
5 // This file is part of QScintilla.
6 //
7 // This file may be used under the terms of the GNU General Public License
8 // version 3.0 as published by the Free Software Foundation and appearing in
9 // the file LICENSE included in the packaging of this file. Please review the
10 // following information to ensure the GNU General Public License version 3.0
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 //
13 // If you do not wish to use this file under the terms of the GPL version 3.0
14 // then you may purchase a commercial license. For more information contact
15 // info@riverbankcomputing.com.
16 //
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20
21 #ifndef QSCISTYLE_H
22 #define QSCISTYLE_H
23
24 #include <qcolor.h>
25 #include <qfont.h>
26 #include <qstring.h>
27
28 #include <Qsci/qsciglobal.h>
29
30
31 class QsciScintillaBase;
32
33
34 //! \brief The QsciStyle class encapsulates all the attributes of a style.
35 //!
36 //! Each character of a document has an associated style which determines how
37 //! the character is displayed, e.g. its font and color. A style is identified
38 //! by a number. Lexers define styles for each of the language's features so
39 //! that they are displayed differently. Some style numbers have hard-coded
40 //! meanings, e.g. the style used for call tips.
41 class QSCINTILLA_EXPORT QsciStyle
42 {
43 public:
44 //! This enum defines the different ways the displayed case of the text can
45 //! be changed.
46 enum TextCase {
47 //! The text is displayed as its original case.
48 OriginalCase = 0,
49
50 //! The text is displayed as upper case.
51 UpperCase = 1,
52
53 //! The text is displayed as lower case.
54 LowerCase = 2
55 };
56
57 //! Constructs a QsciStyle instance for style number \a style. If \a style
58 //! is negative then a new style number is automatically allocated if
59 //! possible. If it is not possible then style() will return a negative
60 //! value.
61 //!
62 //! \sa style()
63 QsciStyle(int style = -1);
64
65 //! Constructs a QsciStyle instance for style number \a style. If \a style
66 //! is negative then a new style number is automatically allocated if
67 //! possible. If it is not possible then style() will return a negative
68 //! value. The styles description, color, paper color, font and
69 //! end-of-line fill are set to \a description, \a color, \a paper, \a font
70 //! and \a eolFill respectively.
71 //!
72 //! \sa style()
73 QsciStyle(int style, const QString &description, const QColor &color,
74 const QColor &paper, const QFont &font, bool eolFill = false);
75
76 //! \internal Apply the style to a particular editor.
77 void apply(QsciScintillaBase *sci) const;
78
79 //! The style's number is set to \a style.
80 //!
81 //! \sa style()
82 void setStyle(int style) {style_nr = style;}
83
84 //! Returns the number of the style. This will be negative if the style is
85 //! invalid.
86 //!
87 //! \sa setStyle()
88 int style() const {return style_nr;}
89
90 //! The style's description is set to \a description.
91 //!
92 //! \sa description()
93 void setDescription(const QString &description) {style_description = description;}
94
95 //! Returns the style's description.
96 //!
97 //! \sa setDescription()
98 QString description() const {return style_description;}
99
100 //! The style's foreground color is set to \a color. The default is taken
101 //! from the application's default palette.
102 //!
103 //! \sa color()
104 void setColor(const QColor &color);
105
106 //! Returns the style's foreground color.
107 //!
108 //! \sa setColor()
109 QColor color() const {return style_color;}
110
111 //! The style's background color is set to \a paper. The default is taken
112 //! from the application's default palette.
113 //!
114 //! \sa paper()
115 void setPaper(const QColor &paper);
116
117 //! Returns the style's background color.
118 //!
119 //! \sa setPaper()
120 QColor paper() const {return style_paper;}
121
122 //! The style's font is set to \a font. The default is the application's
123 //! default font.
124 //!
125 //! \sa font()
126 void setFont(const QFont &font);
127
128 //! Returns the style's font.
129 //!
130 //! \sa setFont()
131 QFont font() const {return style_font;}
132
133 //! The style's end-of-line fill is set to \a fill. The default is false.
134 //!
135 //! \sa eolFill()
136 void setEolFill(bool fill);
137
138 //! Returns the style's end-of-line fill.
139 //!
140 //! \sa setEolFill()
141 bool eolFill() const {return style_eol_fill;}
142
143 //! The style's text case is set to \a text_case. The default is
144 //! OriginalCase.
145 //!
146 //! \sa textCase()
147 void setTextCase(TextCase text_case);
148
149 //! Returns the style's text case.
150 //!
151 //! \sa setTextCase()
152 TextCase textCase() const {return style_case;}
153
154 //! The style's visibility is set to \a visible. The default is true.
155 //!
156 //! \sa visible()
157 void setVisible(bool visible);
158
159 //! Returns the style's visibility.
160 //!
161 //! \sa setVisible()
162 bool visible() const {return style_visible;}
163
164 //! The style's changeability is set to \a changeable. The default is
165 //! true.
166 //!
167 //! \sa changeable()
168 void setChangeable(bool changeable);
169
170 //! Returns the style's changeability.
171 //!
172 //! \sa setChangeable()
173 bool changeable() const {return style_changeable;}
174
175 //! The style's sensitivity to mouse clicks is set to \a hotspot. The
176 //! default is false.
177 //!
178 //! \sa hotspot()
179 void setHotspot(bool hotspot);
180
181 //! Returns the style's sensitivity to mouse clicks.
182 //!
183 //! \sa setHotspot()
184 bool hotspot() const {return style_hotspot;}
185
186 //! Refresh the style settings.
187 void refresh();
188
189 private:
190 int style_nr;
191 QString style_description;
192 QColor style_color;
193 QColor style_paper;
194 QFont style_font;
195 bool style_eol_fill;
196 TextCase style_case;
197 bool style_visible;
198 bool style_changeable;
199 bool style_hotspot;
200
201 void init(int style);
202 };
203
204 #endif