fix properties
[AROS.git] / rom / intuition / barlabelclass.c
blob263283664e3c59f6ec269a0cf57ca62d52ec6136
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$
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 IPTR MenuBarLabelClass__OM_NEW(Class *cl, Object *obj, Msg msg)
58 struct Image *im = (struct Image *)DoSuperMethodA(cl, obj, msg);
60 if (im)
62 struct MenuBarLabelData *data = INST_DATA(cl, im);
63 data->dri = NULL;
66 return (IPTR)im;
69 /****************************************************************************/
71 IPTR MenuBarLabelClass__OM_SET(Class *cl, struct Image *im, struct opSet *msg)
73 struct TagItem *ti;
75 if ((ti = FindTagItem(SYSIA_DrawInfo, msg->ops_AttrList)))
77 struct MenuBarLabelData *data = INST_DATA(cl, im);
79 data->dri = (struct DrawInfo *)ti->ti_Data;
82 return DoSuperMethodA(cl, (Object *)im, (Msg)msg);
85 /****************************************************************************/
87 IPTR MenuBarLabelClass__OM_GET(Class *cl, struct Image *im, struct opGet *msg)
89 switch(msg->opg_AttrID)
91 case IA_SupportsDisable:
92 if (MENUS_AMIGALOOK)
94 *(msg->opg_Storage) = 0;
96 else
98 *(msg->opg_Storage) = 1;
100 return (IPTR)1;
102 default:
103 return DoSuperMethodA(cl, (Object *)im, (Msg)msg);
107 /****************************************************************************/
109 IPTR MenuBarLabelClass__IM_DRAW(Class *cl, struct Image *im, struct impDraw *msg)
111 struct MenuBarLabelData *data = INST_DATA(cl, im);
113 if (data->dri)
115 struct RastPort *rp = msg->imp_RPort;
116 WORD x1, y1, x2, y2;
118 if (!rp) return (IPTR)0;
120 SetDrMd(rp, JAM1);
122 x1 = im->LeftEdge + msg->imp_Offset.X;
123 y1 = im->TopEdge + msg->imp_Offset.Y;
124 x2 = x1 + im->Width - 1;
125 y2 = y1 + im->Height - 1;
128 if (MENUS_AMIGALOOK)
130 SetAPen(rp, data->dri->dri_Pens[BARDETAILPEN]);
131 RectFill(rp, x1, y1, x2, y2);
133 else
135 /* Will only work if imageheight = 2 */
136 SetAPen(rp, data->dri->dri_Pens[SHADOWPEN]);
137 RectFill(rp, x1, y1, x2 - 1, y1);
138 WritePixel(rp, x1, y2);
140 SetAPen(rp, data->dri->dri_Pens[SHINEPEN]);
141 RectFill(rp, x1 + 1, y2, x2, y2);
142 WritePixel(rp, x2, y1);
145 } /* if (data->dri) */
147 return (IPTR)0;
150 /****************************************************************************/