summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KAccel.java
blob: 07973e0b3d709ffc0e16b70b46e80aeb77aaaf25 (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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.TQMetaObject;
import org.kde.qt.QtSupport;
import org.kde.qt.TQObject;
import org.kde.qt.TQWidget;
import org.kde.qt.TQAccel;

/**

 Handle shortcuts.
 Allow a user to configure shortcuts
 through application configuration files or through the
 KKeyChooser GUI.
 A KAccel contains a list of accelerator actions.
 For example, CTRL+Key_P could be a shortcut for printing a document. The key
 codes are listed in qnamespace.h. "Print" could be the action name for printing.
 The action name identifies the shortcut in configuration files and the
 KKeyChooser GUI.
 A KAccel object handles key events sent to its parent widget and to all
 children of this parent widget.  The most recently created KAccel object
 has precedence over any KAccel objects created before it.
 When a shortcut pressed, KAccel calls the slot to which it has been
 connected. If you want to set global accelerators, independent of the window
 which has the focus, use TDEGlobalAccel.
 Reconfiguration of a given shortcut can be prevented by specifying
 that an accelerator item is not configurable when it is inserted. A special
 group of non-configurable key bindings are known as the
 standard accelerators.
 The standard accelerators appear repeatedly in applications for
 standard document actions such as printing and saving. A convenience method is
 available to insert and connect these accelerators which are configurable on
 a desktop-wide basis.
 It is possible for a user to choose to have no key associated with
 an action.
 The translated first argument for insertItem() is used only
 in the configuration dialog.
<pre>
 KAccel pAccel = new KAccel( this );
 // Insert an action "Scroll Up" which is associated with the "Up" key:
 pAccel.insert( "Scroll Up", i18n("Scroll up"),
                       i18n("Scroll up the current document by one line."),
                       Qt.Key_Up, this, SLOT("slotScrollUp()") );
 // Insert an standard acclerator action.
 pAccel.insert( KStdAccel.Print, this, SLOT("slotPrint()") );
 // Update the shortcuts by read any user-defined settings from the
 // application's config file.
 pAccel.readSettings();
 </pre>
 See {@link KAccelSignals} for signals emitted by KAccel
		@short Configurable shortcut support for widgets. 
		@see TDEGlobalAccel
		@see KAccelShortcutList
		@see KKeyChooser
		@see KKeyDialog

*/
public class KAccel extends TQAccel  {
	protected KAccel(Class dummy){super((Class) null);}
	public native TQMetaObject metaObject();
	public native String className();
	/**	
		 Creates a new KAccel that watches <code>pParent</code>, which is also
		 the TQObject's parent.
			@param pParent the parent and widget to watch for key strokes
			@param psName the name of the TQObject
			 		@short    Creates a new KAccel that watches <code>pParent</code>, which is also  the TQObject's parent.
	*/
	public KAccel(TQWidget pParent, String psName) {
		super((Class) null);
		newKAccel(pParent,psName);
	}
	private native void newKAccel(TQWidget pParent, String psName);
	public KAccel(TQWidget pParent) {
		super((Class) null);
		newKAccel(pParent);
	}
	private native void newKAccel(TQWidget pParent);
	/**	
		 Creates a new KAccel that watches <code>watch.</code>
			@param watch the widget to watch for key strokes
			@param parent the parent of the TQObject
			@param psName the name of the TQObject
			 		@short    Creates a new KAccel that watches <code>watch.</code>
	*/
	public KAccel(TQWidget watch, TQObject parent, String psName) {
		super((Class) null);
		newKAccel(watch,parent,psName);
	}
	private native void newKAccel(TQWidget watch, TQObject parent, String psName);
	public KAccel(TQWidget watch, TQObject parent) {
		super((Class) null);
		newKAccel(watch,parent);
	}
	private native void newKAccel(TQWidget watch, TQObject parent);
	/**	
			 Returns the KAccel's <code>KAccelActions</code>, a list of <code>KAccelAction.</code>
				@return the KAccelActions of the KAccel
	 
		@short
	*/
	public native KAccelActions actions();
	/**	
		 Checks whether the KAccel is active.
				@return true if the TQAccel is enabled
	 
		@short    Checks whether the KAccel is active.
	*/
	public native boolean isEnabled();
	/**	
		 Enables or disables the KAccel.
			@param bEnabled true to enable, false to disable
			 		@short    Enables or disables the KAccel.
	*/
	public native void setEnabled(boolean bEnabled);
	/**	
		 Enable auto-update of connections. This means that the signals
		 are automatically disconnected when you disable an action, and
		 re-enabled when you enable it. By default auto update is turned
		 on. If you disable auto-update, you need to call
		 updateConnections() after changing actions.
			@param bAuto true to enable, false to disable
				@return the value of the flag before this call
	 
		@short    Enable auto-update of connections.
	*/
	public native boolean setAutoUpdate(boolean bAuto);
	/**	
		 Create an accelerator action.
			 Usage:
		<pre>
		 insert( "Do Something", i18n("Do Something"),
		   i18n("This action allows you to do something really great with this program to "
		        "the currently open document."),
		   ALT+Key_D, this, SLOT("slotDoSomething()") );
		</pre>
			@param sAction The internal name of the action.
			@param sLabel An i18n'ized short description of the action displayed when
		  using KKeyChooser to reconfigure the shortcuts.
			@param sWhatsThis An extended description of the action.
			@param cutDef The default shortcut.
			@param pObjSlot Pointer to the slot object.
			@param psMethodSlot Pointer to the slot method.
			@param bConfigurable Allow the user to change this shortcut if set to 'true'.
			@param bEnabled The action will be activated by the shortcut if set to 'true'.
			 		@short    Create an accelerator action.
	*/
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable, boolean bEnabled);
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable);
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot);
	/**	
		 Same as first insert(), but with separate shortcuts defined for
		 3- and 4- modifier defaults.
			 		@short    Same as first insert(), but with separate shortcuts defined for  3- and 4- modifier defaults.
	*/
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef3, KShortcut cutDef4, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable, boolean bEnabled);
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef3, KShortcut cutDef4, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable);
	public native KAccelAction insert(String sAction, String sLabel, String sWhatsThis, KShortcut cutDef3, KShortcut cutDef4, TQObject pObjSlot, String psMethodSlot);
	/**	
		 This is an overloaded function provided for convenience.
		 The advantage of this is when you want to use the same text for the name
		 of the action as for the user-visible label.
			 Usage:
		 <pre>
		 insert( i18n("Do Something"), ALT+Key_D, this, SLOT("slotDoSomething()") );
		 </pre>
			@param psAction The name AND label of the action.
			@param cutDef The default shortcut for this action.
			@param pObjSlot Pointer to the slot object.
			@param psMethodSlot Pointer to the slot method.
			@param bConfigurable Allow the user to change this shortcut if set to 'true'.
			@param bEnabled The action will be activated by the shortcut if set to 'true'.
			 		@short    This is an overloaded function provided for convenience.
	*/
	public native KAccelAction insert(String psAction, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable, boolean bEnabled);
	public native KAccelAction insert(String psAction, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable);
	public native KAccelAction insert(String psAction, KShortcut cutDef, TQObject pObjSlot, String psMethodSlot);
	/**	
		 Similar to the first insert() method, but with the action
		 name, short description, help text, and default shortcuts all
		 set according to one of the standard accelerators.
				@short    Similar to the first insert() method, but with the action  name, short description, help text, and default shortcuts all  set according to one of the standard accelerators.
		@see KStdAccel#
	*/
	public native KAccelAction insert(int id, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable, boolean bEnabled);
	public native KAccelAction insert(int id, TQObject pObjSlot, String psMethodSlot, boolean bConfigurable);
	public native KAccelAction insert(int id, TQObject pObjSlot, String psMethodSlot);
	/**	
		 Removes the accelerator action identified by the name.
		 Remember to also call updateConnections().
			@param sAction the name of the action to remove
				@return true if successful, false otherwise
         
		@short    Removes the accelerator action identified by the name.
	*/
	public native boolean remove(String sAction);
	/**	
		 Updates the connections of the accelerations after changing them.
		 This is only necessary if you have disabled auto updates which are
		 on by default.
				@return true if successful, false otherwise

		@short    Updates the connections of the accelerations after changing them.
		@see #setAutoUpdate
		@see #getAutoUpdate
	*/
	public native boolean updateConnections();
	/**	
		 Return the shortcut associated with the action named by <code>sAction.</code>
			@param sAction the name of the action
				@return the action's shortcut, or a null shortcut if not found
	 
		@short    Return the shortcut associated with the action named by <code>sAction.</code>
	*/
	public native KShortcut shortcut(String sAction);
	/**	
		 Set the shortcut to be associated with the action named by <code>sAction.</code>
			@param sAction the name of the action
			@param shortcut the shortcut to set
				@return true if successful, false otherwise
	 
		@short    Set the shortcut to be associated with the action named by <code>sAction.</code>
	*/
	public native boolean setShortcut(String sAction, KShortcut shortcut);
	/**	
		 Set the slot to be called when the shortcut of the action named
		 by <code>sAction</code> is pressed.
			@param sAction the name of the action
			@param pObjSlot the owner of the slot
			@param psMethodSlot the name of the slot
				@return true if successful, false otherwise
	 
		@short    Set the slot to be called when the shortcut of the action named  by <code>sAction</code> is pressed.
	*/
	public native boolean setSlot(String sAction, TQObject pObjSlot, String psMethodSlot);
	/**	
		 Enable or disable the action named by <code>sAction.</code>
			@param sAction the action to en-/disable
			@param bEnabled true to enable, false to disable
				@return true if successful, false otherwise
	 
		@short    Enable or disable the action named by <code>sAction.</code>
	*/
	public native boolean setEnabled(String sAction, boolean bEnabled);
	/**	
		 Returns the configuration group of the settings.
				@return the configuration group

		@short    Returns the configuration group of the settings.
		@see KConfig
	*/
	public native String configGroup();
	/**	
		 Returns the configuration group of the settings.
			@param name the new configuration group
				@short    Returns the configuration group of the settings.
		@see KConfig
	*/
	public native void setConfigGroup(String name);
	/**	
		 Read all shortcuts from <code>pConfig</code>, or (if <code>pConfig</code>
		 is zero) from the application's configuration file
		 TDEGlobal.config().
			 The group in which the configuration is stored can be
		 set with setConfigGroup().
			@param pConfig the configuration file, or 0 for the application
		         configuration file
				@return true if successful, false otherwise
	 
		@short    Read all shortcuts from <code>pConfig</code>, or (if <code>pConfig</code>  is zero) from the application's configuration file  TDEGlobal.config().
	*/
	public native boolean readSettings(KConfigBase pConfig);
	public native boolean readSettings();
	/**	
		 Write the current shortcuts to <code>pConfig</code>,
		 or (if <code>pConfig</code> is zero) to the application's
		 configuration file.
			@param pConfig the configuration file, or 0 for the application
		         configuration file
				@return true if successful, false otherwise
	 
		@short    Write the current shortcuts to <code>pConfig</code>,  or (if <code>pConfig</code> is zero) to the application's  configuration file.
	*/
	public native boolean writeSettings(KConfigBase pConfig);
	public native boolean writeSettings();
	/**	
		 Emits the keycodeChanged() signal.
			 		@short    Emits the keycodeChanged() signal.
	*/
	public native void emitKeycodeChanged();
	/** 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();
}