0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the QtGui module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#ifndef QKEYSEQUENCE_H
|
|
43 |
#define QKEYSEQUENCE_H
|
|
44 |
|
|
45 |
#include <QtCore/qnamespace.h>
|
|
46 |
#include <QtCore/qstring.h>
|
|
47 |
|
|
48 |
QT_BEGIN_HEADER
|
|
49 |
|
|
50 |
QT_BEGIN_NAMESPACE
|
|
51 |
|
|
52 |
QT_MODULE(Gui)
|
|
53 |
|
|
54 |
#ifndef QT_NO_SHORTCUT
|
|
55 |
|
|
56 |
/*****************************************************************************
|
|
57 |
QKeySequence stream functions
|
|
58 |
*****************************************************************************/
|
|
59 |
#ifndef QT_NO_DATASTREAM
|
|
60 |
class QKeySequence;
|
|
61 |
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
|
62 |
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
|
|
63 |
#endif
|
|
64 |
|
|
65 |
#ifdef qdoc
|
|
66 |
void qt_set_sequence_auto_mnemonic(bool b);
|
|
67 |
#endif
|
|
68 |
|
|
69 |
class QVariant;
|
|
70 |
class QKeySequencePrivate;
|
|
71 |
|
|
72 |
class Q_GUI_EXPORT QKeySequence
|
|
73 |
{
|
|
74 |
public:
|
|
75 |
enum StandardKey {
|
|
76 |
UnknownKey,
|
|
77 |
HelpContents,
|
|
78 |
WhatsThis,
|
|
79 |
Open,
|
|
80 |
Close,
|
|
81 |
Save,
|
|
82 |
New,
|
|
83 |
Delete,
|
|
84 |
Cut,
|
|
85 |
Copy,
|
|
86 |
Paste,
|
|
87 |
Undo,
|
|
88 |
Redo,
|
|
89 |
Back,
|
|
90 |
Forward,
|
|
91 |
Refresh,
|
|
92 |
ZoomIn,
|
|
93 |
ZoomOut,
|
|
94 |
Print,
|
|
95 |
AddTab,
|
|
96 |
NextChild,
|
|
97 |
PreviousChild,
|
|
98 |
Find,
|
|
99 |
FindNext,
|
|
100 |
FindPrevious,
|
|
101 |
Replace,
|
|
102 |
SelectAll,
|
|
103 |
Bold,
|
|
104 |
Italic,
|
|
105 |
Underline,
|
|
106 |
MoveToNextChar,
|
|
107 |
MoveToPreviousChar,
|
|
108 |
MoveToNextWord,
|
|
109 |
MoveToPreviousWord,
|
|
110 |
MoveToNextLine,
|
|
111 |
MoveToPreviousLine,
|
|
112 |
MoveToNextPage,
|
|
113 |
MoveToPreviousPage,
|
|
114 |
MoveToStartOfLine,
|
|
115 |
MoveToEndOfLine,
|
|
116 |
MoveToStartOfBlock,
|
|
117 |
MoveToEndOfBlock,
|
|
118 |
MoveToStartOfDocument,
|
|
119 |
MoveToEndOfDocument,
|
|
120 |
SelectNextChar,
|
|
121 |
SelectPreviousChar,
|
|
122 |
SelectNextWord,
|
|
123 |
SelectPreviousWord,
|
|
124 |
SelectNextLine,
|
|
125 |
SelectPreviousLine,
|
|
126 |
SelectNextPage,
|
|
127 |
SelectPreviousPage,
|
|
128 |
SelectStartOfLine,
|
|
129 |
SelectEndOfLine,
|
|
130 |
SelectStartOfBlock,
|
|
131 |
SelectEndOfBlock,
|
|
132 |
SelectStartOfDocument,
|
|
133 |
SelectEndOfDocument,
|
|
134 |
DeleteStartOfWord,
|
|
135 |
DeleteEndOfWord,
|
|
136 |
DeleteEndOfLine,
|
|
137 |
InsertParagraphSeparator,
|
|
138 |
InsertLineSeparator,
|
|
139 |
SaveAs,
|
|
140 |
Preferences,
|
|
141 |
Quit
|
|
142 |
};
|
|
143 |
|
|
144 |
QKeySequence();
|
|
145 |
QKeySequence(const QString &key);
|
|
146 |
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
|
|
147 |
QKeySequence(const QKeySequence &ks);
|
|
148 |
QKeySequence(StandardKey key);
|
|
149 |
~QKeySequence();
|
|
150 |
|
|
151 |
uint count() const; // ### Qt 5: return 'int'
|
|
152 |
bool isEmpty() const;
|
|
153 |
|
|
154 |
enum SequenceMatch {
|
|
155 |
NoMatch,
|
|
156 |
PartialMatch,
|
|
157 |
ExactMatch
|
|
158 |
#ifdef QT3_SUPPORT
|
|
159 |
, Identical = ExactMatch
|
|
160 |
#endif
|
|
161 |
};
|
|
162 |
|
|
163 |
enum SequenceFormat {
|
|
164 |
NativeText,
|
|
165 |
PortableText
|
|
166 |
};
|
|
167 |
|
|
168 |
QString toString(SequenceFormat format = PortableText) const;
|
|
169 |
static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
|
|
170 |
|
|
171 |
SequenceMatch matches(const QKeySequence &seq) const;
|
|
172 |
static QKeySequence mnemonic(const QString &text);
|
|
173 |
static QList<QKeySequence> keyBindings(StandardKey key);
|
|
174 |
|
|
175 |
// ### Qt 5: kill 'operator QString' - it's evil
|
|
176 |
operator QString() const;
|
|
177 |
operator QVariant() const;
|
|
178 |
operator int() const;
|
|
179 |
int operator[](uint i) const;
|
|
180 |
QKeySequence &operator=(const QKeySequence &other);
|
|
181 |
bool operator==(const QKeySequence &other) const;
|
|
182 |
inline bool operator!= (const QKeySequence &other) const
|
|
183 |
{ return !(*this == other); }
|
|
184 |
bool operator< (const QKeySequence &ks) const;
|
|
185 |
inline bool operator> (const QKeySequence &other) const
|
|
186 |
{ return other < *this; }
|
|
187 |
inline bool operator<= (const QKeySequence &other) const
|
|
188 |
{ return !(other < *this); }
|
|
189 |
inline bool operator>= (const QKeySequence &other) const
|
|
190 |
{ return !(*this < other); }
|
|
191 |
|
|
192 |
bool isDetached() const;
|
|
193 |
private:
|
|
194 |
static int decodeString(const QString &ks);
|
|
195 |
static QString encodeString(int key);
|
|
196 |
int assign(const QString &str);
|
|
197 |
void setKey(int key, int index);
|
|
198 |
|
|
199 |
QKeySequencePrivate *d;
|
|
200 |
|
|
201 |
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
|
|
202 |
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
|
|
203 |
friend class Q3AccelManager;
|
|
204 |
friend class QShortcutMap;
|
|
205 |
friend class QShortcut;
|
|
206 |
|
|
207 |
public:
|
|
208 |
typedef QKeySequencePrivate * DataPtr;
|
|
209 |
inline DataPtr &data_ptr() { return d; }
|
|
210 |
};
|
|
211 |
Q_DECLARE_TYPEINFO(QKeySequence, Q_MOVABLE_TYPE);
|
|
212 |
Q_DECLARE_SHARED(QKeySequence)
|
|
213 |
|
|
214 |
#ifndef QT_NO_DEBUG_STREAM
|
|
215 |
Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &);
|
|
216 |
#endif
|
|
217 |
|
|
218 |
#else
|
|
219 |
|
|
220 |
class Q_GUI_EXPORT QKeySequence
|
|
221 |
{
|
|
222 |
public:
|
|
223 |
QKeySequence() {}
|
|
224 |
QKeySequence(int) {}
|
|
225 |
};
|
|
226 |
|
|
227 |
#endif // QT_NO_SHORTCUT
|
|
228 |
|
|
229 |
QT_END_NAMESPACE
|
|
230 |
|
|
231 |
QT_END_HEADER
|
|
232 |
|
|
233 |
#endif // QKEYSEQUENCE_H
|