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 <intuition/classes.h>
13 #include <intuition/classusr.h>
14 #include <libraries/mui.h>
18 #include "desktop_intern.h"
20 #include <proto/dos.h>
21 #include <proto/intuition.h>
22 #include <proto/icon.h>
23 #include <proto/utility.h>
25 #include "presentation.h"
27 #include "iconclass.h"
28 #include "iconobserver.h"
29 #include "abstracticon.h"
31 #include "desktop_intern_protos.h"
35 IPTR
iconObserverNew(Class
* cl
, Object
* obj
, struct opSet
* msg
)
38 struct IconObserverClassData
*data
;
40 *tstate
= msg
->ops_AttrList
;
43 BOOL selected
= FALSE
;
44 UBYTE
*comment
= NULL
;
53 while ((tag
= NextTagItem(&tstate
)) != NULL
)
58 selected
= (BOOL
) tag
->ti_Data
;
62 name
= (UBYTE
*) tag
->ti_Data
;
66 directory
= (UBYTE
*) tag
->ti_Data
;
70 comment
= (UBYTE
*) tag
->ti_Data
;
74 script
= (BOOL
) tag
->ti_Data
;
78 pure
= (BOOL
) tag
->ti_Data
;
82 archived
= (BOOL
) tag
->ti_Data
;
86 readable
= (BOOL
) tag
->ti_Data
;
90 writeable
= (BOOL
) tag
->ti_Data
;
94 executable
= (BOOL
) tag
->ti_Data
;
98 deleteable
= (BOOL
) tag
->ti_Data
;
102 continue; /* Don't supress non-processed tags */
105 tag
->ti_Tag
= TAG_IGNORE
;
108 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
111 obj
= (Object
*) retval
;
112 data
= INST_DATA(cl
, obj
);
113 data
->selected
= selected
;
115 data
->directory
= directory
;
116 data
->comment
= comment
;
117 data
->script
= script
;
119 data
->archived
= archived
;
120 data
->readable
= readable
;
121 data
->writeable
= writeable
;
122 data
->executable
= executable
;
123 data
->deleteable
= deleteable
;
125 DoMethod(_presentation(obj
), MUIM_Notify
, IA_Executed
, TRUE
, (IPTR
) obj
, 1,
127 DoMethod(_presentation(obj
), MUIM_Notify
, IA_Selected
, MUIV_EveryTime
,
128 (IPTR
) obj
, 3, MUIM_Set
, IOA_Selected
, MUIV_TriggerValue
);
129 DoMethod(_presentation(obj
), MUIM_Notify
, IA_Directory
,
130 MUIV_EveryTime
, (IPTR
) obj
, 3, MUIM_Set
, IOA_Directory
,
132 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Comment
, MUIV_EveryTime
,
133 (IPTR
) obj
, 3, MUIM_Set
, IOA_Comment
, MUIV_TriggerValue
);
135 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Script
, MUIV_EveryTime
,
136 (IPTR
) obj
, 3, MUIM_Set
, IOA_Script
, MUIV_TriggerValue
);
137 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Pure
, MUIV_EveryTime
,
138 (IPTR
) obj
, 3, MUIM_Set
, IOA_Pure
, MUIV_TriggerValue
);
139 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Archived
, MUIV_EveryTime
,
140 (IPTR
) obj
, 3, MUIM_Set
, IOA_Archived
, MUIV_TriggerValue
);
141 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Readable
, MUIV_EveryTime
,
142 (IPTR
) obj
, 3, MUIM_Set
, IOA_Readable
, MUIV_TriggerValue
);
143 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Writeable
,
144 MUIV_EveryTime
, (IPTR
) obj
, 3, MUIM_Set
, IOA_Writeable
,
146 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Executable
,
147 MUIV_EveryTime
, (IPTR
) obj
, 3, MUIM_Set
, IOA_Executable
,
149 DoMethod(_presentation(obj
), MUIM_Notify
, AIA_Deleteable
,
150 MUIV_EveryTime
, (IPTR
) obj
, 3, MUIM_Set
, IOA_Deleteable
,
157 IPTR
iconObserverSet(Class
* cl
, Object
* obj
, struct opSet
* msg
)
159 struct IconObserverClassData
*data
;
162 *tstate
= msg
->ops_AttrList
;
164 data
= (struct IconObserverClassData
*) INST_DATA(cl
, obj
);
166 while ((tag
= NextTagItem(&tstate
)))
171 data
->comment
= (UBYTE
*) tag
->ti_Data
;
173 was this OM_SET triggered by a notify?
175 if (strcmp(_comment(_presentation(obj
)), data
->comment
))
176 DoMethod(_presentation(obj
), MUIM_NoNotifySet
, AIA_Comment
,
177 (IPTR
) data
->comment
);
179 // TODO: When one of these bits is set, send a request to the
180 // handler to do the change
182 data
->script
= tag
->ti_Data
;
184 was this OM_SET triggered by a notify?
186 if (_script(_presentation(obj
)) != data
->script
)
187 DoMethod(_presentation(obj
), MUIM_NoNotifySet
, AIA_Script
,
191 data
->pure
= tag
->ti_Data
;
193 was this OM_SET triggered by a notify?
195 if (_pure(_presentation(obj
)) != data
->pure
)
196 DoMethod(_presentation(obj
), MUIM_NoNotifySet
, AIA_Pure
,
200 data
->archived
= tag
->ti_Data
;
202 was this OM_SET triggered by a notify?
204 if (_archived(_presentation(obj
)) != data
->archived
)
205 DoMethod(_presentation(obj
), MUIM_NoNotifySet
,
206 AIA_Archived
, data
->archived
);
209 data
->readable
= tag
->ti_Data
;
211 was this OM_SET triggered by a notify?
213 if (_readable(_presentation(obj
)) != data
->readable
)
214 DoMethod(_presentation(obj
), MUIM_NoNotifySet
,
215 AIA_Readable
, data
->readable
);
218 data
->writeable
= tag
->ti_Data
;
220 was this OM_SET triggered by a notify?
222 if (_writeable(_presentation(obj
)) != data
->writeable
)
223 DoMethod(_presentation(obj
), MUIM_NoNotifySet
,
224 AIA_Writeable
, data
->writeable
);
227 data
->comment
= (UBYTE
*) tag
->ti_Data
;
229 was this OM_SET triggered by a notify?
231 if (_executable(_presentation(obj
)) != data
->executable
)
232 DoMethod(_presentation(obj
), MUIM_NoNotifySet
,
233 AIA_Executable
, data
->executable
);
236 data
->comment
= (UBYTE
*) tag
->ti_Data
;
238 was this OM_SET triggered by a notify?
240 if (_deleteable(_presentation(obj
)) != data
->deleteable
)
241 DoMethod(_presentation(obj
), MUIM_NoNotifySet
,
242 AIA_Deleteable
, data
->deleteable
);
249 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
254 IPTR
iconObserverGet(Class
* cl
, Object
* obj
, struct opGet
* msg
)
257 struct IconObserverClassData
*data
;
259 data
= (struct IconObserverClassData
*) INST_DATA(cl
, obj
);
261 switch (msg
->opg_AttrID
)
264 *msg
->opg_Storage
= (IPTR
) data
->name
;
267 *msg
->opg_Storage
= data
->script
;
270 *msg
->opg_Storage
= data
->pure
;
273 *msg
->opg_Storage
= data
->archived
;
276 *msg
->opg_Storage
= data
->readable
;
279 *msg
->opg_Storage
= data
->writeable
;
282 *msg
->opg_Storage
= data
->executable
;
285 *msg
->opg_Storage
= data
->deleteable
;
288 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
295 IPTR
iconObserverDispose(Class
* cl
, Object
* obj
, Msg msg
)
298 struct IconObserverClassData
*data
;
300 data
= (struct IconObserverClassData
*) INST_DATA(cl
, obj
);
302 FreeDiskObject(_diskobject(_presentation(obj
)));
304 // IconObserverClassData.name is part of the ExAllBuffer and is freed
305 // by this object's parent
306 // IconObserverClassData.directory belongs to this object's parent, and
309 retval
= DoSuperMethodA(cl
, obj
, msg
);
314 IPTR
iconObserverExecute(Class
* cl
, Object
* obj
, Msg msg
)
319 BOOPSI_DISPATCHER(IPTR
, iconObserverDispatcher
, cl
, obj
, msg
)
323 switch (msg
->MethodID
)
326 retval
= iconObserverNew(cl
, obj
, (struct opSet
*) msg
);
329 retval
= iconObserverSet(cl
, obj
, (struct opSet
*) msg
);
332 retval
= iconObserverGet(cl
, obj
, (struct opGet
*) msg
);
335 retval
= iconObserverDispose(cl
, obj
, msg
);
338 retval
= iconObserverExecute(cl
, obj
, msg
);
341 retval
= DoSuperMethodA(cl
, obj
, msg
);
347 BOOPSI_DISPATCHER_END