• Skip to content
  • Skip to link menu
KDE 4.1 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 
00071 class KTEXTEDITOR_EXPORT CodeCompletionModel : public QAbstractItemModel
00072 {
00073   Q_OBJECT
00074 
00075   public:
00076     CodeCompletionModel(QObject* parent);
00077     virtual ~CodeCompletionModel();
00078 
00079     enum Columns {
00080       Prefix = 0,
00084       Icon,
00085       Scope,
00086       Name,
00087       Arguments,
00088       Postfix
00089     };
00090     static const int ColumnCount = Postfix + 1;
00091 
00092     enum CompletionProperty {
00093       NoProperty  = 0x0,
00094       FirstProperty = 0x1,
00095 
00096       // Access specifiers - no more than 1 per item
00097       Public      = 0x1,
00098       Protected   = 0x2,
00099       Private     = 0x4,
00100 
00101       // Extra access specifiers - any number per item
00102       Static      = 0x8,
00103       Const       = 0x10,
00104 
00105       // Type - no more than 1 per item (except for Template)
00106       Namespace   = 0x20,
00107       Class       = 0x40,
00108       Struct      = 0x80,
00109       Union       = 0x100,
00110       Function    = 0x200,
00111       Variable    = 0x400,
00112       Enum        = 0x800,
00113       Template    = 0x1000,
00114       TypeAlias   = 0x2000,
00115 
00116       // Special attributes - any number per item
00117       Virtual     = 0x4000,
00118       Override    = 0x8000,
00119       Inline      = 0x10000,
00120       Friend      = 0x20000,
00121       Signal      = 0x40000,
00122       Slot        = 0x80000,
00123 
00124       // Scope - no more than 1 per item
00125       LocalScope      = 0x100000,
00126       NamespaceScope  = 0x200000,
00127       GlobalScope     = 0x400000,
00128 
00129       // Keep this in sync so the code knows when to stop
00130       LastProperty    = GlobalScope
00131     };
00132     Q_DECLARE_FLAGS(CompletionProperties, CompletionProperty)
00133 
00134     enum HighlightMethod {
00135       NoHighlighting        = 0x0,
00136       InternalHighlighting  = 0x1,
00137       CustomHighlighting    = 0x2
00138     };
00139     Q_DECLARE_FLAGS(HighlightMethods, HighlightMethod)
00140 
00141     
00142 
00143     enum ExtraItemDataRoles {
00145       CompletionRole = Qt::UserRole,
00146 
00150       ScopeIndex,
00151 
00166       MatchQuality,
00167 
00176       SetMatchContext,
00177       
00183       HighlightingMethod,
00184 
00198       CustomHighlight,
00199 
00207       InheritanceDepth,
00208 
00214       IsExpandable,
00239       ExpandingWidget,
00247       ItemSelected,
00248 
00278       ArgumentHintDepth,
00279       
00289       BestMatchesCount,
00290       
00303       AccessibilityNext,
00312       AccessibilityPrevious,
00321       AccessibilityAccept,
00322 
00346       GroupRole
00347     };
00348     static const int LastItemDataRole = AccessibilityAccept;
00349 
00350     void setRowCount(int rowCount);
00351 
00352     enum InvocationType {
00353       AutomaticInvocation,
00354       UserInvocation,
00355       ManualInvocation
00356     };
00357 
00368     virtual void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
00381     virtual void executeCompletionItem(Document* document, const Range& word, int row) const;
00382 
00383     // Reimplementations
00388     virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
00393     virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
00400     virtual QMap<int, QVariant> itemData ( const QModelIndex & index ) const;
00406     virtual QModelIndex parent ( const QModelIndex & index ) const;
00413     virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
00414 
00415   private:
00416     class CodeCompletionModelPrivate* const d;
00417 };
00418 
00424 class KTEXTEDITOR_EXPORT CodeCompletionModel2 : public CodeCompletionModel {
00425   Q_OBJECT
00426   public:
00427     CodeCompletionModel2(QObject* parent);
00438     virtual void executeCompletionItem2(Document* document, const Range& word, const QModelIndex& index) const;
00439 };
00440 
00441 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::CompletionProperties)
00442 Q_DECLARE_OPERATORS_FOR_FLAGS(CodeCompletionModel::HighlightMethods)
00443 
00444 }
00445 
00446 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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