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