- Now puts cursor position in window title properly instead of overwriting
[tangerine.git] / workbench / libs / desktop / abstracticon.c
blobd0a657a171dc614c8efdebdb36a94591b336d77e
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 1
7 #include <aros/debug.h>
9 #include <exec/types.h>
10 #include <intuition/classes.h>
11 #include <intuition/classusr.h>
12 #include <libraries/mui.h>
14 #include "abstracticon.h"
15 #include "desktop_intern.h"
16 #include "iconclass.h"
18 #include <proto/exec.h>
19 #include <proto/intuition.h>
20 #include <proto/utility.h>
22 #include "desktop_intern_protos.h"
24 IPTR abstractIconNew(Class *cl, Object *obj, struct opSet *msg)
26 IPTR retval=0;
27 struct AbstractIconClassData *data;
28 struct TagItem *tag, *tstate = msg->ops_AttrList;
29 BOOL script=FALSE, pure=FALSE, archived=FALSE, readable=FALSE, writeable=FALSE, executable=FALSE, deleteable=FALSE;
30 UBYTE *comment=NULL;
32 while((tag = NextTagItem(&tstate)) != NULL)
34 switch(tag->ti_Tag)
36 case AIA_Comment:
37 comment = (UBYTE *) tag->ti_Data;
38 break;
39 case AIA_Script:
40 script = (BOOL) tag->ti_Data;
41 break;
42 case AIA_Pure:
43 pure = (BOOL) tag->ti_Data;
44 break;
45 case AIA_Archived:
46 archived = (BOOL) tag->ti_Data;
47 break;
48 case AIA_Readable:
49 readable = (BOOL) tag->ti_Data;
50 break;
51 case AIA_Writeable:
52 writeable = (BOOL) tag->ti_Data;
53 break;
54 case AIA_Executable:
55 executable = (BOOL) tag->ti_Data;
56 break;
57 case AIA_Deleteable:
58 deleteable = (BOOL) tag->ti_Data;
59 break;
63 retval = DoSuperMethodA(cl, obj, (Msg) msg);
65 if (retval)
67 obj=(Object*)retval;
68 data=INST_DATA(cl, obj);
70 data->script=script;
71 data->pure=pure;
72 data->archived=archived;
73 data->readable=readable;
74 data->writeable=writeable;
75 data->executable=executable;
76 data->deleteable=deleteable;
77 data->comment=comment;
80 return retval;
83 IPTR abstractIconDispose(Class *cl, Object *obj, Msg msg)
85 IPTR retval;
87 retval=DoSuperMethodA(cl, obj, msg);
89 return retval;
92 IPTR abstractIconGet(Class *cl, Object *obj, struct opGet *msg)
94 IPTR retval=1;
95 struct AbstractIconClassData *data;
97 data=(struct AbstractIconClassData*)INST_DATA(cl, obj);
99 switch(msg->opg_AttrID)
101 case AIA_Comment:
102 *msg->opg_Storage=(ULONG)data->comment;
103 break;
104 case AIA_Script:
105 *msg->opg_Storage=(ULONG)data->script;
106 break;
107 case AIA_Pure:
108 *msg->opg_Storage=(ULONG)data->pure;
109 break;
110 case AIA_Archived:
111 *msg->opg_Storage=(ULONG)data->archived;
112 break;
113 case AIA_Readable:
114 *msg->opg_Storage=(ULONG)data->readable;
115 break;
116 case AIA_Writeable:
117 *msg->opg_Storage=(ULONG)data->writeable;
118 break;
119 case AIA_Executable:
120 *msg->opg_Storage=(ULONG)data->executable;
121 break;
122 case AIA_Deleteable:
123 *msg->opg_Storage=(ULONG)data->deleteable;
124 break;
125 default:
126 retval=DoSuperMethodA(cl, obj, (Msg)msg);
127 break;
130 return retval;
133 IPTR abstractIconSet(Class *cl, Object *obj, struct opSet *msg)
135 struct AbstractIconClassData *data;
136 IPTR retval=1;
137 struct TagItem *tag, *tstate=msg->ops_AttrList;
138 BOOL doSuper=TRUE;
140 data=(struct AbstractIconClassData*)INST_DATA(cl, obj);
142 while((tag=NextTagItem(&tstate)))
144 switch(tag->ti_Tag)
146 case AIA_Comment:
147 data->comment=(UBYTE*)tag->ti_Data;
148 break;
149 case AIA_Script:
150 data->script=(BOOL)tag->ti_Data;
151 break;
152 case AIA_Pure:
153 data->pure=(BOOL)tag->ti_Data;
154 break;
155 case AIA_Archived:
156 data->archived=(BOOL)tag->ti_Data;
157 break;
158 case AIA_Readable:
159 data->readable=(BOOL)tag->ti_Data;
160 break;
161 case AIA_Writeable:
162 data->writeable=(BOOL)tag->ti_Data;
163 break;
164 case AIA_Executable:
165 data->executable=(BOOL)tag->ti_Data;
166 break;
167 case AIA_Deleteable:
168 data->deleteable=(BOOL)tag->ti_Data;
169 break;
173 if(doSuper)
174 retval=DoSuperMethodA(cl, obj, (Msg) msg);
176 return retval;
179 BOOPSI_DISPATCHER(IPTR, abstractIconDispatcher, cl, obj, msg)
181 IPTR retval = 0;
183 switch (msg->MethodID)
185 case OM_NEW:
186 retval=abstractIconNew(cl, obj, (struct opSet*)msg);
187 break;
188 case OM_SET:
189 retval=abstractIconSet(cl, obj, (struct opSet*)msg);
190 break;
191 case OM_GET:
192 retval=abstractIconGet(cl, obj, (struct opGet*)msg);
193 break;
194 case OM_DISPOSE:
195 retval=abstractIconDispose(cl, obj, msg);
196 break;
197 default:
198 retval=DoSuperMethodA(cl, obj, msg);
199 break;
202 return retval;
204 BOOPSI_DISPATCHER_END