00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef QKEYSEQUENCE_H
00025 #define QKEYSEQUENCE_H
00026
00027 #include <QtCore/qnamespace.h>
00028 #include <QtCore/qstring.h>
00029
00030 QT_BEGIN_HEADER
00031
00032 QT_MODULE(Gui)
00033
00034 #ifndef QT_NO_SHORTCUT
00035
00036
00037
00038
00039 #ifndef QT_NO_DATASTREAM
00040 class QKeySequence;
00041 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
00042 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
00043 #endif
00044
00045 #ifdef qdoc
00046 void qt_set_sequence_auto_mnemonic(bool b);
00047 #endif
00048
00049 class QVariant;
00050 class QKeySequencePrivate;
00051
00052 class Q_GUI_EXPORT QKeySequence
00053 {
00054 public:
00055 enum StandardKey {
00056 UnknownKey,
00057 HelpContents,
00058 WhatsThis,
00059 Open,
00060 Close,
00061 Save,
00062 New,
00063 Delete,
00064 Cut,
00065 Copy,
00066 Paste,
00067 Undo,
00068 Redo,
00069 Back,
00070 Forward,
00071 Refresh,
00072 ZoomIn,
00073 ZoomOut,
00074 Print,
00075 AddTab,
00076 NextChild,
00077 PreviousChild,
00078 Find,
00079 FindNext,
00080 FindPrevious,
00081 Replace,
00082 SelectAll,
00083 Bold,
00084 Italic,
00085 Underline,
00086 MoveToNextChar,
00087 MoveToPreviousChar,
00088 MoveToNextWord,
00089 MoveToPreviousWord,
00090 MoveToNextLine,
00091 MoveToPreviousLine,
00092 MoveToNextPage,
00093 MoveToPreviousPage,
00094 MoveToStartOfLine,
00095 MoveToEndOfLine,
00096 MoveToStartOfBlock,
00097 MoveToEndOfBlock,
00098 MoveToStartOfDocument,
00099 MoveToEndOfDocument,
00100 SelectNextChar,
00101 SelectPreviousChar,
00102 SelectNextWord,
00103 SelectPreviousWord,
00104 SelectNextLine,
00105 SelectPreviousLine,
00106 SelectNextPage,
00107 SelectPreviousPage,
00108 SelectStartOfLine,
00109 SelectEndOfLine,
00110 SelectStartOfBlock,
00111 SelectEndOfBlock,
00112 SelectStartOfDocument,
00113 SelectEndOfDocument,
00114 DeleteStartOfWord,
00115 DeleteEndOfWord,
00116 DeleteEndOfLine
00117 };
00118
00119 QKeySequence();
00120 QKeySequence(const QString &key);
00121 QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
00122 QKeySequence(const QKeySequence &ks);
00123 QKeySequence(StandardKey key);
00124 ~QKeySequence();
00125
00126 uint count() const;
00127 bool isEmpty() const;
00128
00129 enum SequenceMatch {
00130 NoMatch,
00131 PartialMatch,
00132 ExactMatch
00133 #ifdef QT3_SUPPORT
00134 , Identical = ExactMatch
00135 #endif
00136 };
00137
00138 enum SequenceFormat {
00139 NativeText,
00140 PortableText
00141 };
00142
00143 QString toString(SequenceFormat format = PortableText) const;
00144 static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
00145
00146 SequenceMatch matches(const QKeySequence &seq) const;
00147 static QKeySequence mnemonic(const QString &text);
00148 static QList<QKeySequence> keyBindings(StandardKey key);
00149
00150
00151 operator QString() const;
00152 operator QVariant() const;
00153 operator int() const;
00154 int operator[](uint i) const;
00155 QKeySequence &operator=(const QKeySequence &other);
00156 bool operator==(const QKeySequence &other) const;
00157 inline bool operator!= (const QKeySequence &other) const
00158 { return !(*this == other); }
00159 bool operator< (const QKeySequence &ks) const;
00160 inline bool operator> (const QKeySequence &other) const
00161 { return other < *this; }
00162 inline bool operator<= (const QKeySequence &other) const
00163 { return !(other < *this); }
00164 inline bool operator>= (const QKeySequence &other) const
00165 { return !(*this < other); }
00166
00167 bool isDetached() const;
00168 private:
00169 static int decodeString(const QString &ks);
00170 static QString encodeString(int key);
00171 int assign(const QString &str);
00172 void setKey(int key, int index);
00173
00174 QKeySequencePrivate *d;
00175
00176 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
00177 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
00178 friend class Q3AccelManager;
00179 friend class QShortcutMap;
00180 friend class QShortcut;
00181 };
00182 Q_DECLARE_TYPEINFO(QKeySequence, Q_MOVABLE_TYPE);
00183 Q_DECLARE_SHARED(QKeySequence)
00184
00185 #ifndef QT_NO_DEBUG_STREAM
00186 Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &);
00187 #endif
00188
00189 #else
00190
00191 class Q_GUI_EXPORT QKeySequence
00192 {
00193 public:
00194 QKeySequence() {}
00195 QKeySequence(int) {}
00196 };
00197
00198 #endif // QT_NO_SHORTCUT
00199
00200 QT_END_HEADER
00201
00202 #endif // QKEYSEQUENCE_H