KDevelop API Documentation

editors/qeditor/qeditorcodecompletion.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 qeditorcodecompletion.h - description 00003 ------------------- 00004 begin : Sun Nov 18 20:00 CET 2001 00005 copyright : (C) 2001 Joseph Wenninger <jowenn@kde.org> 00006 (C) 2002 John Firebaugh <jfirebaugh@kde.org> 00007 (C) 2002 Roberto Raggi <roberto@kdevelop.org> 00008 00009 taken from KDEVELOP: 00010 begin : Sam Jul 14 18:20:00 CEST 2001 00011 copyright : (C) 2001 by Victor Röder <Victor_Roeder@GMX.de> 00012 ***************************************************************************/ 00013 00014 /******** Partly based on the ArgHintWidget of Qt3 by Trolltech AS *********/ 00015 00016 /*************************************************************************** 00017 * * 00018 * This program is free software; you can redistribute it and/or modify * 00019 * it under the terms of the GNU General Public License as published by * 00020 * the Free Software Foundation; either version 2 of the License, or * 00021 * (at your option) any later version. * 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 //resize the frame containing the listbox (bad "style" but i don't know a better way) 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
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:56 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003