codecompletioninterface.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef __ktexteditor_codecompletioninterface_h__
00020 #define __ktexteditor_codecompletioninterface_h__
00021 
00022 #include <qstring.h>
00023 #include <qstringlist.h>
00024 
00025 #include <kdelibs_export.h>
00026 
00027 namespace KTextEditor
00028 {
00029 
00042 class KTEXTEDITOR_EXPORT CompletionEntry
00043 {
00044   public:
00045     QString type;
00046     QString text;
00047     QString prefix;
00048     QString postfix;
00049     QString comment;
00050 
00051     QString userdata;
00052 
00053     bool operator==( const CompletionEntry &c ) const {
00054       return ( c.type == type &&
00055            c.text == text &&
00056            c.postfix == postfix &&
00057            c.prefix == prefix &&
00058            c.comment == comment &&
00059                c.userdata == userdata);
00060     }
00061 };
00062 
00086 class KTEXTEDITOR_EXPORT CodeCompletionInterface
00087 {
00088   friend class PrivateCodeCompletionInterface;
00089 
00090   public:
00091     CodeCompletionInterface();
00092     virtual ~CodeCompletionInterface();
00093 
00094     unsigned int codeCompletionInterfaceNumber () const;
00095 
00096   protected:
00097     void setCodeCompletionInterfaceDCOPSuffix (const QCString &suffix);
00098 
00099 
00100   public:
00101     //
00102     // slots !!!
00103     //
00107     virtual void showArgHint (QStringList functionList, const QString& strWrapping, const QString& strDelimiter) = 0;
00108 
00115     virtual void showCompletionBox (QValueList<CompletionEntry> complList,int offset=0, bool casesensitive=true)=0;
00116 
00117     //
00118     // signals !!!
00119     //
00120     public:
00121 
00122 
00133     virtual void completionAborted()=0;
00134 
00146     virtual void completionDone()=0;
00147 
00162     virtual void completionDone(CompletionEntry)=0;
00163 
00174     virtual void argHintHidden()=0;
00175 
00189     virtual void filterInsertString(CompletionEntry*,QString*)=0;
00190 
00191 
00192   private:
00193     class PrivateCodeCompletionInterface *d;
00194     static unsigned int globalCodeCompletionInterfaceNumber;
00195     unsigned int myCodeCompletionInterfaceNumber;
00196 };
00197 
00198 KTEXTEDITOR_EXPORT CodeCompletionInterface *codeCompletionInterface (class View *view);
00199 
00200 }
00201 
00202 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys