2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <proto/alib.h>
10 #include <proto/exec.h>
11 #include <proto/utility.h>
12 #include <proto/intuition.h>
13 #include <proto/graphics.h>
14 #include <proto/layers.h>
16 #include <exec/memory.h>
17 #include <intuition/screens.h>
18 #include <intuition/cghooks.h>
19 #include <intuition/imageclass.h>
20 #include <intuition/gadgetclass.h>
21 #include <graphics/gfx.h>
25 #include "asl_intern.h"
31 #include <aros/debug.h>
36 #define NewRectRegion(_MinX,_MinY,_MaxX,_MaxY) \
37 ({ struct Region *_region; \
38 if ((_region = NewRegion())) \
39 { struct Rectangle _rect; \
44 if (!OrRectRegion(_region, &_rect)) { DisposeRegion(_region); _region = NULL; } \
52 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
53 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
55 #define AslBase CLASS_ASLBASE
57 /********************** ASL ERASER CLASS **************************************************/
59 IPTR
AslEraser__OM_NEW(Class
* cl
, Object
* o
, struct opSet
* msg
)
61 struct Gadget
*g
= (struct Gadget
*)DoSuperMethodA(cl
, o
, (Msg
)msg
);
65 g
->Flags
|= GFLG_RELSPECIAL
;
77 /***********************************************************************************/
79 IPTR
AslEraser__GM_HITTEST(Class
*cl
, Object
*o
, struct gpHitTest
*msg
)
85 /***********************************************************************************/
87 IPTR
AslEraser__GM_RENDER(Class
*cl
, Object
*o
, struct gpRender
*msg
)
89 WORD x
, y
, w
, h
, x2
, y2
;
91 if (msg
->gpr_Redraw
== GREDRAW_REDRAW
)
93 struct Window
*win
= msg
->gpr_GInfo
->gi_Window
;
94 struct RastPort
*rp
= msg
->gpr_RPort
;
97 if ((clip
= NewRectRegion(win
->BorderLeft
,
99 win
->Width
- 1 - win
->BorderRight
,
100 win
->Height
- 1 - win
->BorderBottom
)))
102 struct Gadget
*g
= win
->FirstGadget
;
103 struct RegionRectangle
*rr
;
107 struct Rectangle rect
;
109 getgadgetbounds(g
, msg
->gpr_GInfo
, &x
, &y
, &w
, &h
);
113 rect
.MaxX
= x
+ w
- 1;
114 rect
.MaxY
= y
+ h
- 1;
116 ClearRectRegion(clip
, &rect
);
122 SetABPenDrMd(rp
, msg
->gpr_GInfo
->gi_DrInfo
->dri_Pens
[BACKGROUNDPEN
], 0, JAM2
);
123 rr
= clip
->RegionRectangle
;
126 x
= clip
->bounds
.MinX
+ rr
->bounds
.MinX
;
127 y
= clip
->bounds
.MinY
+ rr
->bounds
.MinY
;
128 x2
= clip
->bounds
.MinX
+ rr
->bounds
.MaxX
;
129 y2
= clip
->bounds
.MinY
+ rr
->bounds
.MaxY
;
131 RectFill(rp
, x
, y
, x2
, y2
);
140 } /* if (msg->gpr_Redraw == GREDRAW_REDRAW) */
145 /***********************************************************************************/