7 * (C) Copyright 1998 Manuel Lemos.
8 * (C) Copyright 1996-1997 Ian J. Einman.
9 * (C) Copyright 1993-1996 Jaba Development.
10 * (C) Copyright 1993-1996 Jan van den Baard.
11 * All Rights Reserved.
14 * Revision 42.2 2004/06/16 20:16:48 verhaegs
15 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
17 * Revision 42.1 2000/05/15 19:27:02 stegerg
18 * another hundreds of REG() macro replacements in func headers/protos.
20 * Revision 42.0 2000/05/09 22:10:26 mlemos
21 * Bumped to revision 42.0 before handing BGUI to AROS team
23 * Revision 41.11 2000/05/09 19:55:17 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 41.10.2.1 1999/07/31 01:55:22 mlemos
27 * Fixed superclass call to dispose the objects.
29 * Revision 41.10 1998/02/25 21:13:18 mlemos
32 * Revision 1.1 1998/02/25 17:09:54 mlemos
38 /// Class definitions.
40 #include "include/classdefs.h"
43 * Object instance data.
46 Object
*sd_Image
; /* The sysiclass object. */
47 struct DrawInfo
*sd_DrawInfo
; /* Current drawinfo. */
48 UWORD sd_Which
; /* Which image to render. */
55 * Create a new object.
57 METHOD(SystemClassNew
, struct opSet
*, ops
)
61 if ((rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)ops
)))
63 AsmCoerceMethod(cl
, (Object
*)rc
, OM_SET
, ops
->ops_AttrList
, NULL
);
71 * Change one or more attrubutes.
73 METHOD(SystemClassSet
, struct opSet
*, ops
)
75 SD
*sd
= INST_DATA(cl
, obj
);
77 struct TagItem
*tstate
= ops
->ops_AttrList
;
82 * First we let the superclass
83 * change the attributes it
86 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)ops
);
91 while ((tag
= NextTagItem(&tstate
)))
99 case BUILTIN_CHECKMARK
:
102 case BUILTIN_ARROW_LEFT
:
105 case BUILTIN_ARROW_RIGHT
:
108 case BUILTIN_ARROW_UP
:
111 case BUILTIN_ARROW_DOWN
:
117 sd
->sd_DrawInfo
= NULL
;
127 * Give an attribute value.
129 METHOD(SystemClassGet
, struct opGet
*, opg
)
131 SD
*sd
= INST_DATA(cl
, obj
);
133 IPTR
*store
= opg
->opg_Storage
;
136 * First we see if the attribute they want is known to us. If not
137 * we pass it onto the superclass.
139 switch (opg
->opg_AttrID
)
146 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)opg
);
155 METHOD(SystemClassDispose
, Msg
, msg
)
157 SD
*sd
= INST_DATA(cl
, obj
);
159 if (sd
->sd_Image
) DisposeObject(sd
->sd_Image
);
161 return AsmDoSuperMethodA(cl
, obj
, msg
);
165 /// IM_DRAW, IM_ERASE
167 * Render the vector image.
169 METHOD(SystemClassDrawErase
, struct impDraw
*, dr
)
171 SD
*sd
= INST_DATA(cl
, obj
);
174 if (sd
->sd_Image
) DisposeObject(sd
->sd_Image
);
176 sd
->sd_Image
= NewObject(NULL
, "sysiclass", IA_Width
, IMAGE(obj
)->Width
,
177 IA_Height
, IMAGE(obj
)->Height
,
178 SYSIA_Which
, sd
->sd_Which
,
179 SYSIA_DrawInfo
, dr
->imp_DrInfo
,
184 IMAGEBOX(sd
->sd_Image
)->Left
= IMAGEBOX(obj
)->Left
;
185 IMAGEBOX(sd
->sd_Image
)->Top
= IMAGEBOX(obj
)->Top
;
187 rc
= AsmDoMethodA(sd
->sd_Image
, (Msg
)dr
);
195 /// Class initialization.
197 STATIC DPFUNC ClassFunc
[] = {
198 { IM_DRAW
, SystemClassDrawErase
, },
199 { IM_ERASE
, SystemClassDrawErase
, },
200 { OM_NEW
, SystemClassNew
, },
201 { OM_SET
, SystemClassSet
, },
202 { OM_GET
, SystemClassGet
, },
203 { OM_DISPOSE
, SystemClassDispose
, },
207 makeproto Class
*InitSystemClass(void)
209 return BGUI_MakeClass(CLASS_SuperClassID
, ImageClass
,
210 CLASS_ObjectSize
, sizeof(SD
),
211 CLASS_DFTable
, ClassFunc
,