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

kdeui

  • kdeui
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 <kdelibs_export.h>
33 
34 class TQAccel;
35 class TQTimer;
36 class KSpell;
37 class KSpellConfig;
38 
42 class KDEUI_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 KDEUI_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 KDEUI_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
KDictSpellingHighlighter
Dictionary sensitive text highlighter.
Definition: ksyntaxhighlighter.h:95
KSpellConfig
A configuration class/dialog for KSpell.
Definition: ksconfig.h:88
KSpell
KDE Spellchecker
Definition: kspell.h:47
KSyntaxHighlighter
Syntax sensitive text highlighter.
Definition: ksyntaxhighlighter.h:43

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |