summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KEditToolbarWidget.java
blob: 23fcaaa01c52fc2e6ab6f5c08c598f753319088a (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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.TQDomDocument;
import org.kde.qt.TQListViewItem;
import org.kde.qt.TQMetaObject;
import org.kde.qt.QtSupport;
import org.kde.qt.TQDropEvent;
import org.kde.qt.TQWidget;
import org.kde.qt.TQDomElement;
import org.kde.qt.TQWidget;

/**

 This is the widget that does all of the work for the
 KEditToolbar dialog.  In most cases, you will want to use the
 dialog instead of this widget directly.
 Typically, you would use this widget only if you wanted to embed
 the toolbar editing directly into your existing configure or
 preferences dialog.
 This widget only works if your application uses the XML UI
 framework for creating menus and toolbars.  It depends on the XML
 files to describe the toolbar layouts and it requires the actions
 to determine which buttons are active.
 See {@link KEditToolbarWidgetSignals} for signals emitted by KEditToolbarWidget
		@author Kurt Granroth <granroth@kde.org>

		@version $Id$
 
		@short A widget used to customize or configure toolbars.

*/
public class KEditToolbarWidget extends TQWidget implements KXMLGUIClientInterface {
	protected KEditToolbarWidget(Class dummy){super((Class) null);}
	public native TQMetaObject metaObject();
	public native String className();
	/**	
		 Constructor.  This is the only entry point to this class.  You
		 <code>must</code> pass along your collection of actions (some of which
		 appear in your toolbars).  The other three parameters are
		 optional.
			 The second parameter, xmlfile, is the name (absolute or
		 relative) of your application's UI resource file.  If it is
		 left blank, then the resource file: share/apps/appname/appnameui.rc
		 is used.  This is the same resource file that is used by the
		 default createGUI function in KMainWindow so you're usually
		 pretty safe in leaving it blank.
			 The third parameter, global, controls whether or not the
		 global resource file is used.  If this is true, then you may
		 edit all of the actions in your toolbars -- global ones and
		 local one.  If it is false, then you may edit only your
		 application's entries.  The only time you should set this to
		 false is if your application does not use the global resource
		 file at all (very rare)
			 The last parameter, parent, is the standard parent stuff.
			@param collection The collection of actions to work on
			@param xmlfile The application's local resource file
			@param global If true, then the global resource file will also
		               be parsed
			@param parent This widget's parent
		   		@short    Constructor.
	*/
	public KEditToolbarWidget(KActionCollection collection, String xmlfile, boolean global, TQWidget parent) {
		super((Class) null);
		newKEditToolbarWidget(collection,xmlfile,global,parent);
	}
	private native void newKEditToolbarWidget(KActionCollection collection, String xmlfile, boolean global, TQWidget parent);
	public KEditToolbarWidget(KActionCollection collection, String xmlfile, boolean global) {
		super((Class) null);
		newKEditToolbarWidget(collection,xmlfile,global);
	}
	private native void newKEditToolbarWidget(KActionCollection collection, String xmlfile, boolean global);
	public KEditToolbarWidget(KActionCollection collection, String xmlfile) {
		super((Class) null);
		newKEditToolbarWidget(collection,xmlfile);
	}
	private native void newKEditToolbarWidget(KActionCollection collection, String xmlfile);
	public KEditToolbarWidget(KActionCollection collection) {
		super((Class) null);
		newKEditToolbarWidget(collection);
	}
	private native void newKEditToolbarWidget(KActionCollection collection);
	public KEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file, boolean global, TQWidget parent) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,collection,file,global,parent);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file, boolean global, TQWidget parent);
	public KEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file, boolean global) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,collection,file,global);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file, boolean global);
	public KEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,collection,file);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KActionCollection collection, String file);
	public KEditToolbarWidget(String defaultToolbar, KActionCollection collection) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,collection);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KActionCollection collection);
	/**	
		 Constructor for KParts based apps.
			 The first parameter, factory, is a pointer to the XML GUI
		 factory object for your application.  It contains a list of all
		 of the GUI clients (along with the action collections and xml
		 files) and the toolbar editor uses that.
			 The second parameter, parent, is the standard parent
			 Use this like so:
		 <pre>
		 KEditToolbar edit(factory());
		 if ( edit.exec() )
		 ...
		 </pre>
			@param factory Your application's factory object
			@param parent This widget's parent
		   		@short    Constructor for KParts based apps.
	*/
	public KEditToolbarWidget(KXMLGUIFactory factory, TQWidget parent) {
		super((Class) null);
		newKEditToolbarWidget(factory,parent);
	}
	private native void newKEditToolbarWidget(KXMLGUIFactory factory, TQWidget parent);
	public KEditToolbarWidget(KXMLGUIFactory factory) {
		super((Class) null);
		newKEditToolbarWidget(factory);
	}
	private native void newKEditToolbarWidget(KXMLGUIFactory factory);
	public KEditToolbarWidget(String defaultToolbar, KXMLGUIFactory factory, TQWidget parent) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,factory,parent);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KXMLGUIFactory factory, TQWidget parent);
	public KEditToolbarWidget(String defaultToolbar, KXMLGUIFactory factory) {
		super((Class) null);
		newKEditToolbarWidget(defaultToolbar,factory);
	}
	private native void newKEditToolbarWidget(String defaultToolbar, KXMLGUIFactory factory);
	/**	
			   		@short
	*/
	public native KActionCollection actionCollection();
	/**	
		 Save any changes the user made.  The file will be in the user's
		 local directory (usually $HOME/.trinity/share/apps/\<appname\>).  The
		 filename will be the one specified in the constructor.. or the
		 made up one if the filename was NULL.
				@return The status of whether or not the save succeeded.
   
		@short    Save any changes the user made.
	*/
	public native boolean save();
	/**	
		 Remove and readd all KMXLGUIClients to update the GUI
				@short    Remove and readd all KMXLGUIClients to update the GUI
	*/
	public native void rebuildKXMLGUIClients();
	protected native void setupLayout();
	// void insertActive(ToolbarItem* arg1,TQListViewItem* arg2,bool arg3); >>>> NOT CONVERTED
	// void insertActive(ToolbarItem* arg1,TQListViewItem* arg2); >>>> NOT CONVERTED
	// void removeActive(ToolbarItem* arg1); >>>> NOT CONVERTED
	// void moveActive(ToolbarItem* arg1,TQListViewItem* arg2); >>>> NOT CONVERTED
	protected native void initNonKPart(KActionCollection collection, String file, boolean global);
	protected native void initKPart(KXMLGUIFactory factory);
	protected native void loadToolbarCombo(String defaultToolbar);
	protected native void loadToolbarCombo();
	protected native void loadActionList(TQDomElement elem);
	protected native void updateLocal(TQDomElement elem);
	protected native void slotToolbarSelected(String text);
	protected native void slotInactiveSelected(TQListViewItem item);
	protected native void slotActiveSelected(TQListViewItem item);
	protected native void slotDropped(KListView list, TQDropEvent e, TQListViewItem after);
	protected native void slotInsertButton();
	protected native void slotRemoveButton();
	protected native void slotUpButton();
	protected native void slotDownButton();
	protected native void slotChangeIcon();
	/** 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();
	/**	
		 Retrieves an action of the client by name.  If not found, it looks in its child clients.
		 This method is provided for convenience, as it uses actionCollection()
		 to get the action object.
		   		@short    Retrieves an action of the client by name.
	*/
	public native KAction action(String name);
	/**	
		 Retrieves an action for a given TQDomElement. The default
		 implementation uses the "name" attribute to query the action
		 object via the other action() method.
		   		@short    Retrieves an action for a given TQDomElement.
	*/
	public native KAction action(TQDomElement element);
	/**	
				@return The instance ( KInstance ) for this GUI client.
   
		@short
	*/
	public native KInstanceInterface instance();
	/**	
				@return The parsed XML in a TQDomDocument, set by
 setXMLFile() or setXML().
 This document describes the layout of the GUI.
   
		@short
	*/
	public native TQDomDocument domDocument();
	/**	
		 This will return the name of the XML file as set by setXMLFile().
		 If setXML() is used directly, then this will return NULL.
			 The filename that this returns is obvious for components as each
		 component has exactly one XML file.  In non-components, however,
		 there are usually two: the global file and the local file.  This
		 function doesn't really care about that, though.  It will always
		 return the last XML file set.  This, in almost all cases, will
		 be the local XML file.
				@return The name of the XML file or null
   
		@short    This will return the name of the XML file as set by setXMLFile().
	*/
	public native String xmlFile();
	public native String localXMLFile();
	/**	
			   		@short
	*/
	public native void setXMLGUIBuildDocument(TQDomDocument doc);
	/**	
			   		@short
	*/
	public native TQDomDocument xmlguiBuildDocument();
	/**	
		 This method is called by the KXMLGUIFactory as soon as the client
		 is added to the KXMLGUIFactory's GUI.
		   		@short    This method is called by the KXMLGUIFactory as soon as the client  is added to the KXMLGUIFactory's GUI.
	*/
	public native void setFactory(KXMLGUIFactory factory);
	/**	
		 Retrieves a pointer to the KXMLGUIFactory this client is
		 associated with (will return null if the client's GUI has not been built
		 by a KXMLGUIFactory.
		   		@short    Retrieves a pointer to the KXMLGUIFactory this client is  associated with (will return 0L if the client's GUI has not been built  by a KXMLGUIFactory.
	*/
	public native KXMLGUIFactory factory();
	/**	
		 KXMLGUIClients can form a simple child/parent object tree. This
		 method returns a pointer to the parent client or null if it has no
		 parent client assigned.
		   		@short    KXMLGUIClients can form a simple child/parent object tree.
	*/
	public native KXMLGUIClientInterface parentClient();
	/**	
		 Use this method to make a client a child client of another client.
		 Usually you don't need to call this method, as it is called
		 automatically when using the second constructor, which takes a
		 parent argument.
		   		@short    Use this method to make a client a child client of another client.
	*/
	public native void insertChildClient(KXMLGUIClientInterface child);
	/**	
		 Removes the given <code>child</code> from the client's children list.
		   		@short    Removes the given <code>child</code> from the client's children list.
	*/
	public native void removeChildClient(KXMLGUIClientInterface child);
	/**	
		 Retrieves a list of all child clients.
		   		@short    Retrieves a list of all child clients.
	*/
	// const TQPtrList<KXMLGUIClient>* childClients(); >>>> NOT CONVERTED
	/**	
		 A client can have an own KXMLGUIBuilder.
		 Use this method to assign your builder instance to the client (so that the
		 KXMLGUIFactory can use it when building the client's GUI)
			 Client specific guibuilders are useful if you want to create
		 custom container widgets for your GUI.
		   		@short    A client can have an own KXMLGUIBuilder.
	*/
	public native void setClientBuilder(KXMLGUIBuilderInterface builder);
	/**	
		 Retrieves the client's GUI builder or null if no client specific
		 builder has been assigned via setClientBuilder()
		   		@short    Retrieves the client's GUI builder or 0L if no client specific  builder has been assigned via setClientBuilder()
	*/
	public native KXMLGUIBuilderInterface clientBuilder();
	/**	
		 Forces this client to re-read its XML resource file.  This is
		 intended to be used when you know that the resource file has
		 changed and you will soon be rebuilding the GUI.  It has no
		 useful effect with non-KParts GUIs, so don't bother using it
		 unless your app is component based.
		   		@short    Forces this client to re-read its XML resource file.
	*/
	public native void reloadXML();
	/**	
		 ActionLists are a way for XMLGUI to support dynamic lists of
		 actions.  E.g. if you are writing a file manager, and there is a
		 menu file whose contents depend on the mimetype of the file that
		 is selected, then you can achieve this using ActionLists. It
		 works as follows:
		 In your xxxui.rc file ( the one that you set in setXMLFile()
		 ), you put an <p>\<ActionList name="xxx"\></p> tag.  E.g.
		 <pre>
		 <kpartgui name="xxx_part" version="1">
		 <MenuBar>
		   <Menu name="file">
		     ...  <!-- some useful actions-.
		     <ActionList name="xxx_file_actionlist" />
		     ...  <!-- even more useful actions-.
		   </Menu>
		   ...
		 </MenuBar>
		 </kpartgui>
		 </pre>
			 This tag will get expanded to a list of actions.  In the example
		 above ( a file manager with a dynamic file menu ), you would call
		 <pre>
		 TQPtrList<KAction> file_actions;
		 for( ... )
		   if( ... )
		     file_actions.append( cool_action );
		 unplugActionList( "xxx_file_actionlist" );
		 plugActionList( "xxx_file_actionlist", file_actions );
		 </pre>
		 every time a file is selected, unselected or ...
			 <b>Note:<> You should not call createGUI() after calling this
		       function.  In fact, that would remove the newly added
		       actionlists again...
		 <b>Note:<> Forgetting to call unplugActionList() before
		       plugActionList() would leave the previous actions in the
		       menu too..
		   		@short    ActionLists are a way for XMLGUI to support dynamic lists of  actions.
	*/
	// void plugActionList(const TQString& arg1,const TQPtrList<KAction>& arg2); >>>> NOT CONVERTED
	/**	
		 The complement of plugActionList() ...
		   		@short    The complement of plugActionList() .
	*/
	public native void unplugActionList(String name);
	public native void addStateActionEnabled(String state, String action);
	public native void addStateActionDisabled(String state, String action);
	// KXMLGUIClient::StateChange getActionsToChangeForState(const TQString& arg1); >>>> NOT CONVERTED
	public native void beginXMLPlug(TQWidget arg1);
	public native void endXMLPlug();
	public native void prepareXMLUnplug(TQWidget arg1);
	public static native String findMostRecentXMLFile(String[] files, StringBuffer doc);
	/**	
		 Sets the instance ( KInstance) for this part.
			 Call this first in the inherited class constructor.
		 (At least before setXMLFile().)
		   		@short    Sets the instance ( KInstance) for this part.
	*/
	protected native void setInstance(KInstanceInterface instance);
	/**	
		 Sets the name of the rc file containing the XML for the part.
			 Call this in the Part-inherited class constructor.
			@param file Either an absolute path for the file, or simply the
		             filename, which will then be assumed to be installed
		             in the "data" resource, under a directory named like
		             the instance.
			@param merge Whether to merge with the global document.
			@param setXMLDoc Specify whether to call setXML. Default is true.
		               and the DOM document at once.
				@short    Sets the name of the rc file containing the XML for the part.
	*/
	protected native void setXMLFile(String file, boolean merge, boolean setXMLDoc);
	protected native void setXMLFile(String file, boolean merge);
	protected native void setXMLFile(String file);
	protected native void setLocalXMLFile(String file);
	/**	
		 Sets the XML for the part.
			 Call this in the Part-inherited class constructor if you
		  don't call setXMLFile().
				@short    Sets the XML for the part.
	*/
	protected native void setXML(String document, boolean merge);
	protected native void setXML(String document);
	/**	
		 Sets the Document for the part, describing the layout of the GUI.
			 Call this in the Part-inherited class constructor if you don't call
		 setXMLFile or setXML .
		   		@short    Sets the Document for the part, describing the layout of the GUI.
	*/
	protected native void setDOMDocument(TQDomDocument document, boolean merge);
	protected native void setDOMDocument(TQDomDocument document);
	/**	
		 This function will attempt to give up some memory after the GUI
		 is built.  It should never be used in apps where the GUI may be
		 rebuilt at some later time (components, for instance).
		   		@short    This function will attempt to give up some memory after the GUI  is built.
	*/
	protected native void conserveMemory();
	/**	
		 Actions can collectively be assigned a "State". To accomplish this
		 the respective actions are tagged as \<enable\> or \<disable\> in
		 a \<State\> \</State\> group of the XMLfile. During program execution the
		 programmer can call stateChanged() to set actions to a defined state.
			@param newstate Name of a State in the XMLfile.
			@param reverse If the flag reverse is set to StateReverse, the State is reversed.
		 (actions to be enabled will be disabled and action to be disabled will be enabled)
		 Default is reverse=false.
		   		@short    Actions can collectively be assigned a "State".
	*/
	protected native void stateChanged(String newstate, int reverse);
	protected native void stateChanged(String newstate);
}