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

Kate

katecompletionwidget.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2005-2006 Hamish Rodda <rodda@kde.org>
00003    Copyright (C) 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
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 #ifndef KATECOMPLETIONWIDGET_H
00020 #define KATECOMPLETIONWIDGET_H
00021 
00022 #include <QtGui/QFrame>
00023 #include <QObject>
00024 
00025 #include <ktexteditor/range.h>
00026 #include <ktexteditor/codecompletioninterface.h>
00027 #include <ktexteditor/codecompletionmodel.h>
00028 
00029 class QToolButton;
00030 class QPushButton;
00031 class QLabel;
00032 class QTimer;
00033 
00034 class KateView;
00035 class KateSmartRange;
00036 class KateCompletionModel;
00037 class KateCompletionTree;
00038 class KateEditInfo;
00039 class KateArgumentHintTree;
00040 class KateArgumentHintModel;
00041 
00042 namespace KTextEditor {
00043   class EmbeddedWidgetInterface;
00044 }
00045 
00052 class KateCompletionWidget : public QFrame
00053 {
00054   Q_OBJECT
00055 
00056   public:
00057     explicit KateCompletionWidget(KateView* parent);
00058     ~KateCompletionWidget();
00059 
00060     KateView* view() const;
00061     KateCompletionTree* treeView() const;
00062 
00063     bool isCompletionActive() const;
00064     void startCompletion(KTextEditor::CodeCompletionModel::InvocationType invocationType);
00065     void startCompletion(const KTextEditor::Range& word, KTextEditor::CodeCompletionModel* model, KTextEditor::CodeCompletionModel::InvocationType invocationType = KTextEditor::CodeCompletionModel::ManualInvocation);
00066     void userInvokedCompletion();
00067 
00068     //Executed when return is pressed while completion is active.
00069     void execute();
00070         //Callbacks for keyboard-input, they return true when the event was handled, and should not be reached on.
00071     void cursorDown();
00072     void cursorUp();
00073     
00075     bool toggleExpanded(bool forceExpand = false, bool forceUnExpand = false);
00076 
00077     const KateCompletionModel* model() const;
00078     KateCompletionModel* model();
00079     
00080     void registerCompletionModel(KTextEditor::CodeCompletionModel* model);
00081     void unregisterCompletionModel(KTextEditor::CodeCompletionModel* model);
00082     
00083     int automaticInvocationDelay() const;
00084     void setAutomaticInvocationDelay(int delay);
00085     
00086     KateSmartRange* completionRange(KTextEditor::CodeCompletionModel* model = 0) const;
00087     QMap<KTextEditor::CodeCompletionModel*, KateSmartRange*> completionRanges( ) const;
00088 
00089     // Navigation
00090     void pageDown();
00091     void pageUp();
00092     void top();
00093     void bottom();
00094     
00095     QWidget* currentEmbeddedWidget();
00096     
00097     bool canExpandCurrentItem() const;
00098 
00099     bool canCollapseCurrentItem() const;
00100 
00101     void setCurrentItemExpanded( bool );
00102     
00103     //Returns true if a screen border has been hit
00104     bool updatePosition(bool force = false);
00105 
00106     virtual bool eventFilter( QObject * watched, QEvent * event );
00107 
00108     KateArgumentHintTree* argumentHintTree() const;
00109     
00110     KateArgumentHintModel* argumentHintModel() const;
00111 
00113     
00114     void updateHeight();
00115     
00116   public Q_SLOTS:
00117     void abortCompletion();
00118     void showConfig();
00119 /*    void viewFocusIn();
00120     void viewFocusOut();*/
00121     void updatePositionSlot();
00122     void automaticInvocation();
00123 
00124 /*    void updateFocus();*/
00125     void argumentHintsChanged(bool hasContent);
00126     
00127     bool navigateUp();
00128     bool navigateDown();
00129     bool navigateLeft();
00130     bool navigateRight();
00131     bool navigateAccept();
00132     bool navigateBack();
00133     
00134     bool hadNavigation() const;
00135     void resetHadNavigation();
00136     
00137   protected:
00138     virtual void showEvent ( QShowEvent * event );
00139     virtual void resizeEvent ( QResizeEvent * event );
00140     virtual void hideEvent ( QHideEvent * event );
00141 //    virtual void focusInEvent ( QFocusEvent * event );
00142 
00143   private Q_SLOTS:
00144     void modelContentChanged();
00145     void cursorPositionChanged();
00146     void editDone(KateEditInfo* edit);
00147     void modelReset();
00148     void startCharacterDeleted(KTextEditor::SmartCursor* cursor, bool deletedBefore);
00149     void rowsInserted(const QModelIndex& parent, int row, int rowEnd);
00150     void viewFocusOut();
00151   private:
00152     void updateAndShow();
00153     void updateArgumentHintGeometry();
00154     QModelIndex selectedIndex() const;
00155 
00156     void clear();
00157     //Switch cursor between argument-hint list / completion-list
00158     void switchList();
00159     KTextEditor::Range determineRange() const;
00160     void completionRangeChanged(KTextEditor::CodeCompletionModel*, const KTextEditor::Range& word);
00161 
00162     QList<KTextEditor::CodeCompletionModel*> m_sourceModels;
00163     KateCompletionModel* m_presentationModel;
00164 
00165     QMap<KTextEditor::CodeCompletionModel*, KateSmartRange*> m_completionRanges;
00166     KTextEditor::Cursor m_lastCursorPosition;
00167 
00168     KateCompletionTree* m_entryList;
00169     KateArgumentHintModel* m_argumentHintModel;
00170     KateArgumentHintTree* m_argumentHintTree;
00171 
00172     QTimer* m_automaticInvocationTimer;
00173     //QTimer* m_updateFocusTimer;
00174     QWidget* m_statusBar;
00175     QToolButton* m_sortButton;
00176     QLabel* m_sortText;
00177     QToolButton* m_filterButton;
00178     QLabel* m_filterText;
00179     QPushButton* m_configButton;
00180 
00181     KTextEditor::Cursor m_automaticInvocationAt;
00182     QString m_automaticInvocationLine;
00183     int m_automaticInvocationDelay;
00184     bool m_filterInstalled;
00185 
00186     class KateCompletionConfig* m_configWidget;
00187     bool m_lastInsertionByUser;
00188     bool m_inCompletionList; //Are we in the completion-list? If not, we're in the argument-hint list
00189     bool m_isSuspended;
00190     bool m_dontShowArgumentHints; //Used temporarily to prevent flashing
00191     bool m_needShow;
00192 
00193     bool m_hadCompletionNavigation;
00194     
00195     int m_expandedAddedHeightBase;
00196 };
00197 
00198 #endif

Kate

Skip menu "Kate"
  • Main Page
  • 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