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:00 stegerg
18 * another hundreds of REG() macro replacements in func headers/protos.
20 * Revision 42.0 2000/05/09 22:08:11 mlemos
21 * Bumped to revision 42.0 before handing BGUI to AROS team
23 * Revision 41.11 2000/05/09 19:53:42 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 41.10.2.1 1998/11/23 14:58:28 mlemos
27 * Made the BaseInfo pointer passed to DoNotifyMethod be casted to GadgetInfo
28 * pointer to avoid a compiler warning.
30 * Revision 41.10 1998/02/25 21:11:28 mlemos
33 * Revision 1.1 1998/02/25 17:07:18 mlemos
39 /// Class definitions.
40 #include "include/classdefs.h"
46 UWORD ad_MinWidth
; /* Minimum width of area. */
47 UWORD ad_MinHeight
; /* Minimum height of area. */
51 METHOD(AreaClassNew
, struct opSet
*,ops
)
55 struct TagItem
*tags
, *tag
;
56 struct TagItem
*tstate
;
58 tags
= DefTagList(BGUI_AREA_GADGET
, ops
->ops_AttrList
);
60 * Let the superclass create an object.
62 if ((rc
= NewSuperObject(cl
, obj
, tags
)))
64 ad
= INST_DATA(cl
, rc
);
67 while ((tag
= NextTagItem(&tstate
)))
72 ad
->ad_MinWidth
= tag
->ti_Data
;
75 ad
->ad_MinHeight
= tag
->ti_Data
;
81 * Minimal width and height required!
83 if (!ad
->ad_MinWidth
|| !ad
->ad_MinHeight
)
88 AsmCoerceMethod(cl
, (Object
*)rc
, OM_DISPOSE
);
99 METHOD(AreaClassGet
, struct opGet
*,opg
)
101 AD
*ad
= INST_DATA(cl
, obj
);
102 BC
*bc
= BASE_DATA(obj
);
104 IPTR
*store
= opg
->opg_Storage
;
106 switch (opg
->opg_AttrID
)
110 * Simply return a pointer to the area
111 * which is computed at rendering time.
113 STORE
&bc
->bc_InnerBox
;
116 STORE ad
->ad_MinWidth
;
119 STORE ad
->ad_MinHeight
;
122 rc
= AsmDoSuperMethodA(cl
, obj
, (Msg
)opg
);
131 METHOD(AreaClassRender
, struct bmRender
*,bmr
)
134 * Render the baseclass.
136 AsmDoSuperMethodA(cl
, obj
, (Msg
)bmr
);
139 * Notify the main program.
141 DoNotifyMethod(obj
, (struct GadgetInfo
*)bmr
->bmr_BInfo
, 0, GA_ID
, GADGET(obj
)->GadgetID
, TAG_DONE
);
149 * This object cannot be hit.
151 METHOD(AreaClassHitTest
, Msg
, msg
)
159 * Simple dimensions request.
161 METHOD(AreaClassDimensions
, struct bmDimensions
*,bmd
)
163 AD
*ad
= INST_DATA(cl
, obj
);
166 * We simply add the specified minimum width and height
167 * which are passed to us at create time.
169 return CalcDimensions(cl
, obj
, bmd
, ad
->ad_MinWidth
, ad
->ad_MinHeight
);
173 /// Class initialization.
175 * Class function table.
177 STATIC DPFUNC ClassFunc
[] = {
178 { OM_NEW
, (FUNCPTR
)AreaClassNew
, },
179 { OM_GET
, (FUNCPTR
)AreaClassGet
, },
180 { BASE_RENDER
, (FUNCPTR
)AreaClassRender
, },
181 { BASE_DIMENSIONS
, (FUNCPTR
)AreaClassDimensions
, },
182 { GM_HITTEST
, (FUNCPTR
)AreaClassHitTest
, },
187 * Simple class initialization.
189 makeproto Class
*InitAreaClass(void)
191 return BGUI_MakeClass(CLASS_SuperClassBGUI
, BGUI_BASE_GADGET
,
192 CLASS_ObjectSize
, sizeof(AD
),
193 CLASS_DFTable
, ClassFunc
,