00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef __CUTESCINTILLA_H__
00019 #define __CUTESCINTILLA_H__
00020 
00021 #include <qextscintilla.h>
00022 #include <qmap.h>
00023 #include <qaction.h>
00024 #include <qpopupmenu.h>
00025 
00026 #include "readtags.h"
00027 
00029 class CUTEScintilla : public QextScintilla
00030 {
00031     Q_OBJECT
00032 public:
00033     enum AutoCompletion { Document, TagsFile, None };
00034     CUTEScintilla(QWidget *parent=0, const char *name=0, tagFile *tags=0);
00036     void setActions(QMap<int, QAction*>);
00038     void autoComplete();
00041     void setAutoCompletionThreshold(int);
00042     void setAutoCompletionSource(AutoCompletion ac)
00043         { autoCompletionSource = ac; }
00045     void setTagsFile(tagFile *t)
00046         { tags = t; }
00048     QString line(int);
00049 protected slots:
00050     void slotCharAdded(int);
00051 protected:
00052     void autoCompleteFromDocument();
00053     void autoCompleteFromTagsFile();
00054     bool eventFilter(QObject *obj, QEvent *e);
00055     void contextMenu(QContextMenuEvent *e);
00056     void keyPressEvent( QKeyEvent *e );
00057     void dragEnterEvent( QDragEnterEvent *e ) { qDebug("dragEnterEvent"); }
00058     void dropEvent( QDropEvent *e );
00059 private:
00060     QMap<int, int> keyMap;
00061     QPopupMenu *menu;
00062     int threshold;
00063     static char wordChars[];
00064     AutoCompletion autoCompletionSource;
00065     tagFile *tags;
00066 };
00067 
00068 #endif