Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / asl / stringclass.c
blob538399b62d6f4561fb0f293b7b41ab549546b27c
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <proto/alib.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/utility.h>
13 #include <proto/intuition.h>
14 #include <proto/graphics.h>
15 #include <proto/cybergraphics.h>
16 #include <exec/memory.h>
17 #include <intuition/screens.h>
18 #include <intuition/icclass.h>
19 #include <intuition/cghooks.h>
20 #include <intuition/imageclass.h>
21 #include <intuition/gadgetclass.h>
22 #include <graphics/gfx.h>
23 #include <cybergraphx/cybergraphics.h>
25 #include <string.h>
27 #include "asl_intern.h"
28 #include "layout.h"
30 #define SDEBUG 0
31 #define DEBUG 0
33 #include <aros/debug.h>
35 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
36 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
38 #define AslBase CLASS_ASLBASE
40 /********************** ASL STRING CLASS **************************************************/
42 IPTR AslString__OM_NEW(Class * cl, Object * o, struct opSet * msg)
44 struct AslStringData *data;
45 struct TagItem fitags[] =
47 {IA_FrameType, FRAME_RIDGE},
48 {TAG_DONE, 0UL}
51 struct ExtGadget *eg = (struct ExtGadget *)DoSuperMethodA(cl, o, (Msg)msg);
52 if (eg)
54 data = INST_DATA(cl, eg);
56 eg->BoundsLeftEdge = eg->LeftEdge;
57 eg->BoundsTopEdge = eg->TopEdge;
58 eg->BoundsWidth = eg->Width;
59 eg->BoundsHeight = eg->Height;
60 eg->MoreFlags |= GMORE_BOUNDS;
62 eg->LeftEdge += BORDERSTRINGSPACINGX;
63 eg->TopEdge += BORDERSTRINGSPACINGY;
64 eg->Width -= BORDERSTRINGSPACINGX * 2;
65 eg->Height -= BORDERSTRINGSPACINGY * 2;
67 data->frame = NewObjectA(NULL, FRAMEICLASS, fitags);
68 if (!data->frame)
70 CoerceMethod(cl, (Object *)eg, OM_DISPOSE);
71 eg = NULL;
75 return (IPTR)eg;
78 /***********************************************************************************/
80 IPTR AslString__OM_DISPOSE(Class * cl, Object * o, Msg msg)
82 struct AslStringData *data;
83 IPTR retval;
85 data = INST_DATA(cl, o);
86 if (data->frame) DisposeObject(data->frame);
88 retval = DoSuperMethodA(cl, o, msg);
90 return retval;
93 /***********************************************************************************/
95 IPTR AslString__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg)
97 struct AslStringData *data;
98 IPTR retval;
100 data = INST_DATA(cl, g);
102 if (msg->gpr_Redraw == GREDRAW_REDRAW)
104 struct TagItem im_tags[] =
106 {IA_Width , 0 },
107 {IA_Height , 0 },
108 {TAG_DONE }
110 WORD x, y, w, h;
112 getgadgetcoords(g, msg->gpr_GInfo, &x, &y, &w, &h);
114 x -= BORDERSTRINGSPACINGX;
115 y -= BORDERSTRINGSPACINGY;
116 w += BORDERSTRINGSPACINGX * 2;
117 h += BORDERSTRINGSPACINGY * 2;
119 im_tags[0].ti_Data = w;
120 im_tags[1].ti_Data = h;
122 SetAttrsA(data->frame, im_tags);
124 DrawImageState(msg->gpr_RPort,
125 (struct Image *)data->frame,
128 IDS_NORMAL,
129 msg->gpr_GInfo->gi_DrInfo);
131 } /* if (msg->gpr_Redraw == GREDRAW_REDRAW) */
133 retval = DoSuperMethodA(cl, (Object *)g, (Msg)msg);
135 return retval;
138 /***********************************************************************************/