4 ** library code gradientslider
9 #include <exec/resident.h>
10 #include <exec/initializers.h>
11 #include <exec/execbase.h>
12 #include <exec/libraries.h>
13 #include <graphics/gfxbase.h>
16 #include <inline/exec.h>
17 #include <inline/intuition.h>
18 #include <inline/dos.h>
20 #include <pragma/exec_lib.h>
21 #include <pragma/intuition_lib.h>
22 #include <pragma/dos_lib.h>
24 #define REG( x, a ) register __## x a
29 #include "BoopsiStubs.h"
32 #define GradientSliderBase GradientSliderBase_intern
34 #include "gradientslider_intern.h"
36 /****************************************************************************/
42 /****************************************************************************/
44 STATIC
struct Library
*LibInit(REG(a0
, ULONG seglist
), REG(d0
, struct GradientSliderBase_intern
*ClassBase
), REG(a6
, struct Library
*) );
45 STATIC
struct Library
*LibOpen( REG(a6
, struct GradientSliderBase_intern
*ClassBase
) );
46 STATIC ULONG
LibExpunge( REG(a6
, struct GradientSliderBase_intern
*ClassBase
) );
47 STATIC ULONG
LibClose( REG(a6
, struct GradientSliderBase_intern
*ClassBase
) );
48 STATIC LONG
LibExtFunc(void);
51 BOOL __regargs
L_OpenLibs(struct GradientSliderBase_intern
*);
52 void __regargs
L_CloseLibs(struct GradientSliderBase_intern
*);
53 Class
* __regargs
initClass (struct GradientSliderBase_intern
*);
54 Class
* ObtainClass(REG(a6
, struct GradientSliderBase_intern
*) );
56 /****************************************************************************/
58 UBYTE LibName
[] = NAME_STRING
,
59 LibID
[] = VERSION_STRING
;
61 LONG LibVersion
= VERSION_NUMBER
,
62 LibRevision
= REVISION_NUMBER
;
76 (ULONG
) sizeof(struct GradientSliderBase_intern
),
82 struct Resident ROMTag
= /* do not change */
86 &ROMTag
+ sizeof(ROMTag
),
96 /****************************************************************************/
103 /****************************************************************************/
106 __saveds
LibInit( REG(a0
, ULONG seglist
), REG(d0
, struct GradientSliderBase_intern
*GradientSliderBase
), REG(a6
, struct Library
*ExecBase
) )
108 SysBase
= (struct ExecBase
*) ExecBase
;
109 GradientSliderBase
->seglist
= seglist
;
110 GradientSliderBase
->library
.lib_Revision
= REVISION_NUMBER
;
112 if( ( ExecBase
->lib_Version
>= 39L ) && ( ((struct ExecBase
*)SysBase
)->AttnFlags
& AFF_68020
) )
114 if(L_OpenLibs(GradientSliderBase
))
116 if(GradientSliderBase
->classptr
= InitGradientSliderClass(GradientSliderBase
))
118 return((struct Library
*)GradientSliderBase
);
122 L_CloseLibs( GradientSliderBase
);
125 FreeMem((BYTE
*)GradientSliderBase
-GradientSliderBase
->library
.lib_NegSize
,
126 GradientSliderBase
->library
.lib_NegSize
+ GradientSliderBase
->library
.lib_PosSize
);
128 ROMTag
.rt_Version
= VERSION_NUMBER
;
133 /****************************************************************************/
135 struct Library
* __saveds
LibOpen(REG(a6
, struct GradientSliderBase_intern
*GradientSliderBase
) )
137 GradientSliderBase
->library
.lib_Flags
&= ~LIBF_DELEXP
;
138 GradientSliderBase
->library
.lib_OpenCnt
++;
140 return((struct Library
*)GradientSliderBase
);
143 /****************************************************************************/
145 ULONG __saveds
LibExpunge(REG(a6
, struct GradientSliderBase_intern
*GradientSliderBase
) )
147 if(!GradientSliderBase
->library
.lib_OpenCnt
)
149 if(GradientSliderBase
->classptr
)
151 if( ! FreeClass(GradientSliderBase
->classptr
) )
153 AddClass( GradientSliderBase
->classptr
);
158 L_CloseLibs(GradientSliderBase
);
160 Remove((struct Node
*)GradientSliderBase
);
162 FreeMem((BYTE
*)GradientSliderBase
-GradientSliderBase
->library
.lib_NegSize
,
163 GradientSliderBase
->library
.lib_NegSize
+ GradientSliderBase
->library
.lib_PosSize
);
165 return( GradientSliderBase
->seglist
);
169 GradientSliderBase
->library
.lib_Flags
|= LIBF_DELEXP
;
175 /****************************************************************************/
177 ULONG __saveds
LibClose(REG(a6
, struct GradientSliderBase_intern
*GradientSliderBase
) )
179 if(GradientSliderBase
->library
.lib_OpenCnt
)
181 GradientSliderBase
->library
.lib_OpenCnt
--;
184 return((!GradientSliderBase
->library
.lib_OpenCnt
&&
185 GradientSliderBase
->library
.lib_Flags
& LIBF_DELEXP
)?LibExpunge(GradientSliderBase
):NULL
);
188 /****************************************************************************/
190 struct GfxBase
*GfxBase
;
191 struct IntuitionBase
*IntuitionBase
;
192 struct Library
*LayersBase
;
193 struct UtilityBase
*UtilityBase
;
194 struct Library
*CyberGfxBase
;
196 BOOL __regargs
L_OpenLibs( struct GradientSliderBase_intern
*GradientSliderBase
)
198 if( ( GfxBase
= OpenLibrary( "graphics.library", 39L ) ) &&
199 ( IntuitionBase
= OpenLibrary( "intuition.library", 39L ) ) &&
200 ( LayersBase
= OpenLibrary( "layers.library", 39L ) ) &&
201 ( UtilityBase
= OpenLibrary( "utility.library", 39L ) ) )
203 CyberGfxBase
= OpenLibrary( "cybergraphics.library", 40L );
211 /****************************************************************************/
213 void __regargs
L_CloseLibs( struct GradientSliderBase_intern
*GradientSliderBase
)
215 CloseLibrary( (struct Library
*)GfxBase
);
216 CloseLibrary( (struct Library
*)IntuitionBase
);
217 CloseLibrary( UtilityBase
);
218 CloseLibrary( CyberGfxBase
);
219 CloseLibrary( LayersBase
);
222 /****************************************************************************/
224 Class
* __saveds
ObtainClass(REG(a6
, struct GradientSliderBase_intern
*GradientSliderBase
) )
226 return(GradientSliderBase
->classptr
);
229 /****************************************************************************/
232 AROS_UFH3(IPTR
, dispatch_gradientsliderclass
,
233 AROS_UFHA(Class
*, cl
, A0
),
234 AROS_UFHA(Object
*, o
, A2
),
235 AROS_UFHA(Msg
, msg
, A1
))
237 ULONG __saveds
dispatch_gradientsliderclass( REG(a0
, Class
*cl
), REG(a2
, Object
*o
), REG(a1
, Msg msg
) )
244 switch(msg
->MethodID
)
247 retval
= GradientSlider__GM_HANDLEINPUT(cl
, o
, (struct gpInput
*)msg
);
252 retval
= (IPTR
)GradientSlider__OM_SET(cl
, o
, (struct opSet
*)msg
);
256 GradientSlider__GM_RENDER(cl
, o
, (struct gpRender
*)msg
);
260 retval
= GradientSlider__GM_HITTEST(cl
, o
, (struct gpHitTest
*)msg
);
264 retval
= GradientSlider__GM_GOACTIVE(cl
, o
, (struct gpInput
*)msg
);
268 retval
= GradientSlider__OM_GET(cl
, o
, (struct opGet
*)msg
);
272 retval
= (IPTR
)GradientSlider__OM_NEW(cl
, o
, (struct opSet
*)msg
);
276 GradientSlider__OM_DISPOSE(cl
, o
, msg
);
280 retval
= GradientSlider__GM_DOMAIN(cl
, o
, (struct gpDomain
*)msg
);
284 retval
= DoSuperMethodA(cl
, o
, msg
);
292 } /* dispatch_gradientsliderclass */
294 /***************************************************************************************************/
296 struct IClass
*InitGradientSliderClass (struct GradientSliderBase_intern
* GradientSliderBase
)
298 struct IClass
*cl
= NULL
;
300 if ((cl
= MakeClass("gradientslider.gadget", GADGETCLASS
, NULL
, sizeof(struct GradientSliderData
), 0)))
302 cl
->cl_Dispatcher
.h_Entry
= (HOOKFUNC
)dispatch_gradientsliderclass
;
303 cl
->cl_Dispatcher
.h_SubEntry
= NULL
;
304 cl
->cl_UserData
= (IPTR
)GradientSliderBase
;
312 /***************************************************************************************************/