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