2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <exec/types.h>
9 #include <intuition/classes.h>
10 #include <intuition/classusr.h>
11 #include <intuition/gadgetclass.h>
12 #include <intuition/cghooks.h>
13 #include <intuition/icclass.h>
15 #include <utility/tagitem.h>
16 #include <utility/hooks.h>
18 #include <clib/macros.h>
20 #include <proto/exec.h>
21 #include <proto/utility.h>
22 #include <proto/intuition.h>
25 #include <aros/asmcall.h>
26 #include <proto/alib.h>
27 #endif /* !__MORPHOS__ */
29 #include "intuition_intern.h"
33 /**********************************************************************************************/
35 static void _om_set(struct ICData
*ic
, struct TagItem
*tags
, struct IntuitionBase
*IntuitionBase
)
37 struct TagItem
*tag
, *tstate
= tags
;
39 while ((tag
= NextTagItem((const struct TagItem
**)&tstate
)))
44 ic
->ic_Mapping
= (struct TagItem
*)tag
->ti_Data
;
48 ic
->ic_Target
= (Object
*)tag
->ti_Data
;
54 IPTR
ICClass__OM_NEW(Class
*cl
, Object
*o
, struct opSet
*msg
)
58 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
60 DEBUG_IC(dprintf("dispatch_icclass: OM_NEW\n"));
62 retval
= DoSuperMethodA(cl
, o
, (Msg
)msg
);
64 if (!retval
) return (IPTR
)FALSE
;
66 ic
= INST_DATA(cl
, retval
);
68 /* set some defaults */
70 ic
->ic_Mapping
= NULL
;
71 ic
->ic_CloneTags
= NULL
;
73 _om_set(ic
, msg
->ops_AttrList
, IntuitionBase
);
78 IPTR
ICClass__OM_SET(Class
*cl
, Object
*o
, struct opSet
*msg
)
80 struct ICData
*ic
= INST_DATA(cl
, o
);
81 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
83 DEBUG_IC(dprintf("dispatch_icclass: OM_SET\n"));
84 _om_set(ic
, msg
->ops_AttrList
, IntuitionBase
);
85 DEBUG_IC(dprintf("dispatch_icclass: OM_SET Map 0x%lx Target 0x%lx\n",ic
->ic_Mapping
,ic
->ic_Target
));
90 IPTR
ICClass__OM_NOTIFY(Class
*cl
, Object
*o
, struct opUpdate
*msg
)
92 struct ICData
*ic
= INST_DATA(cl
, o
);
94 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
96 /* Send update notification to target
98 DEBUG_IC(dprintf("dispatch_icclass: OM_NOTIFY\n"));
99 DEBUG_IC(dprintf("dispatch_icclass: DoNotify\n"));
100 retval
= DoNotify(cl
, o
, ic
, msg
);
101 DEBUG_IC(dprintf("dispatch_icclass: DoNotify done\n"));
106 IPTR
ICClass__OM_DISPOSE(Class
*cl
, Object
*o
, Msg msg
)
108 struct ICData
*ic
= INST_DATA(cl
, o
);
109 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
111 DEBUG_IC(dprintf("dispatch_icclass: OM_DISPOSE\n"));
113 DoSuperMethodA(cl
, o
, msg
);
118 IPTR
ICClass__OM_GET(Class
*cl
, Object
*o
, struct opGet
*msg
)
120 struct ICData
*ic
= INST_DATA(cl
, o
);
122 DEBUG_IC(dprintf("dispatch_icclass: OM_GET\n"));
123 switch (msg
->opg_AttrID
)
126 *msg
->opg_Storage
= (ULONG
)ic
->ic_Mapping
;
130 *msg
->opg_Storage
= (ULONG
)ic
->ic_Target
;
139 * NOTE: I current don't see the purpose of the ICM_* methods
140 * this implementation could be WAY off base...
142 * stegerg: well, it is for example needed by modeclass which is
143 * a superclass of icclass.
145 * IMPORTANT: ICM_SETLOOP, ICM_CLEARLOOP, ICM_CHECKLOOP are also
146 * handled by gadgetclass: change here <-> change there!
149 void ICClass__ICM_SETLOOP(Class
*cl
, Object
*o
, Msg msg
)
151 struct ICData
*ic
= INST_DATA(cl
, o
);
153 /* set/increment loop counter */
154 ic
->ic_LoopCounter
+= 1UL;
155 DEBUG_IC(dprintf("dispatch_icclass: ICM_SETLOOP new LoopCounter %ld\n",ic
->ic_LoopCounter
));
158 void ICClass__ICM_CLEARLOOP(Class
*cl
, Object
*o
, Msg msg
)
160 struct ICData
*ic
= INST_DATA(cl
, o
);
162 /* clear/decrement loop counter */
163 ic
->ic_LoopCounter
-= 1UL;
164 DEBUG_IC(dprintf("dispatch_icclass: ICM_CLEAR new LoopCounter %ld\n",ic
->ic_LoopCounter
));
167 IPTR
ICClass__ICM_CHECKLOOP(Class
*cl
, Object
*o
, Msg msg
)
169 struct ICData
*ic
= INST_DATA(cl
, o
);
171 /* get loop counter */
172 DEBUG_IC(dprintf("dispatch_icclass: ICM_CHECKLOOP new LoopCounter %ld\n",ic
->ic_LoopCounter
));
173 return (IPTR
)ic
->ic_LoopCounter
;
176 /**********************************************************************************************/