editors/qeditor/qeditorcodecompletion.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
00022
00023
00024
00025
#ifndef __QEditorCodeCompletion_H__
00026
#define __QEditorCodeCompletion_H__
00027
00028
#include <qvaluelist.h>
00029
#include <qstringlist.h>
00030
#include <qvbox.h>
00031
#include <qlistbox.h>
00032
#include <qlabel.h>
00033
00034
#include <ktexteditor/codecompletioninterface.h>
00035
00036
class QEditorArgHint;
00037
class QEditorView;
00038
00039 class QEditorCodeCompletionCommentLabel :
public QLabel
00040 {
00041 Q_OBJECT
00042
public:
00043 QEditorCodeCompletionCommentLabel(
QWidget* parent,
const QString& text) :
QLabel( parent, "toolTipTip",
00044 WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM )
00045 {
00046 setMargin(1);
00047 setIndent(0);
00048 setAutoMask( FALSE );
00049 setFrameStyle( QFrame::Plain | QFrame::Box );
00050 setLineWidth( 1 );
00051 setAlignment( AlignAuto | AlignTop );
00052 polish();
00053 setText(
text);
00054 adjustSize();
00055 }
00056 };
00057
00063 class CCListBox :
public QListBox{
00064
public:
00065 CCListBox(
QWidget* parent = 0,
const char* name = 0, WFlags f = 0):
QListBox(parent, name, f){
00066 resize(
m_size);
00067
00068
if (parent)
00069 parent->resize(
m_size +
QSize(2,2));
00070 };
00071
00072 QSize sizeHint() const {
00073
return m_size;
00074 };
00075
00076
protected:
00077 void resizeEvent(
QResizeEvent* rev){
00078
m_size = rev->size();
00079 QListBox::resizeEvent(rev);
00080 };
00081
00082
private:
00083
static QSize m_size;
00084 };
00085
00086 class QEditorCodeCompletion :
public QObject
00087 {
00088 Q_OBJECT
00089
00090
public:
00091
QEditorCodeCompletion(
QEditorView *view);
00092
00093
void showArgHint(
00094
QStringList functionList,
const QString& strWrapping,
const QString& strDelimiter );
00095
void showCompletionBox(
00096
QValueList<KTextEditor::CompletionEntry> entries,
int offset = 0,
bool casesensitive =
true );
00097
bool eventFilter(
QObject* o,
QEvent* e );
00098
00099
public slots:
00100
void slotCursorPosChanged();
00101
void showComment();
00102
00103 signals:
00104
void completionAborted();
00105
void completionDone();
00106
void argHintHidden();
00107
void completionDone(
KTextEditor::CompletionEntry);
00108
void filterInsertString(
KTextEditor::CompletionEntry*,
QString *);
00109
00110
private:
00111
void abortCompletion();
00112
void complete(
KTextEditor::CompletionEntry );
00113
void updateBox(
bool newCoordinate =
false );
00114
00115 QEditorArgHint*
m_pArgHint;
00116 QEditorView*
m_view;
00117 QVBox*
m_completionPopup;
00118 CCListBox*
m_completionListBox;
00119 QValueList<KTextEditor::CompletionEntry> m_complList;
00120 uint
m_lineCursor;
00121 uint
m_colCursor;
00122 int m_offset;
00123 bool m_caseSensitive;
00124 QEditorCodeCompletionCommentLabel*
m_commentLabel;
00125 };
00126
00127
#endif
This file is part of the documentation for KDevelop Version 3.0.4.