• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

ktextedit.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KTEXTEDIT_H
00021 #define KTEXTEDIT_H
00022 
00023 #include <kdeui_export.h>
00024 #include <sonnet/highlighter.h>
00025 #include <QtGui/QTextEdit>
00026 
00041 class KTextEditSpellInterface
00042 {
00043   public:
00044 
00048     virtual bool isSpellCheckingEnabled() const = 0;
00049 
00054     virtual void setSpellCheckingEnabled(bool enable) = 0;
00055 
00062     virtual bool shouldBlockBeSpellChecked(const QString& block) const = 0;
00063 
00064     virtual ~KTextEditSpellInterface() {}
00065 };
00066 
00086 class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses
00087 {
00088     Q_OBJECT
00089     Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
00090     Q_PROPERTY( bool checkSpellingEnabled READ checkSpellingEnabled WRITE setCheckSpellingEnabled )
00091     Q_PROPERTY( QString spellCheckingLanguage READ spellCheckingLanguage WRITE setSpellCheckingLanguage )
00092 
00093   public:
00098     explicit KTextEdit( const QString& text, QWidget *parent = 0 );
00099 
00104     explicit KTextEdit( QWidget *parent = 0 );
00105 
00109     ~KTextEdit();
00110 
00114     virtual void setReadOnly( bool readOnly );
00115 
00130     void setCheckSpellingEnabled( bool check );
00131 
00143     bool checkSpellingEnabled() const;
00144 
00153     void highlightWord( int length, int pos );
00154 
00168     void setSpellCheckingConfigFileName(const QString &fileName);
00169 
00184     virtual void createHighlighter();
00185 
00194     Sonnet::Highlighter* highlighter() const;
00195 
00209     void setHighlighter(Sonnet::Highlighter *_highLighter);
00210 
00215     QMenu *mousePopupMenu();
00216 
00221     void enableFindReplace( bool enabled);
00222 
00231     void setSpellInterface( KTextEditSpellInterface *spellInterface );
00232 
00239     const QString& spellCheckingLanguage() const;
00240 
00247     void setClickMessage(const QString &msg);
00248 
00253     QString clickMessage() const;
00254 
00255   Q_SIGNALS:
00261      void checkSpellingChanged( bool );
00262 
00267      void spellCheckStatus(const QString &);
00268 
00276      void languageChanged(const QString &language);
00277 
00291     void aboutToShowContextMenu(QMenu* menu);
00292 
00293   public Q_SLOTS:
00294 
00303     void setSpellCheckingLanguage(const QString &language);
00304 
00309     void checkSpelling();
00310 
00325     void showSpellConfigDialog(const QString &configFileName,
00326                                const QString &windowIcon = QString());
00327 
00332     void replace();
00333 
00334   protected Q_SLOTS:
00338     void slotDoReplace();
00339     void slotReplaceNext();
00340     void slotDoFind();
00341     void slotFind();
00342     void slotFindNext();
00343     void slotReplace();
00347     void slotSpeakText();
00348 
00349   protected:
00353     virtual bool event(QEvent*);
00354 
00358     virtual void paintEvent(QPaintEvent *);
00359     virtual void focusOutEvent(QFocusEvent *);
00360 
00364     virtual void keyPressEvent( QKeyEvent* );
00365 
00370     virtual void focusInEvent( QFocusEvent* );
00371 
00376     virtual void wheelEvent( QWheelEvent* );
00377 
00382     virtual void deleteWordBack();
00383 
00388     virtual void deleteWordForward();
00389 
00394     virtual void contextMenuEvent( QContextMenuEvent* );
00395 
00396     // TODO: KDE5: get rid of these as soon as BIC changes are allowed, they
00397     //             should be folded back into the normal public version, which
00398     //             should be made virtual.
00399     //             These methods just provide a way for derived classes to call
00400     //             the base class version of the normal methods.
00401 
00407     void setCheckSpellingEnabledInternal(bool check);
00408 
00414     bool checkSpellingEnabledInternal() const;
00415 
00416   private:
00417     class Private;
00418     Private *const d;
00419 
00420     Q_PRIVATE_SLOT( d, void spellCheckerMisspelling( const QString&, int ) )
00421     Q_PRIVATE_SLOT( d, void spellCheckerCorrected(const QString&, int,const QString&) )
00422     Q_PRIVATE_SLOT( d, void spellCheckerCanceled())
00423     Q_PRIVATE_SLOT( d, void spellCheckerAutoCorrect(const QString&,const QString&) )
00424     Q_PRIVATE_SLOT( d, void spellCheckerFinished() )
00425     Q_PRIVATE_SLOT( d, void undoableClear() )
00426     Q_PRIVATE_SLOT( d, void toggleAutoSpellCheck() )
00427     Q_PRIVATE_SLOT( d, void slotAllowTab() )
00428     Q_PRIVATE_SLOT( d, void menuActivated( QAction* ) )
00429     Q_PRIVATE_SLOT( d, void slotFindHighlight(const QString&, int, int))
00430     Q_PRIVATE_SLOT( d, void slotReplaceText(const QString &, int, int, int))
00431 };
00432 
00433 #endif // KTEXTEDIT_H

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal