source: trunk/desktop/idl/wpobject.idl@ 291

Last change on this file since 291 was 291, checked in by cinc, 18 years ago

Migrated to new IDL compiler. Metaclasses are still missing.

File size: 15.8 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2* Version: CDDL 1.0/LGPL 2.1
3*
4* The contents of this file are subject to the COMMON DEVELOPMENT AND
5* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6* this file except in compliance with the License. You may obtain a copy of
7* the License at http://www.sun.com/cddl/
8*
9* Software distributed under the License is distributed on an "AS IS" basis,
10* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11* for the specific language governing rights and limitations under the
12* License.
13*
14* The Original Code is "NOM" Netlabs Object Model
15*
16* The Initial Developer of the Original Code is
17* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
18* Portions created by the Initial Developer are Copyright (C) 2005-2007
19* the Initial Developer. All Rights Reserved.
20*
21* Contributor(s):
22*
23* Alternatively, the contents of this file may be used under the terms of
24* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
25* case the provisions of the LGPL are applicable instead of those above. If
26* you wish to allow use of your version of this file only under the terms of
27* the LGPL, and not to allow others to use your version of this file under
28* the terms of the CDDL, indicate your decision by deleting the provisions
29* above and replace them with the notice and other provisions required by the
30* LGPL. If you do not delete the provisions above, a recipient may use your
31* version of this file under the terms of any one of the CDDL or the LGPL.
32*
33* ***** END LICENSE BLOCK ***** */
34
35#ifndef WPOBJECT_IDL_INCLUDED
36#define WPOBJECT_IDL_INCLUDED
37
38#include <nomobj.idl>
39
40/** \file wpobject.idl
41
42*/
43NOMCLASSNAME(WPObject);
44
45#include "wpnativetypes.idl"
46#include "nomstring.idl"
47#include "nommenu.idl"
48#include "nommenuitem.idl"
49#include "nomwindow.idl"
50
51#ifdef __NOM_IDL_COMPILER__
52interface WPFolderWindow;
53#else
54#ifndef WPFLDRWINDOW_IDL_INCLUDED
55native PWPFolderWindow;
56#endif
57#endif
58
59#ifdef __NOM_IDL_COMPILER__
60interface WPFolder;
61#else
62#ifndef WPFOLDER_IDL_INCLUDED
63native PWPFolder;
64#endif
65#endif
66
67#ifdef __NOM_IDL_COMPILER__
68interface WPNoteBook;
69#else
70#if 1
71#ifndef WPNOTEBOOK_IDL_INCLUDED
72native PWPNoteBook;
73#endif
74#else
75#include "wpnotebook.idl"
76#endif
77#endif
78
79NOMMETACLASS(M_WPObject);
80
81/** \interface WPObject
82
83 This is the root of all desktop classes.
84 */
85interface WPObject : NOMObject
86{
87#ifdef __NOM_IDL_COMPILER__
88 metaclass=M_WPObject;
89 filestem=wpobject;
90#endif
91 NOMCLASSVERSION(1, 0);
92
93 /* Memory allocation */
94 /**
95 Allocate a block of \e cbBytes length. The storage area
96 is tracked in the objects inuse list.
97
98 \par How to override:
99 This method is usually not overriden.
100
101 \param cbBytes Number of bytes to allocate.
102 \param prc Pointer to a gulong which will hold an error code if the method fails.
103 \return A pointer to the block of memory
104
105 \sa wpFreeMem()
106 */
107 gpointer wpAllocMem(in gulong cbBytes,
108 in pgulong prc);
109 /**
110 Free a block of memory. The method removes the memory block from the objects inuse
111 list. Because NOM uses a garbage collector the memory isn't freed instantly but
112 will be collected later.
113
114 \remark It is save to call this method with a NULL memory pointer.
115
116 \par How to override:
117 This method is usually not overriden.
118
119 \param pByte Block of memory to be freed. This may be NULL.
120 \return TRUE if successful.
121
122 \sa wpAllocMem()
123 */
124 boolean wpFreeMem(in gpointer pByte);
125
126 /**
127 Method to be overriden by classes when they need to do some setup.
128
129 \remark Desktop classes should override this method instead of nomInit().
130
131 \par How to override:
132 This method should be overriden by classes which need initialization. The parent
133 must be called first.
134
135 \sa wpUnInitData()
136 */
137 void wpInitData();
138
139 /**
140 Method to be overriden by classes when they need to do some unititialization work.
141
142 \remark Desktop classes should override this method instead of nomUnInit().
143
144 \par How to override
145 This method should be overriden by classes which need uninitialization. The parent must
146 be called last.
147
148 \sa wpInitData()
149 */
150 void wpUnInitData();
151
152 /**
153 This method always opens a new view of an object. The concurrent view setting is not
154 taken into account. wpViewObject() should be called most of the time.
155
156 \par How to override:
157 Desktop objects override this method when they have a private view.
158
159 \param nomFolder The folder view (window) containing the object. Note that an object may
160 live in different folder windows at the same time.
161 \param ulView The view to be opened.
162 \param nameSpaceId See menu handling for more information.
163 \param pParam Reserved and must be set to NULL.
164 \return A pointer to the view.
165
166 \sa wpViewObject()
167 */
168 gpointer wpOpen(in PWPFolderWindow nomFolder, in gulong ulView, in nomId nameSpaceId, in gpointer pParam);
169
170 /**
171 Increase the use counter of the object.
172
173 \remark The increment operation on the internal counter is an atomic operation but be aware
174 that the method call itself is not.
175
176 \par How to override:
177 This method is usually not overriden.
178
179 \sa wpObjectIsLocked(), wpUnlockObject()
180 */
181 void wpLockObject();
182
183 /**
184 Decrease the use counter of the object.
185
186 \remark When the use counter of an object reaches 0 the object will be destroyed.
187 The decrement operation on the internal counter is an atomic operation but be aware
188 that the method call itself is not.
189
190 \par How to override:
191 This method is usually not overriden.
192
193 \sa wpObjectIsLocked(), wpLockObject()
194 */
195 boolean wpUnlockObject();
196
197 /**
198 Query if the object is in use.
199
200 \remark This method reflects the state of the object at the time of the call. Note that
201 in a multithreaded environment other threads may alter the use counter at any time.
202
203 \par How to override:
204 This method is usually not overriden.
205
206 \return TRUE if the objects use counter is greater than 0. This means the object is still in use.
207
208 \sa wpLockObject(), wpUnlockObject()
209 */
210 boolean wpObjectIsLocked();
211 gpointer wpQueryIcon();
212
213 /**
214 Request the object semaphor which protects the objects data structures. For example
215 before changing the in use list of the object the semaphor is aquired to prevent
216 access from several places at the same time.
217
218 \par How to override
219 This method is usually not overriden.
220
221 \return 0 if no error occured. Any other value describes an error.
222
223 \sa wpReleaseObjectMutexSem()
224 */
225 unsigned long wpRequestObjectMutexSem(in unsigned long ulReserved);
226
227 /**
228 Release the object semaphor which protects the objects data structures. For example
229 before changing the in use list of the object the semaphor is aquired to prevent
230 access from several places at the same time.
231
232 \par How to override:
233 This method is usually not overriden.
234
235 \return 0 if no error occured. Any other value describes an error.
236
237 \sa wpRequestObjectMutexSem()
238 */
239 unsigned long wpReleaseObjectMutexSem();
240
241 void wpSetTitle(in PNOMString pnomStrNewTitle);
242 PNOMString wpQueryTitle();
243
244 PNOMMenu wpDisplayMenu(in PWPFolderWindow nomFolder, in gpointer gReserved, in unsigned long ulMenuType,
245 in unsigned long ulReserved);
246 void wpModifyMenu(in PWPFolderWindow nomFolder, in PNOMMenu nomMenu, in unsigned long ulMenuType);
247 void wpFilterMenu(in PWPFolderWindow nomFolder, in PNOMMenu nomMenu, in unsigned long ulMenuType,
248 in unsigned long ulFlags);
249 boolean wpMenuItemSelected(in PWPFolderWindow nomFolder, in PNOMMenuItem nomMenuItem);
250 void wpInsertMenuItem( in PNOMMenu nomMenu, in PNOMMenuItem nomMenuItem, in unsigned long ulPosition);
251
252 /* Settings pages */
253 boolean wpAddSettingsPages(in PWPNoteBook wpNoteBook);
254 unsigned long wpInsertSettingsPage(in PWPNoteBook wpNoteBook, in gpointer ppageinfo);
255 unsigned long wpAddObjectGeneralPage(in PWPNoteBook wpNoteBook);
256
257 /**
258 This method either resurfaces an existing view or creates a new view according to the
259 objects concurrent view setting.
260
261 If concurrent view is set to \e No the objects inuse list is searched for an existing
262 view of the kind being requested. If found the view is brought to the front. If concurrent
263 view setting is \e yes or no view can be found wpOpen() is called to create a new view.
264
265 \remark This method should be use in preference to the wpOpen() method.
266
267 \par How to override:
268 This method is usually not overriden.
269
270 \param nomFolder The folder view (window) containing the object. Note that an object may
271 live in different folder windows at the same time.
272 \param ulView The view to be opened.
273 \param nameSpaceId See menu handling for more information.
274 \param pParam Reserved and must be set to NULL.
275 \return A pointer to the view.
276
277 \sa wpOpen(), wpSwitchTo()
278 */
279 gpointer wpViewObject(in PWPFolderWindow nomFolder, in gulong ulView, in nomId nameSpaceId, in gpointer pParam);
280
281 /**
282 Search the objects inuse list for the given view and if found bring it to the front.
283
284 \par How to override:
285 This method is usually not overriden.
286
287 \param ulView The view to be opened.
288 \param nameSpaceId See menu handling for more information.
289 \return A pointer to the view or NULL if no view exists.
290
291 \sa wpViewObject()
292 */
293 gpointer wpSwitchTo(in gulong ulView, in nomId nameSpaceId);
294 boolean wpRegisterView(in PNOMWindow pWindow, in PNOMString nomStrViewTitle);
295
296 /* ---- Inuse list methods ---- */
297
298 /**
299 Register an inuse item in the objects inuse list. Inuse items may describe blocks of
300 memory used by the object, open views and some more.
301
302 \par How to override:
303 This method is usually not overriden.
304
305
306 \return TRUE if success.
307
308 \sa wpDeleteFromObjUseList(), wpFindUseItem(), wpFindViewItem()
309 */
310 boolean wpAddToObjUseList(in PUSEITEM pUseItem);
311
312 /**
313 Remove an inuse item from the objects inuse list. Inuse items may describe blocks of
314 memory used by the object, open views and some more.
315
316 \remark The use item will not be freed by this method. This must be done by the caller.
317
318 \par How to override:
319 This method is usually not overriden.
320
321 \param pUseItem Use item to be removed from the objects inuse list.
322 \return TRUE if success.
323
324 \sa wpAddToObjUseList(), wpFindUseItem(), wpFindViewItem()
325 */
326 boolean wpDeleteFromObjUseList(in PUSEITEM pUseItem);
327
328 /**
329 Find a useitem previously registerd using wpAddToObjUseList().
330
331 \param ulType The type of the useitem e.g. USAGE_MEMORY.
332 \param pCurrentItem If set to NULL the first item is returned. When set
333 to a useitem pointer the next matching useitem is searched.
334
335 \return A pointer to a useitem or NULL if no matchin item can be found.
336
337 \sa wpAddToObjUseList(), wpDeleteFromObjUseList(), wpFindViewItem()
338 */
339 PUSEITEM wpFindUseItem( in gulong ulType, in PUSEITEM pCurrentUseItem);
340
341 PVIEWITEM wpFindViewItem( in gulong ulView, in nomId nameSpaceId, in PVIEWITEM pCurrentItem);
342
343 boolean wpSaveDeferred();
344 boolean wpSaveImmediate();
345
346 /**
347 Set the information about the folder this object is living in. This method is called for
348 example if the object is moved to another location.
349
350 \par How to override:
351 This method is usually not overriden.
352
353 \param wpParentFolder The folder this object is living in.
354 \return Folder object. Note that this is not a folder view (window).
355
356 \sa wpQueryFolder()
357 */
358 void wpSetFolder(in PWPFolder wpParentFolder);
359
360 /**
361 Get the folder this object is living in.
362
363 \par How to override:
364 This method is usually not overriden.
365
366 \return Folder object. Note that this is not a folder view (window).
367
368 \sa wpSetFolder()
369 */
370 PWPFolder wpQueryFolder();
371
372 void wpSetTitleFromCString(in string chrNewTitle);
373
374 gulong wpQueryDefaultView(in pnomId pNameSpaceId);
375 boolean wpSetDefaultView(in gulong ulView , in nomId nameSpaceId);
376
377 void wpSetConcurrentView(in gulong ulCCView);
378 gulong wpQueryConcurrentView();
379
380 gulong wpDragOver(in gpointer containerHandle, in gpointer pDragInfo);
381
382 gulong wpDrop(in gpointer containerHandle, in gpointer pDragInfo);
383
384 /**
385 Move an object to a new location.
386
387 \remark This method removes the object from the content list of the
388 source folder and inserts it into the list of the target folder using
389 wpDeleteFromContent() and wpAddToContent(). The same is done for the stores
390 held by the source and target folders.
391 Note that this method must be overriden by subclasses to actually perform
392 any moving of files.
393
394 \par How to override:
395 This method is overriden by classes which need special processing when
396 objects are moved. The parent method must be called last.
397
398 \param wpTargetFolder The new folder into which the object will be moved.
399 If this is not a valid object FALSE is returned.
400
401 \return TRUE when success.
402
403 \sa wpCopyObject()
404 */
405 boolean wpMoveObject(in PWPFolder wpTargetFolder);
406
407 /**
408 Copy an object to a new location.
409
410 \par How to override:
411 This method is overriden by classes which need special processing when
412 objects are copied. An override can also be used to keep track of created
413 objects.
414
415 \param wpTargetFolder The new folder into which the object will be moved.
416 \param fLock If set TRUE the created object will be locked after creation.
417 A call to wpUnlockObject() is necessary so the object can go dormant. If
418 set to FALSE the object will be made dormant if the object is no longer used
419 and the folder containing it is closed.
420
421 \return TRUE when success.
422
423 \sa wpMoveObject()
424 */
425
426 PWPObject wpCopyObject(in PWPFolder wpTargetFolder, in boolean fLock);
427
428 /* Methods overriden by this class */
429
430 /**
431 Override of nomInit(). The object semaphore for serializing access to
432 objects data is created here. After setting it up wpInitData() is called.
433 This method should be overriden by desktop classes instead of nomInit().
434 */
435 NOMOVERRIDE(nomInit);
436
437 /**
438 Override of nomUnInit(). First wpUnitData() is called on the object. Note
439 that desktop classes should override wpUnInitData() instead of nomUnInit.
440
441 After destroying the object semaphor nomUnInit() is called.
442
443 \remark This override will put any desktop object on the list of objects with
444 finalizers.
445 */
446 NOMOVERRIDE(nomUnInit);
447
448 /* Instancce variables of this class. Theses are not
449 attributes. */
450 /**
451 Object lock counter instance variable. This variable is private and can't be accessed
452 from the outside.
453
454 \sa wpObjectIsLocked(), wpLockObject(), wpUnlockObject()
455 */
456 NOMINSTANCEVAR(gint iLockCounter);
457
458 /**
459 Object semaphor. This variable is private and can't be accessed
460 from the outside.
461
462 \sa wpRequestObjectMutexSem(), wpReleaseObjectMutexSem()
463 */
464 NOMINSTANCEVAR(HMUX gObjectMutex);
465 NOMINSTANCEVAR(PGSList glstObjectInUse);
466 NOMINSTANCEVAR(PNOMString pnomStringTitle);
467 /**
468 This instance variable holds the pointer to the folder containing this
469 object.
470
471 \remarks This variable may be accessed using wpQueryFolder() and wpSetFolder()
472
473 \sa wpQueryFolder(), wpSetFolder()
474 */
475 NOMINSTANCEVAR(PWPFolder wpParentFldr);
476};
477
478#endif /* WPOBJECT_IDL_INCLUDED */
479
480
481
482
483
Note: See TracBrowser for help on using the repository browser.