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

Last change on this file since 224 was 224, checked in by cinc, 19 years ago

Added doxygen documentation.

File size: 11.6 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-2006
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
40NOMCLASSNAME(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
49native PWPFolderWindow;
50#endif
51
52#ifndef WPFOLDER_IDL_INCLUDED
53native PWPFolder;
54#endif
55
56#if 1
57#ifndef WPNOTEBOOK_IDL_INCLUDED
58native PWPNoteBook;
59#endif
60#else
61#include "wpnotebook.idl"
62#endif
63
64NOMMETACLASS(M_WPObject);
65
66interface 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
190 */
191 unsigned long wpRequestObjectMutexSem(in unsigned long ulReserved);
192 unsigned long wpReleaseObjectMutexSem();
193
194 void wpSetTitle(in PNOMString pnomStrNewTitle);
195 PNOMString wpQueryTitle();
196
197 PNOMMenu wpDisplayMenu(in PWPFolderWindow nomFolder, in gpointer gReserved, in unsigned long ulMenuType,
198 in unsigned long ulReserved);
199 void wpModifyMenu(in PWPFolderWindow nomFolder, in PNOMMenu nomMenu, in unsigned long ulMenuType);
200 void wpFilterMenu(in PWPFolderWindow nomFolder, in PNOMMenu nomMenu, in unsigned long ulMenuType,
201 in unsigned long ulFlags);
202 boolean wpMenuItemSelected(in PWPFolderWindow nomFolder, in PNOMMenuItem nomMenuItem);
203 void wpInsertMenuItem( in PNOMMenu nomMenu, in PNOMMenuItem nomMenuItem, in unsigned long ulPosition);
204
205 /* Settings pages */
206 boolean wpAddSettingsPages(in PWPNoteBook wpNoteBook);
207 unsigned long wpInsertSettingsPage(in PWPNoteBook wpNoteBook, in gpointer ppageinfo);
208 unsigned long wpAddObjectGeneralPage(in PWPNoteBook wpNoteBook);
209
210 /**
211 This method either resurfaces an existing view or creates a new view according to the
212 objects concurrent view setting.
213
214 If concurrent view is set to \e No the objects inuse list is searched for an existing
215 view of the kind being requested. If found the view is brought to the front. If concurrent
216 view setting is \e yes or no view can be found wpOpen() is called to create a new view.
217
218 \remark This method should be use in preference to the wpOpen() method.
219
220 \par How to override
221 This method is usually not overriden.
222
223 \param nomFolder The folder view (window) containing the object. Note that an object may
224 live in different folder windows at the same time.
225 \param ulView The view to be opened.
226 \param nameSpaceId See menu handling for more information.
227 \param pParam Reserved and must be set to NULL.
228 \return A pointer to the view.
229
230 \sa wpOpen(), wpSwitchTo()
231 */
232 gpointer wpViewObject(in PWPFolderWindow nomFolder, in gulong ulView, in nomId nameSpaceId, in gpointer pParam);
233
234 /**
235 Search the objects inuse list for the given view and if found bring it to the front.
236
237 \par How to override
238 This method is usually not overriden.
239
240 \param ulView The view to be opened.
241 \param nameSpaceId See menu handling for more information.
242 \return A pointer to the view or NULL if no view exists.
243
244 \sa wpViewObject()
245 */
246 gpointer wpSwitchTo(in gulong ulView, in nomId nameSpaceId);
247 boolean wpRegisterView(in PNOMWindow pWindow, in PNOMString nomStrViewTitle);
248
249 /* ---- Inuse list methods ---- */
250
251 /**
252 Register an inuse item in the objects inuse list. Inuse items may describe blocks of
253 memory used by the object, open views and some more.
254
255 \How to override
256 This method is usually not overriden.
257
258 \param
259 \return TRUE if success.
260
261 \sa wpDeleteFromObjUseList(), wpFindUseItem(), wpFindViewItem()
262 */
263 boolean wpAddToObjUseList(in PUSEITEM pUseItem);
264
265 /**
266 Remove an inuse item from the objects inuse list. Inuse items may describe blocks of
267 memory used by the object, open views and some more.
268
269 \remark The use item will not be freed by this method.
270
271 \par How to override
272 This method is usually not overriden.
273
274 \param pUseItem Use item to be removed from the objects inuse list.
275 \return TRUE if success.
276
277 \sa wpAddToObjUseList(), wpFindUseItem(), wpFindViewItem()
278 */
279 boolean wpDeleteFromObjUseList(in PUSEITEM pUseItem);
280
281 /**
282 \sa wpAddToObjUseList(), wpDeleteFromObjUseList(), wpFindViewItem()
283 */
284 PUSEITEM wpFindUseItem( in gulong ulType, in PUSEITEM pCurrentUseItem);
285 PVIEWITEM wpFindViewItem( in gulong ulView, in nomId nameSpaceId, in PVIEWITEM pCurrentItem);
286
287 boolean wpSaveDeferred();
288 boolean wpSaveImmediate();
289
290 void wpSetFolder(in PWPFolder wpParentFolder);
291
292 /**
293 Get the folder this object is living in.
294
295 \return Folder object. Note that this is not a folder view (window)
296
297 \sa wpSetFolder()
298 */
299 PWPFolder wpQueryFolder();
300
301 void wpSetTitleFromCString(in string chrNewTitle);
302
303 gulong wpQueryDefaultView(in pnomId pNameSpaceId);
304 boolean wpSetDefaultView(in gulong ulView , in nomId nameSpaceId);
305
306 void wpSetConcurrentView(in gulong ulCCView);
307 gulong wpQueryConcurrentView();
308
309 /* Methods overriden by this class */
310
311 /**
312 Override of nomInit(). The object semaphore for serializing access to
313 objects data is created here. After setting it up wpInitData() is called.
314 This method should be overriden by desktop classes instead of nomInit().
315 */
316 NOMOVERRIDE(nomInit);
317
318 /**
319 Override of nomUnInit(). First wpUnitData() is called on the object. Note
320 that desktop classes should override wpUnInitData() instead of nomUnInit.
321
322 After destroying the object semaphor nomUnInit() is called.
323
324 \remark This override will put any desktop object on the list of objects with
325 finalizers.
326 */
327 NOMOVERRIDE(nomUnInit);
328
329 /* Instancce variables of this class. Theses are not
330 attributes. */
331 /**
332 Object lock counter instance variable. This variable is private and can't be accessed
333 from the outside.
334
335 \sa wpObjectIsLocked(), wpLockObject(), wpUnlockObject()
336 */
337 NOMINSTANCEVAR(gint iLockCounter);
338
339 /**
340 Object semaphor. This variable is private and can't be accessed
341 from the outside.
342
343 \sa wpRequestObjectMutexSem(), wpReleaseObjectMutexSem()
344 */
345 NOMINSTANCEVAR(HMUX gObjectMutex);
346 NOMINSTANCEVAR(PGSList glstObjectInUse);
347 NOMINSTANCEVAR(PNOMString pnomStringTitle);
348 NOMINSTANCEVAR(PWPFolder wpParentFldr);
349};
350
351#endif /* WPOBJECT_IDL_INCLUDED */
352
353
354
355
356
Note: See TracBrowser for help on using the repository browser.