• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KTextEditor

codecompletionmodel.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
00003    Copyright (C) 2005-2006 Hamish Rodda <rodda@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H
00021 #define KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H
00022 
00023 #include <ktexteditor/ktexteditor_export.h>
00024 #include <QtCore/QModelIndex>
00025 #include <ktexteditor/range.h>
00026 
00027 namespace KTextEditor {
00028 
00029 class Document;
00030 class View;
00031 
00077 class KTEXTEDITOR_EXPORT CodeCompletionModel : public QAbstractItemModel
00078 {
00079   Q_OBJECT
00080 
00081   public:
00082     CodeCompletionModel(QObject* parent);
00083     virtual ~CodeCompletionModel();
00084 
00085     enum Columns {
00086       Prefix = 0,
00090       Icon,
00091       Scope,
00092       Name,
00093       Arguments,
00094       Postfix
00095     };
00096     static const int ColumnCount = Postfix + 1;
00097 
00098     enum CompletionProperty {
00099       NoProperty  = 0x0,
00100       FirstProperty = 0x1,
00101 
00102       // Access specifiers - no more than 1 per item
00103       Public      = 0x1,
00104       Protected   = 0x2,
00105       Private     = 0x4,
00106 
00107       // Extra access specifiers - any number per item
00108       Static      = 0x8,
00109       Const       = 0x10,
00110 
00111       // Type - no more than 1 per item (except for Template)
00112       Namespace   = 0x20,
00113       Class       = 0x40,
00114       Struct      = 0x80,
00115       Union       = 0x100,
00116       Function    = 0x200,
00117       Variable    = 0x400,
00118       Enum        = 0x800,
00119       Template    = 0x1000,
00120       TypeAlias   = 0x2000,
00121 
00122       // Special attributes - any number per item
00123       Virtual     = 0x4000,
00124       Override    = 0x8000,
00125       Inline      = 0x10000,
00126       Friend      = 0x20000,
00127       Signal      = 0x40000,
00128       Slot        = 0x80000,
00129 
00130       // Scope - no more than 1 per item
00131       LocalScope      = 0x100000,
00132       NamespaceScope  = 0x200000,
00133       GlobalScope     = 0x400000,
00134 
00135       // Keep this in sync so the code knows when to stop
00136       LastProperty    = GlobalScope
00137     };
00138     Q_DECLARE_FLAGS(CompletionProperties, CompletionProperty)
00139 
00140     enum HighlightMethod {
00141       NoHighlighting        = 0x0,
00142       InternalHighlighting  = 0x1,
00143       CustomHighlighting    = 0x2
00144     };
00145     Q_DECLARE_FLAGS(HighlightMethods, HighlightMethod)
00146 
00147     
00148 
00149     enum ExtraItemDataRoles {
00151       CompletionRole = Qt::UserRole,
00152 
00156       ScopeIndex,
00157 
00172       MatchQuality,
00173 
00182       SetMatchContext,
00183       
00189       HighlightingMethod,
00190 
00204       CustomHighlight,
00205 
00213       InheritanceDepth,
00214 
00220       IsExpandable,
00245       ExpandingWidget,
00253       ItemSelected,
00254 
00284       ArgumentHintDepth,
00285       
00295       BestMatchesCount,
00296       
00307       AccessibilityNext,
00314       AccessibilityPrevious,
00321       AccessibilityAccept,
00322 
00353       GroupRole
00354     };
00355     static const int LastItemDataRole = AccessibilityAccept;
00356 
00357     void setRowCount(int rowCount);
00358 
00359     enum InvocationType {
00360       AutomaticInvocation,
00361       UserInvocation,
00362       ManualInvocation
00363     };
00364 
00376     virtual void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
00389     virtual void executeCompletionItem(Document* document, const Range& word, int row) const;
00390 
00391     // Reimplementations
00396     virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
00401     virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
00408     virtual QMap<int, QVariant> itemData ( const QModelIndex & index ) const;
00414     virtual QModelIndex parent ( const QModelIndex & index ) const;
00421     virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
00422 
00428     bool hasGroups() const;
00429 
00430   Q_SIGNALS:
00431     void hasGroupsChanged(KTextEditor::CodeCompletionModel *model,bool hasGroups);
00432 
00433   protected:
00434     void setHasGroups(bool hasGroups);
00435 
00436   private:
00437     class CodeCompletionModelPrivate* const d;
00438 };
00439 
00445 class KTEXTEDITOR_EXPORT CodeCompletionModel2 : public CodeCompletionModel {
00446   Q_OBJECT
00447   public:
00448     CodeCompletionModel2(QObject* parent);
00459     virtual void executeCompletionItem2(Document* document, const Range& word, const QModelIndex& index) const;
00460 };
00461 
00462 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::CompletionProperties)
00463 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::HighlightMethods)
00464 
00465 }
00466 
00467 #endif // KDELIBS_KTEXTEDITOR_CODECOMPLETIONMODEL_H

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal