Instead of "eax" and "edx" in asm constraints use "a" and "d"
[tangerine.git] / rom / intuition / barlabelclass.c
blob3704238fc9b8cfc3490ee78da180915e223b84fa
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 AROS menubarlabelclass implementation (does not exist in AmigaOS)
7 */
9 #include <exec/types.h>
11 #include <dos/dos.h>
12 #include <dos/dosextens.h>
14 #include <intuition/intuition.h>
15 #include <intuition/intuitionbase.h>
16 #include <intuition/classes.h>
17 #include <intuition/classusr.h>
18 #include <intuition/imageclass.h>
20 #include <graphics/gfxbase.h>
21 #include <graphics/gfxmacros.h>
22 #include <graphics/rpattr.h>
24 #include <cybergraphx/cybergraphics.h>
26 #include <utility/tagitem.h>
27 #include <utility/hooks.h>
29 #include <clib/macros.h>
31 #include <proto/exec.h>
32 #include <proto/intuition.h>
33 #include <proto/graphics.h>
34 #include <proto/utility.h>
35 #include <proto/cybergraphics.h>
37 #ifndef __MORPHOS__
38 #include <aros/asmcall.h>
39 #include <proto/alib.h>
40 #include "intuition_intern.h"
41 #endif /* !__MORPHOS__ */
43 #ifdef SKINS
44 # include "intuition_customize.h"
45 # include "intuition_extend.h"
46 #endif
48 #ifdef IntuitionBase
49 # undef IntuitionBase
50 #endif
52 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
54 /*************************** BarLabelClass *****************************/
56 struct MenuBarLabelData
58 struct DrawInfo *dri;
61 AROS_UFH3S(IPTR, dispatch_menubarlabelclass,
62 AROS_UFHA(Class *, cl, A0),
63 AROS_UFHA(Object *, obj, A2),
64 AROS_UFHA(Msg, msg, A1)
67 AROS_USERFUNC_INIT
69 struct MenuBarLabelData *data;
70 struct RastPort *rp;
71 struct TagItem *ti;
72 WORD x1, y1, x2, y2;
74 IPTR retval = 0UL;
76 switch (msg->MethodID)
78 case OM_NEW:
79 obj = (Object *)DoSuperMethodA(cl, obj, msg);
80 if (obj)
82 data = INST_DATA(cl, obj);
83 data->dri = NULL;
85 retval = (IPTR)obj;
87 break;
89 case OM_SET:
90 if ((ti = FindTagItem(SYSIA_DrawInfo, ((struct opSet *)msg)->ops_AttrList)))
92 data = INST_DATA(cl, obj);
94 data->dri = (struct DrawInfo *)ti->ti_Data;
96 retval = DoSuperMethodA(cl, obj, msg);
97 break;
99 case OM_GET:
100 switch(((struct opGet *)msg)->opg_AttrID)
102 case IA_SupportsDisable:
103 if (MENUS_AMIGALOOK)
105 *(((struct opGet *)msg)->opg_Storage) = 0;
107 else
109 *(((struct opGet *)msg)->opg_Storage) = 1;
112 retval = 1;
113 break;
115 default:
116 retval = DoSuperMethodA(cl, obj, msg);
117 break;
119 break;
121 case IM_DRAW:
122 data = INST_DATA(cl, obj);
124 if (data->dri)
126 rp = ((struct impDraw *)msg)->imp_RPort;
128 if (!rp) break;
130 SetDrMd(rp, JAM1);
132 x1 = ((struct Image *)obj)->LeftEdge + ((struct impDraw *)msg)->imp_Offset.X;
133 y1 = ((struct Image *)obj)->TopEdge + ((struct impDraw *)msg)->imp_Offset.Y;
134 x2 = x1 + ((struct Image *)obj)->Width - 1;
135 y2 = y1 + ((struct Image *)obj)->Height - 1;
138 if (MENUS_AMIGALOOK)
140 SetAPen(rp, data->dri->dri_Pens[BARDETAILPEN]);
141 RectFill(rp, x1, y1, x2, y2);
143 else
145 /* Will only work if imageheight = 2 */
146 SetAPen(rp, data->dri->dri_Pens[SHADOWPEN]);
147 RectFill(rp, x1, y1, x2 - 1, y1);
148 WritePixel(rp, x1, y2);
150 SetAPen(rp, data->dri->dri_Pens[SHINEPEN]);
151 RectFill(rp, x1 + 1, y2, x2, y2);
152 WritePixel(rp, x2, y1);
155 } /* if (data->dri) */
156 break;
158 default:
159 retval = DoSuperMethodA(cl, obj, msg);
160 break;
162 } /* switch (msg->MethodID) */
164 return retval;
166 AROS_USERFUNC_EXIT
169 /****************************************************************************/
171 #undef IntuitionBase
173 /****************************************************************************/
175 struct IClass *InitMenuBarLabelClass (struct IntuitionBase * IntuitionBase)
177 struct IClass *cl;
179 if ( (cl = MakeClass(MENUBARLABELCLASS, IMAGECLASS, NULL, sizeof(struct MenuBarLabelData), 0)) )
181 cl->cl_Dispatcher.h_Entry = (APTR)AROS_ASMSYMNAME(dispatch_menubarlabelclass);
182 cl->cl_Dispatcher.h_SubEntry = NULL;
183 cl->cl_UserData = (IPTR)IntuitionBase;
185 AddClass (cl);
188 return (cl);