~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/qscintilla2/Qt4/Qsci/qscicommand.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-11-19 15:18:19 UTC
  • mfrom: (1.2.9 upstream) (3.3.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091119151819-me89ezmxzkvl0lws
Tags: 2.1.1-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This defines the interface to the QsciCommand class.
 
2
//
 
3
// Copyright (c) 2008 Riverbank Computing Limited <info@riverbankcomputing.com>
 
4
// 
 
5
// This file is part of QScintilla.
 
6
// 
 
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.
 
18
// 
 
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.
 
26
// 
 
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
 
30
// granted herein.
 
31
// 
 
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.
 
34
 
 
35
 
 
36
#ifndef QSCICOMMAND_H
 
37
#define QSCICOMMAND_H
 
38
 
 
39
#ifdef __APPLE__
 
40
extern "C++" {
 
41
#endif
 
42
 
 
43
#include <qstring.h>
 
44
 
 
45
#include <qlist.h>
 
46
 
 
47
#include <Qsci/qsciglobal.h>
 
48
 
 
49
 
 
50
class QsciScintilla;
 
51
 
 
52
 
 
53
//! \brief The QsciCommand class represents an internal editor command that may
 
54
//! have one or two keys bound to it.
 
55
//!
 
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
 
60
{
 
61
public:
 
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.
 
70
    //!
 
71
    //! \sa key(), setAlternateKey(), validKey()
 
72
    void setKey(int key);
 
73
 
 
74
    //! Binds the alternate key \a altkey to the command.  If \a key is 0
 
75
    //! then the alternate key binding is removed.
 
76
    //!
 
77
    //! \sa alternateKey(), setKey(), validKey()
 
78
    void setAlternateKey(int altkey);
 
79
 
 
80
    //! The key that is currently bound to the command is returned.
 
81
    //!
 
82
    //! \sa setKey(), alternateKey()
 
83
    int key() const {return qkey;}
 
84
 
 
85
    //! The alternate key that is currently bound to the command is
 
86
    //! returned.
 
87
    //!
 
88
    //! \sa setAlternateKey(), key()
 
89
    int alternateKey() const {return qaltkey;}
 
90
 
 
91
    //! If the key \a key is valid then true is returned.
 
92
    static bool validKey(int key);
 
93
 
 
94
    //! The user friendly description of the command is returned.
 
95
    QString description() const;
 
96
 
 
97
private:
 
98
    friend class QsciCommandSet;
 
99
 
 
100
    QsciCommand(QsciScintilla *qs, int msg, int key, int altkey,
 
101
            const char *desc);
 
102
 
 
103
    int msgId() const {return msgCmd;}
 
104
    void bindKey(int key,int &qk,int &scik);
 
105
 
 
106
    QsciScintilla *qsCmd;
 
107
    int msgCmd;
 
108
    int qkey, scikey, qaltkey, scialtkey;
 
109
    const char *descCmd;
 
110
 
 
111
    QsciCommand(const QsciCommand &);
 
112
    QsciCommand &operator=(const QsciCommand &);
 
113
};
 
114
 
 
115
#ifdef __APPLE__
 
116
}
 
117
#endif
 
118
 
 
119
#endif