kdeui
keditcl.h
Go to the documentation of this file.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 KDEUI_EXPORT 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 KDEUI_EXPORT 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 KDEUI_EXPORT 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 KDEUI_EXPORT_DEPRECATED 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 QString selectWordUnderCursor();
00285
00287 QPopupMenu *createPopupMenu( const QPoint& pos );
00288
00289 void setAutoUpdate(bool b);
00290
00291 signals:
00298 void gotUrlDrop(QDropEvent* e);
00299
00305 void CursorPositionChanged();
00306
00316 void toggle_overwrite_signal();
00317
00318 public slots:
00322 void corrected (const QString &originalword, const QString &newword, unsigned int pos);
00326 void misspelling (const QString &word, const QStringList &, unsigned int pos);
00327 private slots:
00328
00333 void search_slot();
00334
00338 void searchdone_slot();
00339
00343 void replace_slot();
00344
00348 void replace_all_slot();
00349
00353 void replace_search_slot();
00354
00358 void replacedone_slot();
00359
00363 void slotCursorPositionChanged();
00364
00365 protected:
00366 void computePosition();
00367 int doSearch(QString s_pattern, bool case_sensitive,
00368 bool regex, bool forward,int line, int col);
00369
00370 int doReplace(QString s_pattern, bool case_sensitive,
00371 bool regex, bool forward,int line, int col,bool replace);
00372
00376 void posToRowCol(unsigned int pos, unsigned int &line, unsigned int &col);
00377
00381 virtual void create( WId = 0, bool initializeWindow = true,
00382 bool destroyOldWindow = true );
00383
00387 virtual void ensureCursorVisible();
00388 virtual void setCursor( const QCursor & );
00389 virtual void viewportPaintEvent( QPaintEvent* );
00390
00391 protected:
00392
00393 void keyPressEvent ( QKeyEvent * );
00394
00395
00396 void dragMoveEvent(QDragMoveEvent* e);
00397 void dragEnterEvent(QDragEnterEvent* e);
00398 void dropEvent(QDropEvent* e);
00399 void contentsDragMoveEvent(QDragMoveEvent* e);
00400 void contentsDragEnterEvent(QDragEnterEvent* e);
00401 void contentsDropEvent(QDropEvent* e);
00402
00403 private:
00404 QTimer* repaintTimer;
00405
00406 QString killbufferstring;
00407 QWidget *parent;
00408 KEdFind *srchdialog;
00409 KEdReplace *replace_dialog;
00410 KEdGotoLine *gotodialog;
00411
00412 QString pattern;
00413
00414 bool can_replace;
00415 bool killing;
00416 bool killtrue;
00417 bool lastwasanewline;
00418 bool saved_readonlystate;
00419 int last_search;
00420 int last_replace;
00421 int replace_all_line;
00422 int replace_all_col;
00423
00424 int line_pos, col_pos;
00425 bool fill_column_is_set;
00426 bool word_wrap_is_set;
00427 int fill_column_value;
00428
00429 protected:
00430 virtual void virtual_hook( int id, void* data );
00431 private:
00432 class KEditPrivate;
00433 KEditPrivate *d;
00434 };
00435
00436 #endif