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
)
59 SD
*sd
= INST_DATA(cl
, obj
);
62 if (rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)ops
))
64 AsmCoerceMethod(cl
, (Object
*)rc
, OM_SET
, ops
->ops_AttrList
, NULL
);
72 * Change one or more attrubutes.
74 METHOD(SystemClassSet
, struct opSet
*, ops
)
76 SD
*sd
= INST_DATA(cl
, obj
);
77 struct TagItem
*tag
, *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
);
132 ULONG rc
= 1, *store
= opg
->opg_Storage
;
135 * First we see if the attribute they want is known to us. If not
136 * we pass it onto the superclass.
138 switch (opg
->opg_AttrID
)
145 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)opg
);
154 METHOD(SystemClassDispose
, Msg
, msg
)
156 SD
*sd
= INST_DATA(cl
, obj
);
158 if (sd
->sd_Image
) DisposeObject(sd
->sd_Image
);
160 return AsmDoSuperMethodA(cl
, obj
, msg
);
164 /// IM_DRAW, IM_ERASE
166 * Render the vector image.
168 METHOD(SystemClassDrawErase
, struct impDraw
*, dr
)
170 SD
*sd
= INST_DATA(cl
, obj
);
173 if (sd
->sd_Image
) DisposeObject(sd
->sd_Image
);
175 sd
->sd_Image
= NewObject(NULL
, "sysiclass", IA_Width
, IMAGE(obj
)->Width
,
176 IA_Height
, IMAGE(obj
)->Height
,
177 SYSIA_Which
, sd
->sd_Which
,
178 SYSIA_DrawInfo
, dr
->imp_DrInfo
,
183 IMAGEBOX(sd
->sd_Image
)->Left
= IMAGEBOX(obj
)->Left
;
184 IMAGEBOX(sd
->sd_Image
)->Top
= IMAGEBOX(obj
)->Top
;
186 rc
= AsmDoMethodA(sd
->sd_Image
, (Msg
)dr
);
194 /// Class initialization.
196 STATIC DPFUNC ClassFunc
[] = {
197 IM_DRAW
, (FUNCPTR
)SystemClassDrawErase
,
198 IM_ERASE
, (FUNCPTR
)SystemClassDrawErase
,
199 OM_NEW
, (FUNCPTR
)SystemClassNew
,
200 OM_SET
, (FUNCPTR
)SystemClassSet
,
201 OM_GET
, (FUNCPTR
)SystemClassGet
,
202 OM_DISPOSE
, (FUNCPTR
)SystemClassDispose
,
206 makeproto Class
*InitSystemClass(void)
208 return BGUI_MakeClass(CLASS_SuperClassID
, ImageClass
,
209 CLASS_ObjectSize
, sizeof(SD
),
210 CLASS_DFTable
, ClassFunc
,