kdeui Library API Documentation

keditcl.h

00001 /* This file is part of the KDE libraries
00002 
00003    Copyright (C) 1996 Bernd Johannes Wuebben <wuebben@math.cornell.edu>
00004    Copyright (C) 2000 Waldo Bastian <bastian@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef __KEDITCL_H__
00022 #define __KEDITCL_H__
00023 
00024 #include <qmultilineedit.h>
00025 #include <qstring.h>
00026 #include <kdialogbase.h>
00027 
00028 class QDropEvent;
00029 class QPushButton;
00030 class QCheckBox;
00031 class QRadioButton;
00032 class QTextStream;
00033 class KHistoryCombo;
00034 class KIntNumInput;
00035 class QVButtonGroup;
00036 
00037 class KEdGotoLine : public KDialogBase
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042     KEdGotoLine( QWidget *parent=0, const char *name=0, bool modal=true );
00043     int getLineNumber();
00044 
00045 public slots:
00046     void selected( int );
00047 
00048 private:
00049     KIntNumInput *lineNum;
00050 
00051 protected:
00052     virtual void virtual_hook( int id, void* data );
00053 private:
00054     class KEdGotoLinePrivate;
00055     KEdGotoLinePrivate *d;
00056 };
00057 
00059 class KEdFind : public KDialogBase
00060 {
00061     Q_OBJECT
00062     Q_PROPERTY( QString text READ getText WRITE setText )
00063     Q_PROPERTY( bool caseSensitivity READ case_sensitive WRITE setCaseSensitive )
00064     Q_PROPERTY( bool direction READ get_direction WRITE setDirection )
00065 public:
00066 
00067     KEdFind( QWidget *parent = 0, const char *name=0, bool modal=true);
00068     ~KEdFind();
00069 
00070     QString getText() const;
00071     void setText(QString string);
00072     void setCaseSensitive( bool b );
00073     bool case_sensitive() const;
00074     void setDirection( bool b );
00075     bool get_direction() const;
00076 
00081     KHistoryCombo *searchCombo() const;
00082 
00083 protected slots:
00084     void slotCancel( void );
00085     void slotUser1( void );
00086     void textSearchChanged ( const QString & );
00087 
00088 protected:
00089   QVButtonGroup* group;
00090 
00091 private:
00092     QCheckBox *sensitive;
00093     QCheckBox *direction;
00094 
00095     virtual void done(int i ) { KDialogBase::done(i); }
00096 
00097 signals:
00098 
00099     void search();
00100     void done();
00101 protected:
00102     virtual void virtual_hook( int id, void* data );
00103 private:
00104     class KEdFindPrivate;
00105     KEdFindPrivate *d;
00106 };
00107 
00109 class KEdReplace : public KDialogBase
00110 {
00111     Q_OBJECT
00112 
00113 public:
00114 
00115     KEdReplace ( QWidget *parent = 0, const char *name=0, bool modal=true );
00116     ~KEdReplace();
00117 
00118     QString     getText();
00119     QString     getReplaceText();
00120     void        setText(QString);
00121 
00126     KHistoryCombo *searchCombo() const;
00127 
00132     KHistoryCombo *replaceCombo() const;
00133 
00134     bool        case_sensitive();
00135     bool        get_direction();
00136 
00137 protected slots:
00138     void slotCancel( void );
00139     void slotClose( void );
00140     void slotUser1( void );
00141     void slotUser2( void );
00142     void slotUser3( void );
00143     void textSearchChanged ( const QString & );
00144 
00145 private:
00146     QCheckBox   *sensitive;
00147     QCheckBox   *direction;
00148 
00149         virtual void done(int i ) { KDialogBase::done(i); }
00150 
00151 signals:
00152     void replace();
00153     void find();
00154     void replaceAll();
00155     void done();
00156 protected:
00157   virtual void virtual_hook( int id, void* data );
00158 private:
00159     class KEdReplacePrivate;
00160     KEdReplacePrivate *d;
00161 };
00162 
00163 
00171 class KEdit : public QMultiLineEdit
00172 {
00173     Q_OBJECT
00174 
00175 public:
00179     KEdit (QWidget *_parent=NULL, const char *name=NULL);
00180 
00181     ~KEdit();
00182 
00187     enum { NONE,
00188            FORWARD,
00189            BACKWARD };
00193     void insertText(QTextStream *);
00194 
00201     void saveText(QTextStream *, bool softWrap);
00202     void saveText(QTextStream *); // KDE 4.0: remove
00203 
00208     void        selectFont();
00209 
00213     void        search();
00214 
00223     bool        repeatSearch();
00224 
00228     void        replace();
00229 
00233     void        doGotoLine();
00234 
00238     void        cleanWhiteSpace();
00239 
00245     void        installRBPopup( QPopupMenu* );
00246 
00252     int         currentLine();
00253 
00263     int         currentColumn();
00264 
00265 
00269     void spellcheck_start();
00270 
00274     void spellcheck_stop();
00275 
00282     void setOverwriteEnabled(bool b);
00283 
00284 
00285 signals:
00292     void        gotUrlDrop(QDropEvent* e);
00293 
00299     void        CursorPositionChanged();
00300 
00310     void        toggle_overwrite_signal();
00311 
00312 private slots:
00316     void corrected (const QString &originalword, const QString &newword, unsigned int pos);
00320     void misspelling (const QString &word, const QStringList &, unsigned int pos);
00321 
00326     void search_slot();
00327 
00331     void searchdone_slot();
00332 
00336     void replace_slot();
00337 
00341     void replace_all_slot();
00342 
00346     void replace_search_slot();
00347 
00351     void replacedone_slot();
00352 
00356     void slotCursorPositionChanged();
00357 
00358 protected:
00359     void computePosition();
00360     int         doSearch(QString s_pattern, bool case_sensitive,
00361                          bool regex, bool forward,int line, int col);
00362 
00363     int         doReplace(QString s_pattern, bool case_sensitive,
00364                           bool regex, bool forward,int line, int col,bool replace);
00365 
00369     void        posToRowCol(unsigned int pos, unsigned int &line, unsigned int &col);
00370 
00374     virtual void create( WId = 0, bool initializeWindow = true,
00375                          bool destroyOldWindow = true );
00376 
00377 
00378 protected:
00379 
00380     void        keyPressEvent    ( QKeyEvent *  );
00381 
00382     // DnD inteface
00383     void        dragMoveEvent(QDragMoveEvent* e);
00384     void        dragEnterEvent(QDragEnterEvent* e);
00385     void        dropEvent(QDropEvent* e);
00386     void        contentsDragMoveEvent(QDragMoveEvent* e);
00387     void        contentsDragEnterEvent(QDragEnterEvent* e);
00388     void        contentsDropEvent(QDropEvent* e);
00389 
00390 private:
00391     QTimer* repaintTimer;
00392 
00393     QString     killbufferstring;
00394     QWidget     *parent;
00395     KEdFind     *srchdialog;
00396     KEdReplace  *replace_dialog;
00397     KEdGotoLine *gotodialog;
00398 
00399     QString     pattern;
00400 
00401     bool        can_replace;
00402     bool        killing;
00403     bool        killtrue;
00404     bool        lastwasanewline;
00405     bool        saved_readonlystate;
00406     int         last_search;
00407     int         last_replace;
00408     int         replace_all_line;
00409     int         replace_all_col;
00410 
00411     int         line_pos, col_pos;
00412     bool        fill_column_is_set;
00413     bool        word_wrap_is_set;
00414     int         fill_column_value;
00415 
00416 protected:
00417     virtual void virtual_hook( int id, void* data );
00418 private:
00419     class KEditPrivate;
00420     KEditPrivate *d;
00421 };
00422 
00423 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:56:42 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001