2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: icclass implementation.
9 /* AROS icclass implementation
10 * 10/25/96 caldi@usa.nai.net
13 #include <exec/types.h>
15 #include <intuition/classes.h>
16 #include <intuition/classusr.h>
17 #include <intuition/gadgetclass.h>
18 #include <intuition/cghooks.h>
19 #include <intuition/icclass.h>
21 #include <utility/tagitem.h>
22 #include <utility/hooks.h>
24 #include <clib/macros.h>
26 #include <proto/exec.h>
27 #include <proto/utility.h>
28 #include <proto/boopsi.h>
29 #include <clib/intuition_protos.h> /* UgH - Need DoMethod() etc */
32 #include <aros/asmcall.h>
33 #include <proto/alib.h>
38 /**********************************************************************************************/
41 #define BOOPSIBase ((struct Library *)(cl->cl_UserData))
43 /**********************************************************************************************/
45 /* icclass boopsi dispatcher
47 AROS_UFH3S(IPTR
, dispatch_icclass
,
48 AROS_UFHA(Class
*, cl
, A0
),
49 AROS_UFHA(Object
*, o
, A2
),
50 AROS_UFHA(Msg
, msg
, A1
)
53 struct ICData
*ic
= NULL
;
56 if (msg
->MethodID
!= OM_NEW
)
57 ic
= INST_DATA(cl
, o
);
62 retval
= DoSuperMethodA(cl
, o
, msg
);
67 ic
= INST_DATA(cl
, retval
);
69 /* set some defaults */
71 ic
->ic_Mapping
= NULL
;
72 ic
->ic_CloneTags
= NULL
;
74 /* Handle our special tags - overrides defaults */
79 struct TagItem
*tstate
= ((struct opSet
*)msg
)->ops_AttrList
;
82 while ((tag
= NextTagItem((const struct TagItem
**)&tstate
)))
87 ic
->ic_Mapping
= (struct TagItem
*)tag
->ti_Data
;
91 ic
->ic_Target
= (Object
*)tag
->ti_Data
;
98 case OM_UPDATE
: /* Maxon HotHelp says so and for example relied upon by modelclass */
100 /* Send update notification to target
102 retval
= DoNotify(cl
, o
, INST_DATA(cl
, o
), (struct opUpdate
*)msg
);
106 FreeICData(INST_DATA(cl
, o
));
107 DoSuperMethodA(cl
, o
, msg
);
111 switch (((struct opGet
*)msg
)->opg_AttrID
)
114 *((struct opGet
*)msg
)->opg_Storage
= (ULONG
)ic
->ic_Mapping
;
118 *((struct opGet
*)msg
)->opg_Storage
= (ULONG
)ic
->ic_Target
;
125 NOTE: I current don't see the purpose of the ICM_* methods
126 this implementation could be WAY off base...
128 stegerg: well, it is for example needed by modeclass which is
129 a superclass of icclass.
131 IMPORTANT: ICM_SETLOOP, ICM_CLEARLOOP, ICM_CHECKLOOP are also
132 handled by gadgetclass: change here <-> change there!
136 case ICM_SETLOOP
: /* set/increment loop counter */
138 struct ICData
*ic
= INST_DATA(cl
, o
);
140 ic
->ic_LoopCounter
+= 1UL;
145 case ICM_CLEARLOOP
: /* clear/decrement loop counter */
147 struct ICData
*ic
= INST_DATA(cl
, o
);
149 ic
->ic_LoopCounter
-= 1UL;
154 case ICM_CHECKLOOP
: /* set/increment loop */
156 struct ICData
*ic
= INST_DATA(cl
, o
);
158 retval
= (IPTR
)ic
->ic_LoopCounter
;
164 retval
= DoSuperMethodA(cl
, o
, msg
);
171 } /* dispatch_icclass */
175 /**********************************************************************************************/
177 struct IClass
*InitICClass (struct Library
* BOOPSIBase
)
179 struct IClass
*cl
= NULL
;
181 /* This is the code to make the icclass...
183 if ( (cl
= MakeClass(ICCLASS
, ROOTCLASS
, NULL
, sizeof(struct ICData
), 0)) )
185 cl
->cl_Dispatcher
.h_Entry
= (APTR
)AROS_ASMSYMNAME(dispatch_icclass
);
186 cl
->cl_Dispatcher
.h_SubEntry
= NULL
;
187 cl
->cl_UserData
= (IPTR
)BOOPSIBase
;
195 /**********************************************************************************************/