1
// This defines the interface to the QsciCommand 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.
47
#include <Qsci/qsciglobal.h>
53
//! \brief The QsciCommand class represents an internal editor command that may
54
//! have one or two keys bound to it.
56
//! Methods are provided to change the keys bound to the command and to remove
57
//! a key binding. Each command has a user friendly description of the command
58
//! for use in key mapping dialogs.
59
class QSCINTILLA_EXPORT QsciCommand
62
//! Binds the key \a key to the command. If \a key is 0 then the key
63
//! binding is removed. If \a key is invalid then the key binding is
64
//! unchanged. Valid keys are any visible or control character or any
65
//! of \c Key_Down, \c Key_Up, \c Key_Left, \c Key_Right, \c Key_Home,
66
//! \c Key_End, \c Key_PageUp, \c Key_PageDown, \c Key_Delete,
67
//! \c Key_Insert, \c Key_Escape, \c Key_Backspace, \c Key_Tab and
68
//! \c Key_Return. Keys may be modified with any combination of \c SHIFT,
69
//! \c CTRL and \c ALT.
71
//! \sa key(), setAlternateKey(), validKey()
74
//! Binds the alternate key \a altkey to the command. If \a key is 0
75
//! then the alternate key binding is removed.
77
//! \sa alternateKey(), setKey(), validKey()
78
void setAlternateKey(int altkey);
80
//! The key that is currently bound to the command is returned.
82
//! \sa setKey(), alternateKey()
83
int key() const {return qkey;}
85
//! The alternate key that is currently bound to the command is
88
//! \sa setAlternateKey(), key()
89
int alternateKey() const {return qaltkey;}
91
//! If the key \a key is valid then true is returned.
92
static bool validKey(int key);
94
//! The user friendly description of the command is returned.
95
QString description() const;
98
friend class QsciCommandSet;
100
QsciCommand(QsciScintilla *qs, int msg, int key, int altkey,
103
int msgId() const {return msgCmd;}
104
void bindKey(int key,int &qk,int &scik);
106
QsciScintilla *qsCmd;
108
int qkey, scikey, qaltkey, scialtkey;
111
QsciCommand(const QsciCommand &);
112
QsciCommand &operator=(const QsciCommand &);