NListtree.mcc: fix sorted insert
[AROS.git] / rom / intuition / barlabelclass.c
blobef731af0baaa05cf658612a39c6655990fa85338
1 /*
2 Copyright © 1995-2011, 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 /*************************** BarLabelClass *****************************/
50 IPTR MenuBarLabelClass__OM_NEW(Class *cl, Object *obj, Msg msg)
52 struct Image *im = (struct Image *)DoSuperMethodA(cl, obj, msg);
54 if (im)
56 struct MenuBarLabelData *data = INST_DATA(cl, im);
57 data->dri = NULL;
60 return (IPTR)im;
63 /****************************************************************************/
65 IPTR MenuBarLabelClass__OM_SET(Class *cl, struct Image *im, struct opSet *msg)
67 struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData;
68 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
69 struct TagItem *ti;
71 if ((ti = FindTagItem(SYSIA_DrawInfo, msg->ops_AttrList)))
73 struct MenuBarLabelData *data = INST_DATA(cl, im);
75 data->dri = (struct DrawInfo *)ti->ti_Data;
78 return DoSuperMethodA(cl, (Object *)im, (Msg)msg);
81 /****************************************************************************/
83 IPTR MenuBarLabelClass__OM_GET(Class *cl, struct Image *im, struct opGet *msg)
85 struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData;
86 switch(msg->opg_AttrID)
88 case IA_SupportsDisable:
89 if (MENUS_AMIGALOOK(IntuitionBase))
91 *(msg->opg_Storage) = 0;
93 else
95 *(msg->opg_Storage) = 1;
97 return (IPTR)1;
99 default:
100 return DoSuperMethodA(cl, (Object *)im, (Msg)msg);
104 /****************************************************************************/
106 IPTR MenuBarLabelClass__IM_DRAW(Class *cl, struct Image *im, struct impDraw *msg)
108 struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData;
109 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
110 struct MenuBarLabelData *data = INST_DATA(cl, im);
112 if (data->dri)
114 struct RastPort *rp = msg->imp_RPort;
115 WORD x1, y1, x2, y2;
117 if (!rp) return (IPTR)0;
119 SetDrMd(rp, JAM1);
121 x1 = im->LeftEdge + msg->imp_Offset.X;
122 y1 = im->TopEdge + msg->imp_Offset.Y;
123 x2 = x1 + im->Width - 1;
124 y2 = y1 + im->Height - 1;
127 if (MENUS_AMIGALOOK(IntuitionBase))
129 SetAPen(rp, data->dri->dri_Pens[BARDETAILPEN]);
130 RectFill(rp, x1, y1, x2, y2);
132 else
134 /* Will only work if imageheight = 2 */
135 SetAPen(rp, data->dri->dri_Pens[SHADOWPEN]);
136 RectFill(rp, x1, y1, x2 - 1, y1);
137 WritePixel(rp, x1, y2);
139 SetAPen(rp, data->dri->dri_Pens[SHINEPEN]);
140 RectFill(rp, x1 + 1, y2, x2, y2);
141 WritePixel(rp, x2, y1);
144 } /* if (data->dri) */
146 return (IPTR)0;
149 /****************************************************************************/