keditcl.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 *);
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
00383
00384 void dragMoveEvent(QDragMoveEvent* e);
00385 void dragEnterEvent(QDragEnterEvent* e);
00386 void dropEvent(QDropEvent* e);
00387
00388 private:
00389 QTimer* repaintTimer;
00390
00391 QString killbufferstring;
00392 QWidget *parent;
00393 KEdFind *srchdialog;
00394 KEdReplace *replace_dialog;
00395 KEdGotoLine *gotodialog;
00396
00397 QString pattern;
00398
00399 bool can_replace;
00400 bool killing;
00401 bool killtrue;
00402 bool lastwasanewline;
00403 bool saved_readonlystate;
00404 int last_search;
00405 int last_replace;
00406 int replace_all_line;
00407 int replace_all_col;
00408
00409 int line_pos, col_pos;
00410 bool fill_column_is_set;
00411 bool word_wrap_is_set;
00412 int fill_column_value;
00413
00414 protected:
00415 virtual void virtual_hook( int id, void* data );
00416 private:
00417 class KEditPrivate;
00418 KEditPrivate *d;
00419 };
00420
00421 #endif
This file is part of the documentation for kdelibs Version 3.1.0.