2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <exec/memory.h>
13 #include <intuition/classes.h>
14 #include <intuition/classusr.h>
15 #include <libraries/mui.h>
16 #include <workbench/workbench.h>
18 #include <proto/dos.h>
19 #include <proto/desktop.h>
20 #include <proto/intuition.h>
21 #include <proto/utility.h>
25 #include "desktop_intern.h"
26 #include "iconcontainerobserver.h"
27 #include "desktopobserver.h"
28 #include "presentation.h"
29 #include "iconcontainerclass.h"
31 #include "iconclass.h"
33 #include "desktop_intern_protos.h"
35 IPTR
desktopObsNew(Class
* cl
, Object
* obj
, struct opSet
*msg
)
38 struct DesktopObserverClassData
*data
;
40 Class
*defaultWindowClass
= NULL
;
41 struct TagItem
*defaultWindowArgs
= NULL
;
43 tag
= FindTagItem(DOA_DefaultWindowClass
, msg
->ops_AttrList
);
46 defaultWindowClass
= (Class
*) tag
->ti_Data
;
47 // this will change, save the variable in a new
48 // desktopcontext area
49 DesktopBase
->db_DefaultWindow
= defaultWindowClass
;
50 tag
->ti_Tag
= TAG_IGNORE
;
53 tag
= FindTagItem(DOA_DefaultWindowArguments
, msg
->ops_AttrList
);
56 defaultWindowArgs
= (struct TagItem
*) tag
->ti_Data
;
57 // this will change, save the variable in a new
58 // desktopcontext area
59 DesktopBase
->db_DefaultWindowArguments
= defaultWindowArgs
;
60 tag
->ti_Tag
= TAG_IGNORE
;
63 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
66 obj
= (Object
*) retval
;
67 data
= INST_DATA(cl
, obj
);
68 data
->defaultWindow
= defaultWindowClass
;
69 data
->defaultWindowArgs
= defaultWindowArgs
;
75 IPTR
desktopObsSet(Class
* cl
, Object
* obj
, struct opSet
* msg
)
77 struct DesktopObserverClassData
*data
;
80 *tstate
= msg
->ops_AttrList
;
82 data
= (struct DesktopObserverClassData
*) INST_DATA(cl
, obj
);
84 while ((tag
= NextTagItem(&tstate
)))
90 struct HandlerTopLevelRequest
*htl
;
93 createTLScanMessage(DIMC_TOPLEVEL
, NULL
, LDF_VOLUMES
,
94 obj
, _app(_presentation(obj
)));
95 PutMsg(DesktopBase
->db_HandlerPort
,
96 (struct Message
*) htl
);
105 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
110 IPTR
desktopObsGet(Class
* cl
, Object
* obj
, struct opGet
* msg
)
113 struct DesktopObserverClassData
*data
;
115 data
= (struct DesktopObserverClassData
*) INST_DATA(cl
, obj
);
117 switch (msg
->opg_AttrID
)
120 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
127 IPTR
desktopObsDispose(Class
* cl
, Object
* obj
, Msg msg
)
130 struct DesktopObserverClassData
*data
;
132 data
= (struct DesktopObserverClassData
*) INST_DATA(cl
, obj
);
133 retval
= DoSuperMethodA(cl
, obj
, msg
);
138 IPTR
desktopObsAddIcons(Class
* cl
, Object
* obj
, struct icoAddIcon
* msg
)
145 // struct DesktopObserverClassData *data;
147 for (i
= 0; i
< msg
->wsr_Results
; i
++)
149 switch (msg
->wsr_ResultsArray
[i
].sr_DiskObject
->do_Type
)
156 kind
= CDO_DrawerIcon
;
164 kind
= CDO_ProjectIcon
;
168 kind
= CDO_TrashcanIcon
;
175 continue; /* skip unknown diskobject types */
178 newIcon
= CreateDesktopObject
182 IA_DiskObject
, (IPTR
) msg
->wsr_ResultsArray
[i
].sr_DiskObject
,
183 IA_Label
, (IPTR
) msg
->wsr_ResultsArray
[i
].sr_Name
,
184 IA_Desktop
, (IPTR
) _presentation(obj
),
185 // IA_Directory, data->directory,
186 MUIA_Draggable
, TRUE
,
191 DoMethod(_presentation(obj
), OM_ADDMEMBER
, (IPTR
) newIcon
);
194 FreeVec(msg
->wsr_ResultsArray
);
199 BOOPSI_DISPATCHER(IPTR
, desktopObserverDispatcher
, cl
, obj
, msg
)
203 switch (msg
->MethodID
)
206 retval
= desktopObsNew(cl
, obj
, (struct opSet
*) msg
);
209 retval
= desktopObsSet(cl
, obj
, (struct opSet
*) msg
);
212 retval
= desktopObsGet(cl
, obj
, (struct opGet
*) msg
);
215 retval
= desktopObsDispose(cl
, obj
, msg
);
218 retval
= desktopObsAddIcons(cl
, obj
, (struct icoAddIcon
*) msg
);
221 retval
= DoSuperMethodA(cl
, obj
, msg
);
227 BOOPSI_DISPATCHER_END