	*««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
	*
	*   Example name
	*
	*	DFRenderGadgets.s -- 1.0
	*
	*   Function
	*	This function draws the gadgets into the rastport of the window
	*	based on the GadgetList. The gadget list is a list of df_gadget
	*	structures appended after eachother and ended with a -1 lword.
	*
	*   Inputs
	*	rastport - pointer to window rastport structure
	*	gadlist - pointer to the start of the list with gadget
	*		  structures
	*   Outputs
	*	If all is ok you get the gadgets in the window.
	*
	*   Notes
	*	You may need to modify some of the include paths.
	*	You will of course also need the dfunc package which should
	*	contain includes and macros for the dfunc.library.
	*
	*	Also set UCASE = LCASE for my sources.
	*
	*   Bugs
	*	
	*   Created	: 24.2.96
	*   Last change	: 24.2.96
	*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*

*## For the Startup.asm:

StartSkip	=	0		;0=WB/CLI, 1=CLI only  (AsmOne)
Processor	=	0		;0/680x0/0x0
MathProc	=	0		;0/68881/68882/68040/68060

*## Default includes:

		Incdir	""

** external includes and lvos:

		Include	lvo:intuition.lvo

** includes from our DFuncXXXX.library archive:

		Include	lvo:dfunc.lvo

		Incdir	inc:

		Include	digital.macs
		Include	digital.i
		Include	dfunc/dfunc.i

		Include	startup.asm

		Incdir	""

	dc.b	"$VER: DFRenderGadgets 1.0 (24.2.96)",0
	even
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
Init	DefLib	dfunc,38		;open our library (macro)
	DefLib	intuition,37		;open intuition.library
	DefEnd

Start	LibBase	intuition	;use intuition base in A6 (macro)

* We will here get the frontmost screen

	moveq	#0,d0
	Call	LockIBase	;lock intuition.library base so we can
	move.l	d0,ILock	;examine it.

	move.l	60(a6),ScreenBase	;get pointer to frontmost screen

	move.l	ILock(pc),a0
	Call	UnlockIBase	;free intuition base so others can use it

	sub.l	a0,a0			;no structure
	lea	WindowTags(pc),a1	;our tag list
	move.l	ScreenBase(pc),4(a1)	;init screen pointer
	Call	OpenWindowtaglist	;try open a window
	move.l	d0,WindowBase		;store pointer to window
	beq.b	Close			;if =0 then exit, couldn't open window

	move.l	d0,a1
	move.l	50(a1),Rastport		;rastport of window
	move.l	86(a1),Userport		;userport of window

*** This is the dfunc.library function we demostrate:

	LibBase	dfunc

	move.l	Rastport(pc),a0
	lea	Gadgets(pc),a1
	DCall	RenderGadgets

***
*	You need to get a window rastport structure
*	You need a gadget list
***

Loop	move.l	Rastport(pc),a0		;pointer to rastport in window
	move.l	Userport(pc),a1		;pointer to IDCMP port
	lea	Gadgets(pc),a2		;pointer to our gadget list
	DCall	WaitGad			;wait for user to do something

	lea	Gadgets(pc),a1		;
	DCall	GetID			;if gadget, get ID number

	cmp.b	#4,d0
	bne.b	Loop			;if not QUIT, loop some more..
*·············································································*
Close	LibBase	intuition

	move.l	WindowBase(pc),d0
	beq.b	.noWindow
	move.l	d0,a0
	Call	CloseWindow		;close our window if any

.noWindow

	Return	0			;Exit
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
ILock		dc.l	0
ScreenBase	dc.l	0
WindowBase	dc.l	0

Rastport	dc.l	0
Userport	dc.l	0

Font	dc.l	FontName
	dc.w	8,0

Table		dcb.b	sw_sizeOf	;table for window size
*·············································································*
Gadgets	dc.w	10,24,132,17,1		;sizes and the ID
	dc.l	GText1,0,0,0		;texts and images pointers (pear)
	dc.l	$21101213		;colors
	dc.l	dg_TextShadow		;flags
	dc.l	Font			;pointer to FontAttr
	dc.l	0			;link

	dc.w	10,44,132,17,2
	dc.l	GText2,0,0,0
	dc.l	$21311213
	dc.l	dg_TextRight,Font,0

	dc.w	145,24,132,17,3
	dc.l	GText3,0,0,0
	dc.l	$21101212
	dc.l	dg_TextLeft,Font,0

	dc.w	145,44,132,17,4
	dc.l	GText4,0,0,0
	dc.l	$21101213
	dc.l	dg_hotkeys,Font,0

	dc.l	-1
*·············································································*
WindowTags

	dc.l	WA_CustomScreen,0,WA_IDCMP,DF_IDCMP
	dc.l	WA_Width,285,WA_Height,70,WA_Left,30,WA_Top,30
	dc.l	WA_Title,WinTitle
	dc.l	WA_Activate,-1
	dc.l	WA_ReportMouse,-1
	dc.l	WA_RMBTrap,-1
	dc.l	WA_Dragbar,-1
	dc.l	0,0
*·············································································*
FontName	dc.b	'topaz.font',0
WinTitle	dc.b	'Example: DFRenderGadgets',0

GText1		dc.b	'These gads are',0
GText2		dc.b	'DFRenderGadgets',0
GText3		dc.b	'rendered with',0
GText4		dc.b	'RqQuit: Press me!',0

;Text 4 is using hotkey:
;the Rq (beginning of line) = Right amiga + q
;See autodocs for more combinations.
;Also see the autodocs for gadget flags.
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
