kate Library: katecodecompletion.h Source File (kate Library)

| # kate Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# katecodecompletion.h

    00001 /* This file is part of the KDE libraries
    00002
    00003    Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
    00004    Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
    00005    Copyright (C) 2001 by Victor Röder <Victor_Roeder@GMX.de>
    00006    Copyright (C) 2002 by Roberto Raggi <roberto@kdevelop.org>
    00007
    00008    This library is free software; you can redistribute it and/or
    00009    modify it under the terms of the GNU Library General Public
    00010    License version 2 as published by the Free Software Foundation.
    00011
    00012    This library is distributed in the hope that it will be useful,
    00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015    Library General Public License for more details.
    00016
    00017    You should have received a copy of the GNU Library General Public License
    00018    along with this library; see the file COPYING.LIB.  If not, write to
    00019    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020    Boston, MA 02111-1307, USA.
    00021 */
    00022
    00023 /******** Partly based on the ArgHintWidget of Qt3 by Trolltech AS *********/
    00024 /* Trolltech doesn't mind, if we license that piece of code as LGPL, because there isn't much
    00025  * left from the desigener code */
    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 class QVBox;
    00046
    00047 class KateCodeCompletionCommentLabel : public QLabel
    00048 {
    00049   Q_OBJECT
    00050
    00051   public:
    00052     KateCodeCompletionCommentLabel( QWidget* parent, const QString& text) : QLabel( parent, "toolTipTip",
    00053              WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM )
    00054     {
    00055         setMargin(1);
    00056         setIndent(0);
    00057         setAutoMask( false );
    00058         setFrameStyle( QFrame::Plain | QFrame::Box );
    00059         setLineWidth( 1 );
    00060         setAlignment( AlignAuto | AlignTop );
    00061         polish();
    00062         setText(text);
    00063         adjustSize();
    00064     }
    00065 };
    00066
    00067 class KateCodeCompletion : public QObject
    00068 {
    00069   Q_OBJECT
    00070
    00071   friend class KateViewInternal;
    00072
    00073   public:
    00074     KateCodeCompletion(KateView *view);
    00075
    00076     bool codeCompletionVisible ();
    00077
    00078     void showArgHint(
    00079         QStringList functionList, const QString& strWrapping, const QString& strDelimiter );
    00080     void showCompletionBox(
    00081         QValueList<KTextEditor::CompletionEntry> entries, int offset = 0, bool casesensitive = true );
    00082     bool eventFilter( QObject* o, QEvent* e );
    00083
    00084     void handleKey (QKeyEvent *e);
    00085
    00086   public slots:
    00087     void slotCursorPosChanged();
    00088     void showComment();
    00089     void updateBox () { updateBox(false); }
    00090
    00091   signals:
    00092     void completionAborted();
    00093     void completionDone();
    00094     void argHintHidden();
    00095     void completionDone(KTextEditor::CompletionEntry);
    00096     void filterInsertString(KTextEditor::CompletionEntry*,QString *);
    00097
    00098   private:
    00099     void doComplete();
    00100     void abortCompletion();
    00101     void complete( KTextEditor::CompletionEntry );
    00102     void updateBox( bool newCoordinate );
    00103
    00104     KateArgHint*    m_pArgHint;
    00105     KateView*       m_view;
    00106     QVBox*          m_completionPopup;
    00107     KateCCListBox*       m_completionListBox;
    00108     QValueList<KTextEditor::CompletionEntry> m_complList;
    00109     uint            m_lineCursor;
    00110     uint            m_colCursor;
    00111     int             m_offset;
    00112     bool            m_caseSensitive;
    00113     KateCodeCompletionCommentLabel* m_commentLabel;
    00114 };
    00115
    00116 class KateArgHint: public QFrame
    00117 {
    00118   Q_OBJECT
    00119
    00120   public:
    00121       KateArgHint( KateView* =0, const char* =0 );
    00122       virtual ~KateArgHint();
    00123
    00124       virtual void setCurrentFunction( int );
    00125       virtual int currentFunction() const { return m_currentFunction; }
    00126
    00127       void setArgMarkInfos( const QString&, const QString& );
    00128
    00129       virtual void addFunction( int, const QString& );
    00130       QString functionAt( int id ) const { return m_functionMap[ id ]; }
    00131
    00132       virtual void show();
    00133       virtual void adjustSize();
    00134       virtual bool eventFilter( QObject*, QEvent* );
    00135
    00136   signals:
    00137       void argHintHidden();
    00138       void argHintCompleted();
    00139       void argHintAborted();
    00140
    00141   public slots:
    00142       virtual void reset( int, int );
    00143       virtual void cursorPositionChanged( KateView*, int, int );
    00144
    00145   private slots:
    00146       void slotDone(bool completed);
    00147
    00148   private:
    00149       QMap<int, QString> m_functionMap;
    00150       int m_currentFunction;
    00151       QString m_wrapping;
    00152       QString m_delimiter;
    00153       bool m_markCurrentFunction;
    00154       int m_currentLine;
    00155       int m_currentCol;
    00156       KateView* editorView;
    00157       QIntDict<QLabel> labelDict;
    00158       QLayout* layout;
    00159 };
    00160
    00161 #endif
    00162
    00163 // kate: space-indent on; indent-width 2; replace-tabs on;

This file is part of the documentation for kate Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:36:30 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003