• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
ksyntaxhighlighter.h
1 /*
2  ksyntaxhighlighter.cpp
3 
4  Copyright (c) 2003 Trolltech AS
5  Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
6 
7  This file is part of the KDE libraries
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License version 2 as published by the Free Software Foundation.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef KSYNTAXHIGHLIGHTER_H
25 #define KSYNTAXHIGHLIGHTER_H
26 
27 #include <tqtextedit.h>
28 #include <tqsyntaxhighlighter.h>
29 #include <tqcolor.h>
30 #include <tqstringlist.h>
31 
32 #include <tdelibs_export.h>
33 
34 class TQAccel;
35 class TQTimer;
36 class KSpell;
37 class KSpellConfig;
38 
42 class TDEUI_EXPORT KSyntaxHighlighter : public TQSyntaxHighlighter
43 {
44 public:
45  enum SyntaxMode {
46  PlainTextMode,
47  RichTextMode
48  };
49  KSyntaxHighlighter( TQTextEdit *textEdit,
50  bool colorQuoting = false,
51  const TQColor& QuoteColor0 = black,
52  const TQColor& QuoteColor1 = TQColor( 0x00, 0x80, 0x00 ),
53  const TQColor& QuoteColor2 = TQColor( 0x00, 0x80, 0x00 ),
54  const TQColor& QuoteColor3 = TQColor( 0x00, 0x80, 0x00 ),
55  SyntaxMode mode = PlainTextMode );
56  ~KSyntaxHighlighter();
57 
58  int highlightParagraph( const TQString& text, int endStateOfLastPara );
59 
60 private:
61  class KSyntaxHighlighterPrivate;
62  KSyntaxHighlighterPrivate *d;
63 };
64 
65 class TDEUI_EXPORT KSpellingHighlighter : public KSyntaxHighlighter
66 {
67 public:
68  KSpellingHighlighter( TQTextEdit *textEdit,
69  const TQColor& spellColor = red,
70  bool colorQuoting = false,
71  const TQColor& QuoteColor0 = black,
72  const TQColor& QuoteColor1 = TQColor( 0x00, 0x80, 0x00 ),
73  const TQColor& QuoteColor2 = TQColor( 0x00, 0x80, 0x00 ),
74  const TQColor& QuoteColor3 = TQColor( 0x00, 0x80, 0x00 ) );
75  ~KSpellingHighlighter();
76 
77  virtual int highlightParagraph( const TQString &text,
78  int endStateOfLastPara );
79  virtual bool isMisspelled( const TQString& word ) = 0;
80  bool intraWordEditing() const;
81  void setIntraWordEditing( bool editing );
82  static TQStringList personalWords();
83 
84 private:
85  void flushCurrentWord();
86 
87  class KSpellingHighlighterPrivate;
88  KSpellingHighlighterPrivate *d;
89 };
90 
94 class TDEUI_EXPORT KDictSpellingHighlighter : public TQObject, public KSpellingHighlighter
95 {
96 Q_OBJECT
97 
98 public:
99  KDictSpellingHighlighter( TQTextEdit *textEdit,
100  bool spellCheckingActive = true,
101  bool autoEnable = true,
102  const TQColor& spellColor = red,
103  bool colorQuoting = false,
104  const TQColor& QuoteColor0 = black,
105  const TQColor& QuoteColor1 = TQColor( 0x00, 0x80, 0x00 ),
106  const TQColor& QuoteColor2 = TQColor( 0x00, 0x70, 0x00 ),
107  const TQColor& QuoteColor3 = TQColor( 0x00, 0x60, 0x00 ),
108  KSpellConfig *spellConfig = 0 );
109  ~KDictSpellingHighlighter();
110 
111  virtual bool isMisspelled( const TQString &word );
112  static void dictionaryChanged();
113  void restartBackgroundSpellCheck();
114 
127  void setActive( bool active );
128 
136  bool isActive() const;
137 
149  void setAutomatic( bool automatic );
150 
158  bool automatic() const;
159 
160 signals:
161  void activeChanged(const TQString &);
162  void newSuggestions(const TQString& originalword, const TQStringList& suggestions,
163  unsigned int pos);
164 
165 protected:
166  TQString spellKey();
167  bool eventFilter(TQObject *o, TQEvent *e);
168 
169 protected slots:
170  void slotMisspelling( const TQString &originalWord, const TQStringList &suggestions, unsigned int pos );
171  void slotCorrected( const TQString &originalWord, const TQString &, unsigned int );
172  void slotRehighlight();
173  void slotDictionaryChanged();
174  void slotSpellReady( KSpell *spell );
175  void slotAutoDetection();
176  void slotLocalSpellConfigChanged();
177  void slotKSpellNotResponding();
178 
179 private:
180  class KDictSpellingHighlighterPrivate;
181  KDictSpellingHighlighterPrivate *d;
182 };
183 
184 #endif
KSyntaxHighlighter
Syntax sensitive text highlighter.
Definition: ksyntaxhighlighter.h:42
KSpellConfig
A configuration class/dialog for KSpell.
Definition: ksconfig.h:87
KSpell
KDE Spellchecker
Definition: tdespell.h:46
KDictSpellingHighlighter
Dictionary sensitive text highlighter.
Definition: ksyntaxhighlighter.h:94

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.