katecodecompletion.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __KateCodeCompletion_H__
00029 #define __KateCodeCompletion_H__
00030
00031 #include <ktexteditor/codecompletioninterface.h>
00032
00033 #include <qvaluelist.h>
00034 #include <qstringlist.h>
00035 #include <qlabel.h>
00036 #include <qframe.h>
00037 #include <qmap.h>
00038 #include <qintdict.h>
00039
00040 class KateView;
00041 class KateArgHint;
00042 class KateCCListBox;
00043
00044 class QLayout;
00045
00046 class KateCodeCompletionCommentLabel : public QLabel
00047 {
00048 Q_OBJECT
00049
00050 public:
00051 KateCodeCompletionCommentLabel( QWidget* parent, const QString& text) : QLabel( parent, "toolTipTip",
00052 WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM )
00053 {
00054 setMargin(1);
00055 setIndent(0);
00056 setAutoMask( false );
00057 setFrameStyle( QFrame::Plain | QFrame::Box );
00058 setLineWidth( 1 );
00059 setAlignment( AlignAuto | AlignTop );
00060 polish();
00061 setText(text);
00062 adjustSize();
00063 }
00064 };
00065
00066 class KateCodeCompletion : public QObject
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 KateCodeCompletion(KateView *view);
00072
00073 bool codeCompletionVisible ();
00074
00075 void showArgHint(
00076 QStringList functionList, const QString& strWrapping, const QString& strDelimiter );
00077 void showCompletionBox(
00078 QValueList<KTextEditor::CompletionEntry> entries, int offset = 0, bool casesensitive = true );
00079 bool eventFilter( QObject* o, QEvent* e );
00080
00081 public slots:
00082 void slotCursorPosChanged();
00083 void showComment();
00084
00085 signals:
00086 void completionAborted();
00087 void completionDone();
00088 void argHintHidden();
00089 void completionDone(KTextEditor::CompletionEntry);
00090 void filterInsertString(KTextEditor::CompletionEntry*,QString *);
00091
00092 private:
00093 void doComplete();
00094 void abortCompletion();
00095 void complete( KTextEditor::CompletionEntry );
00096 void updateBox( bool newCoordinate = false );
00097
00098 KateArgHint* m_pArgHint;
00099 KateView* m_view;
00100 class QVBox* m_completionPopup;
00101 KateCCListBox* m_completionListBox;
00102 QValueList<KTextEditor::CompletionEntry> m_complList;
00103 uint m_lineCursor;
00104 uint m_colCursor;
00105 int m_offset;
00106 bool m_caseSensitive;
00107 KateCodeCompletionCommentLabel* m_commentLabel;
00108 };
00109
00110 class KateArgHint: public QFrame
00111 {
00112 Q_OBJECT
00113
00114 public:
00115 KateArgHint( KateView* =0, const char* =0 );
00116 virtual ~KateArgHint();
00117
00118 virtual void setCurrentFunction( int );
00119 virtual int currentFunction() const { return m_currentFunction; }
00120
00121 void setArgMarkInfos( const QString&, const QString& );
00122
00123 virtual void addFunction( int, const QString& );
00124 QString functionAt( int id ) const { return m_functionMap[ id ]; }
00125
00126 virtual void show();
00127 virtual void adjustSize();
00128 virtual bool eventFilter( QObject*, QEvent* );
00129
00130 signals:
00131 void argHintHidden();
00132 void argHintCompleted();
00133 void argHintAborted();
00134
00135 public slots:
00136 virtual void reset( int, int );
00137 virtual void cursorPositionChanged( KateView*, int, int );
00138
00139 private slots:
00140 void slotDone(bool completed);
00141
00142 private:
00143 QMap<int, QString> m_functionMap;
00144 int m_currentFunction;
00145 QString m_wrapping;
00146 QString m_delimiter;
00147 bool m_markCurrentFunction;
00148 int m_currentLine;
00149 int m_currentCol;
00150 KateView* editorView;
00151 QIntDict<QLabel> labelDict;
00152 QLayout* layout;
00153 };
00154
00155 #endif
This file is part of the documentation for kate Library Version 3.2.2.