summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KKey.java
blob: 6bc2827ea2e3ab3728291d7f105fb6e660f26a37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.QKeySequence;
import org.kde.qt.QtSupport;
import org.kde.qt.QKeyEvent;

/**

 A KKey object represents a single key with possible modifiers
 (Shift, Ctrl, Alt, Win).  It can represent both keys which are
 understood by Qt as well as those which are additionally supported
 by the underlying system (e.g. X11).
		@short    A KKey object represents a single key with possible modifiers  (Shift, Ctrl, Alt, Win).
		@see KKeyNative
		@see KKeySequence
		@see KShortcut

*/
public class KKey implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected KKey(Class dummy){}

	/**	
		 The number of flags.
				@short    The number of flags.
		@see ModFlag
	*/
	public static final int MOD_FLAG_COUNT = 4;

	public static final int QtWIN = (Qt.META);

	/**	
		 Flags to represent the modifiers. You can combine modifiers
		 by ORing them.
			 		@short    Flags to represent the modifiers.
	*/
	public static final int SHIFT = 0x01;
	public static final int CTRL = 0x02;
	public static final int ALT = 0x04;
	public static final int WIN = 0x08;

	/**	
		 Creates a new null KKey.
				@short    Creates a new null KKey.
		@see #clear
		@see #isNull
		@see #null
	*/
	public KKey() {
		newKKey();
	}
	private native void newKKey();
	/**	
		 Creates a new key for the given Qt key code.
			@param keyQt the qt keycode
				@short    Creates a new key for the given Qt key code.
		@see org.kde.qt.Qt#Key
	*/
	public KKey(int keyQt) {
		newKKey(keyQt);
	}
	private native void newKKey(int keyQt);
	/**	
		 Creates a new key from the first key code of the given key sequence.
			@param keySeq the key sequence that contains the key
			 		@short    Creates a new key from the first key code of the given key sequence.
	*/
	public KKey(QKeySequence keySeq) {
		newKKey(keySeq);
	}
	private native void newKKey(QKeySequence keySeq);
	/**	
		 Extracts the key from the given key event.
			@param keyEvent the key event to get the key from
			 		@short    Extracts the key from the given key event.
	*/
	public KKey(QKeyEvent keyEvent) {
		newKKey(keyEvent);
	}
	private native void newKKey(QKeyEvent keyEvent);
	/**	
		 Copy constructor.
			 		@short    Copy constructor.
	*/
	public KKey(KKey key) {
		newKKey(key);
	}
	private native void newKKey(KKey key);
	/**	
		 Creates a new key from the given description. The form of the description
		 is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or
		 "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and
		 "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.
			@param key the description of the key
				@short    Creates a new key from the given description.
		@see KKeyServer#Sym#init
	*/
	public KKey(String key) {
		newKKey(key);
	}
	private native void newKKey(String key);
	/**	
				 		@short
	*/
	public KKey(int key, int mod) {
		newKKey(key,mod);
	}
	private native void newKKey(int key, int mod);
	/**	
		 Clears the key. The key is null after calling this function.
				@short    Clears the key.
		@see #isNull
	*/
	public native void clear();
	/**	
		 Initializes the key with the given Qt key code.
			@param keyQt the qt keycode
				@return true if successful, false otherwise

		@short    Initializes the key with the given Qt key code.
		@see org.kde.qt.Qt#Key
	*/
	public native boolean init(int keyQt);
	/**	
		 Initializes the key with the first key code of the given key sequence.
			@param keySeq the key sequence that contains the key
				@return true if successful, false otherwise
	 
		@short    Initializes the key with the first key code of the given key sequence.
	*/
	public native boolean init(QKeySequence keySeq);
	/**	
		 Initializes the key by extracting the code from the given key event.
			@param keyEvent the key event to get the key from
				@return true if successful, false otherwise
	 
		@short    Initializes the key by extracting the code from the given key event.
	*/
	public native boolean init(QKeyEvent keyEvent);
	/**	
		 Copies the given key.
			@param key the key to copy
				@return true if successful, false otherwise
	 
		@short    Copies the given key.
	*/
	public native boolean init(KKey key);
	/**	
		 Initializes the key with the given description. The form of the description
		 is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or
		 "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and
		 "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.
			@param key the description of the key
				@return true if successful, false otherwise

		@short    Initializes the key with the given description.
		@see KKeyServer#Sym#init
	*/
	public native boolean init(String key);
	/**	
				 		@short
	*/
	public native boolean init(int key, int mod);
	/**	
		 Returns true if the key is null (after clear() or empty
		 constructor).
				@return true if the key is null

		@short    Returns true if the key is null (after clear() or empty  constructor).
		@see #clear
		@see #null
	*/
	public native boolean isNull();
	/**	
				 		@short
	*/
	public native int sym();
	/**	
				 		@short
	*/
	public native int modFlags();
	/**	
		 Compares this key with the given KKey object. Returns a negative
		 number if the given KKey is larger, 0 if they are equal and
		 a positive number this KKey is larger. The returned value
		 is the difference between the symbol or, if the symbols
		 are equal, the difference between the encoded modifiers.
			@param key the key to compare with this key
				@return a negative number if the given KKey is larger, 0 if
 they are equal and a positive number this KKey is larger
	 
		@short    Compares this key with the given KKey object.
	*/
	public native int compare(KKey key);
	/**	
		 Compares the symbol and modifiers of both keys.
				@short    Compares the symbol and modifiers of both keys.
		@see #compare
	*/
	public native boolean op_equals(KKey key);
	/**	
		 Compares the symbol and modifiers of both keys.
				@short    Compares the symbol and modifiers of both keys.
		@see #compare
	*/
	public native boolean op_not_equals(KKey key);
	/**	
		 Compares the symbol and modifiers of both keys.
				@short    Compares the symbol and modifiers of both keys.
		@see #compare
	*/
	public native boolean op_lt(KKey key);
	/**	
		 Returns the qt key code.
				@return the qt key code or 0 if there is no key set.

		@short    Returns the qt key code.
		@see org.kde.qt.Qt#Key
	*/
	public native int keyCodeQt();
	/**	
		 Returns a human-readable representation of the key in the form
		 "modifier+key". Note that the representation is localised,
		 use toStringInternal() for cases like saving to configuration files.
				@return the string representation of the key

		@short    Returns a human-readable representation of the key in the form  "modifier+key".
		@see #toStringInternal
	*/
	public native String toString();
	/**	
		 Returns an untranslated text representation of the key in the form
		 "modifier+key", suitable e.g. for saving in configuration files.
			 		@short    Returns an untranslated text representation of the key in the form  "modifier+key", suitable e.
	*/
	public native String toStringInternal();
	/**	
				 		@short
	*/
	public native void simplify();
	/**	
		 Returns a null key.
				@return the null key

		@short    Returns a null key.
		@see #isNull
		@see #clear
	*/
	public static native KKey nil();
	/**	
		 Returns a user-readable representation of the given modifiers.
			@param f the modifiers to convert
				@return the string representation of the modifiers
	 
		@short    Returns a user-readable representation of the given modifiers.
	*/
	public static native String modFlagLabel(int f);
	/** Deletes the wrapped C++ instance */
	protected native void finalize() throws InternalError;
	/** Delete the wrapped C++ instance ahead of finalize() */
	public native void dispose();
	/** Has the wrapped C++ instance been deleted? */
	public native boolean isDisposed();
}