comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexerproperties.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 defines the interface to the QsciLexerProperties 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 QSCILEXERPROPERTIES_H
22 #define QSCILEXERPROPERTIES_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerProperties class encapsulates the Scintilla
31 //! Properties lexer.
32 class QSCINTILLA_EXPORT QsciLexerProperties : public QsciLexer
33 {
34 Q_OBJECT
35
36 public:
37 //! This enum defines the meanings of the different styles used by the
38 //! Properties lexer.
39 enum {
40 //! The default.
41 Default = 0,
42
43 //! A comment.
44 Comment = 1,
45
46 //! A section.
47 Section = 2,
48
49 //! An assignment operator.
50 Assignment = 3,
51
52 //! A default value.
53 DefaultValue = 4,
54
55 //! A key.
56 Key = 5
57 };
58
59 //! Construct a QsciLexerProperties with parent \a parent. \a parent is
60 //! typically the QsciScintilla instance.
61 QsciLexerProperties(QObject *parent = 0);
62
63 //! Destroys the QsciLexerProperties instance.
64 virtual ~QsciLexerProperties();
65
66 //! Returns the name of the language.
67 const char *language() const;
68
69 //! Returns the name of the lexer. Some lexers support a number of
70 //! languages.
71 const char *lexer() const;
72
73 //! Returns the string of characters that comprise a word.
74 const char *wordCharacters() const;
75
76 //! Returns the foreground colour of the text for style number \a style.
77 //!
78 //! \sa defaultPaper()
79 QColor defaultColor(int style) const;
80
81 //! Returns the end-of-line fill for style number \a style.
82 bool defaultEolFill(int style) const;
83
84 //! Returns the font for style number \a style.
85 QFont defaultFont(int style) const;
86
87 //! Returns the background colour of the text for style number \a style.
88 //!
89 //! \sa defaultColor()
90 QColor defaultPaper(int style) const;
91
92 //! Returns the descriptive name for style number \a style. If the style
93 //! is invalid for this language then an empty QString is returned. This
94 //! is intended to be used in user preference dialogs.
95 QString description(int style) const;
96
97 //! Causes all properties to be refreshed by emitting the
98 //! propertyChanged() signal as required.
99 void refreshProperties();
100
101 //! Returns true if trailing blank lines are included in a fold block.
102 //!
103 //! \sa setFoldCompact()
104 bool foldCompact() const {return fold_compact;}
105
106 //! If \a enable is true then initial spaces in a line are allowed. The
107 //! default is true.
108 //!
109 //! \sa initialSpaces()
110 void setInitialSpaces(bool enable);
111
112 //! Returns true if initial spaces in a line are allowed.
113 //!
114 //! \sa setInitialSpaces()
115 bool initialSpaces() const {return initial_spaces;}
116
117 public slots:
118 //! If \a fold is true then trailing blank lines are included in a fold
119 //! block. The default is true.
120 //!
121 //! \sa foldCompact()
122 virtual void setFoldCompact(bool fold);
123
124 protected:
125 //! The lexer's properties are read from the settings \a qs. \a prefix
126 //! (which has a trailing '/') should be used as a prefix to the key of
127 //! each setting. true is returned if there is no error.
128 //!
129 //! \sa writeProperties()
130 bool readProperties(QSettings &qs,const QString &prefix);
131
132 //! The lexer's properties are written to the settings \a qs.
133 //! \a prefix (which has a trailing '/') should be used as a prefix to
134 //! the key of each setting. true is returned if there is no error.
135 //!
136 //! \sa readProperties()
137 bool writeProperties(QSettings &qs,const QString &prefix) const;
138
139 private:
140 void setCompactProp();
141 void setInitialSpacesProp();
142
143 bool fold_compact;
144 bool initial_spaces;
145
146 QsciLexerProperties(const QsciLexerProperties &);
147 QsciLexerProperties &operator=(const QsciLexerProperties &);
148 };
149
150 #endif