1
// This module defines interface to the QsciAbstractAPIs class.
3
// Copyright (c) 2008 Riverbank Computing Limited <info@riverbankcomputing.com>
5
// This file is part of QScintilla.
7
// This file may be used under the terms of the GNU General Public
8
// License versions 2.0 or 3.0 as published by the Free Software
9
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
10
// included in the packaging of this file. Alternatively you may (at
11
// your option) use any later version of the GNU General Public
12
// License if such license has been publicly approved by Riverbank
13
// Computing Limited (or its successors, if any) and the KDE Free Qt
14
// Foundation. In addition, as a special exception, Riverbank gives you
15
// certain additional rights. These rights are described in the Riverbank
16
// GPL Exception version 1.1, which can be found in the file
17
// GPL_EXCEPTION.txt in this package.
19
// Please review the following information to ensure GNU General
20
// Public Licensing requirements will be met:
21
// http://trolltech.com/products/qt/licenses/licensing/opensource/. If
22
// you are unsure which license is appropriate for your use, please
23
// review the following information:
24
// http://trolltech.com/products/qt/licenses/licensing/licensingoverview
25
// or contact the sales department at sales@riverbankcomputing.com.
27
// This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
28
// INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
29
// A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
32
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
33
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
36
#ifndef QSCIABSTRACTAPIS_H
37
#define QSCIABSTRACTAPIS_H
44
#include <qstringlist.h>
48
#include <Qsci/qsciglobal.h>
49
#include <Qsci/qsciscintilla.h>
55
//! \brief The QsciAbstractAPIs class represents the interface to the textual
56
//! API information used in call tips and for auto-completion. A sub-class
57
//! will provide the actual implementation of the interface.
59
//! API information is specific to a particular language lexer but can be
60
//! shared by multiple instances of the lexer.
61
class QSCINTILLA_EXPORT QsciAbstractAPIs : public QObject
66
//! Constructs a QsciAbstractAPIs instance attached to lexer \a lexer. \a
67
//! lexer becomes the instance's parent object although the instance can
68
//! also be subsequently attached to other lexers.
69
QsciAbstractAPIs(QsciLexer *lexer);
71
//! Destroy the QsciAbstractAPIs instance.
72
virtual ~QsciAbstractAPIs();
74
//! Return the lexer that the instance is attached to.
75
QsciLexer *lexer() const;
77
//! Update the list \a list with API entries derived from \a context. \a
78
//! context is the list of words in the text preceding the cursor position.
79
//! The characters that make up a word and the characters that separate
80
//! words are defined by the lexer. The last word is a partial word and
81
//! may be empty if the user has just entered a word separator.
82
virtual void updateAutoCompletionList(const QStringList &context,
83
QStringList &list) = 0;
85
//! This is called when the user selects the entry \a selection from the
86
//! auto-completion list. A sub-class can use this as a hint to provide
87
//! more specific API entries in future calls to
88
//! updateAutoCompletionList(). The default implementation does nothing.
89
virtual void autoCompletionSelected(const QString &selection);
91
//! Return the call tips valid for the context \a context. (Note that the
92
//! last word of the context will always be empty.) \a commas is the number
93
//! of commas the user has typed after the context and before the cursor
94
//! position. The exact position of the list of call tips can be adjusted
95
//! by specifying a corresponding left character shift in \a shifts. This
96
//! is normally done to correct for any displayed context according to \a
99
//! \sa updateAutoCompletionList()
100
virtual QStringList callTips(const QStringList &context, int commas,
101
QsciScintilla::CallTipsStyle style,
102
QList<int> &shifts) = 0;
107
QsciAbstractAPIs(const QsciAbstractAPIs &);
108
QsciAbstractAPIs &operator=(const QsciAbstractAPIs &);