Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / intuition / icclass.c
blob6f83d6d568db6ea49438b7e08d2e0efa78a9561b
1 /*
2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
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>
24 #ifndef __MORPHOS__
25 #include <aros/asmcall.h>
26 #include <proto/alib.h>
27 #endif /* !__MORPHOS__ */
29 #include "intuition_intern.h"
31 #define DEBUG_IC(x) ;
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)))
41 switch(tag->ti_Tag)
43 case ICA_MAP:
44 ic->ic_Mapping = (struct TagItem *)tag->ti_Data;
45 break;
47 case ICA_TARGET:
48 ic->ic_Target = (Object *)tag->ti_Data;
49 break;
54 IPTR ICClass__OM_NEW(Class *cl, Object *o, struct opSet *msg)
56 IPTR retval;
57 struct ICData *ic;
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 */
69 ic->ic_Target = NULL;
70 ic->ic_Mapping = NULL;
71 ic->ic_CloneTags = NULL;
73 _om_set(ic, msg->ops_AttrList, IntuitionBase);
75 return retval;
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));
87 return (IPTR)TRUE;
90 IPTR ICClass__OM_NOTIFY(Class *cl, Object *o, struct opUpdate *msg)
92 struct ICData *ic = INST_DATA(cl, o);
93 IPTR retval;
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"));
103 return retval;
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"));
112 FreeICData(ic);
113 DoSuperMethodA(cl, o, msg);
115 return (IPTR)TRUE;
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)
125 case ICA_MAP:
126 *msg->opg_Storage = (ULONG)ic->ic_Mapping;
127 break;
129 case ICA_TARGET:
130 *msg->opg_Storage = (ULONG)ic->ic_Target;
131 break;
134 return (IPTR)TRUE;
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 /**********************************************************************************************/