2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
8 #include <proto/utility.h>
9 #include <proto/intuition.h>
10 #include <proto/graphics.h>
11 #include <proto/cybergraphics.h>
12 #include <exec/memory.h>
13 #include <intuition/screens.h>
14 #include <intuition/icclass.h>
15 #include <intuition/cghooks.h>
16 #include <intuition/imageclass.h>
17 #include <intuition/gadgetclass.h>
18 #include <graphics/gfx.h>
19 #include <cybergraphx/cybergraphics.h>
23 #include "asl_intern.h"
29 #include <aros/debug.h>
31 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
32 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
34 #define AslBase CLASS_ASLBASE
36 /********************** ASL PROP CLASS **************************************************/
38 IPTR
AslProp__OM_NEW(Class
* cl
, Object
* o
, struct opSet
* msg
)
40 struct AslPropData
*data
;
41 struct TagItem fitags
[] =
43 {IA_FrameType
, FRAME_BUTTON
},
44 {IA_EdgesOnly
, TRUE
},
48 struct ExtGadget
*eg
= (struct ExtGadget
*)DoSuperMethodA(cl
, o
, (Msg
)msg
);
51 data
= INST_DATA(cl
, eg
);
53 eg
->BoundsLeftEdge
= eg
->LeftEdge
;
54 eg
->BoundsTopEdge
= eg
->TopEdge
;
55 eg
->BoundsWidth
= eg
->Width
;
56 eg
->BoundsHeight
= eg
->Height
;
57 eg
->MoreFlags
|= GMORE_BOUNDS
;
59 eg
->LeftEdge
+= BORDERPROPSPACINGX
;
60 eg
->TopEdge
+= BORDERPROPSPACINGY
;
61 eg
->Width
-= BORDERPROPSPACINGX
* 2;
62 eg
->Height
-= BORDERPROPSPACINGY
* 2;
64 data
->deltafactor
= 1;
65 data
->frame
= NewObjectA(NULL
, FRAMEICLASS
, fitags
);
68 CoerceMethod(cl
, (Object
*)eg
, OM_DISPOSE
);
76 /***********************************************************************************/
78 IPTR
AslProp__OM_DISPOSE(Class
* cl
, Object
* o
, Msg msg
)
80 struct AslPropData
*data
;
83 data
= INST_DATA(cl
, o
);
84 if (data
->frame
) DisposeObject(data
->frame
);
86 retval
= DoSuperMethodA(cl
, o
, msg
);
91 /***********************************************************************************/
93 IPTR
AslProp__OM_SET(Class
* cl
, Object
* o
, struct opSet
* msg
)
95 struct AslPropData
*data
;
96 const struct TagItem
*tstate
= msg
->ops_AttrList
;
99 BOOL rerender
= FALSE
;
101 data
= INST_DATA(cl
, o
);
103 while((ti
= NextTagItem(&tstate
)))
107 case ASLSC_DeltaFactor
:
108 data
->deltafactor
= (LONG
)ti
->ti_Data
;
113 if (((LONG
)ti
->ti_Data
> 0) &&
114 (((struct opUpdate
*)msg
)->opu_Flags
& OPUF_INTERIM
))
116 IPTR top
, total
, visible
, newtop
;
118 GetAttr(PGA_Top
, o
, &top
);
119 GetAttr(PGA_Total
, o
, &total
);
120 GetAttr(PGA_Visible
, o
, &visible
);
123 if (ti
->ti_Data
== ID_ARROWDEC
)
125 if (newtop
< data
->deltafactor
)
131 newtop
-= data
->deltafactor
;
137 if (top
<= total
- visible
- data
->deltafactor
)
139 newtop
+= data
->deltafactor
;
143 newtop
= total
- visible
;
149 struct TagItem set_tags
[] =
156 ops
.MethodID
= OM_SET
;
157 ops
.ops_AttrList
= set_tags
;
158 ops
.ops_GInfo
= msg
->ops_GInfo
;
160 DoMethodA(o
, (Msg
)&ops
);
162 /* rerender = TRUE; */
165 } /* if ((ti->ti_Data > 0) && (((struct opUpdate *)msg)->opu_Flags & OPUF_INTERIM)) */
167 } /* switch(ti->ti_Tag) */
169 } /* while((ti = NextTagItem(&tstate))) */
171 retval
= DoSuperMethodA(cl
, o
, (Msg
) msg
);
177 rp
= ObtainGIRPort(msg
->ops_GInfo
);
180 DoMethod(o
, GM_RENDER
, (IPTR
) msg
->ops_GInfo
, (IPTR
) rp
, GREDRAW_UPDATE
);
188 /***********************************************************************************/
190 IPTR
AslProp__GM_RENDER(Class
*cl
, struct Gadget
*g
, struct gpRender
*msg
)
192 struct AslPropData
*data
;
195 data
= INST_DATA(cl
, g
);
197 if (msg
->gpr_Redraw
== GREDRAW_REDRAW
)
199 struct TagItem im_tags
[] =
207 getgadgetcoords(g
, msg
->gpr_GInfo
, &x
, &y
, &w
, &h
);
209 x
-= BORDERPROPSPACINGX
;
210 y
-= BORDERPROPSPACINGY
;
211 w
+= BORDERPROPSPACINGX
* 2;
212 h
+= BORDERPROPSPACINGY
* 2;
214 im_tags
[0].ti_Data
= w
;
215 im_tags
[1].ti_Data
= h
;
217 SetAttrsA(data
->frame
, im_tags
);
219 DrawImageState(msg
->gpr_RPort
,
220 (struct Image
*)data
->frame
,
224 msg
->gpr_GInfo
->gi_DrInfo
);
228 struct IBox ibox
, fbox
;
235 ibox
.Left
= x
+ BORDERPROPSPACINGX
;
236 ibox
.Top
= y
+ BORDERPROPSPACINGY
;
237 ibox
.Width
= w
- BORDERPROPSPACINGX
* 2;
238 ibox
.Height
= h
- BORDERPROPSPACINGY
* 2;
240 PaintInnerFrame(msg
->gpr_RPort
,
241 msg
->gpr_GInfo
->gi_DrInfo
,
245 msg
->gpr_GInfo
->gi_DrInfo
->dri_Pens
[BACKGROUNDPEN
],
251 } /* if (msg->gpr_Redraw == GREDRAW_REDRAW) */
253 retval
= DoSuperMethodA(cl
, (Object
*)g
, (Msg
)msg
);
258 /***********************************************************************************/