NEW
  AUTO 3,1
				.LIST OFF	
				.OP	65C02
				.OR	$2000
				.TF bin/guitest1
*--------------------------------------
				.INB inc/macros.i
				.INB inc/a2osx.i
				.INB inc/kernel.i
				.INB inc/gfx.i
				.INB inc/libgui.i				
*--------------------------------------
				.DUMMY
				.OR ZPBIN
ZS.START
hLogo			.BS 2					00xx
hWND			.BS 1
ZS.END			.ED
*--------------------------------------
*			File Header (16 Bytes)
*--------------------------------------
CS.START		cld
				jmp (.1,x)
				.DA #$61				6502,Level 1 (65c02)
				.DA #1					BIN Layout Version 1
				.DA #S.PS.F.EVENT		S.PS.F
				.DA #0
				.DA CS.END-CS.START		Code Size (without Constants)
				.DA DS.END-DS.START		Data Segment Size
				.DA #64					Stack Size
				.DA #ZS.END-ZS.START	Zero Page Size
				.DA 0
*--------------------------------------
.1				.DA CS.INIT
				.DA CS.RUN
				.DA CS.DOEVENT
				.DA	CS.QUIT
L.LIBGUI		.DA LIBGUI
L.MouseData		.DA MouseData
L.LOGOFILE		.DA LOGOFILE
L.WND.TITLE		.DA WND.TITLE
L.WND.MBAR		.DA WND.MBAR
L.WND.STATUS	.DA WND.STATUS
L.WND.Test.fPaint	.DA WND.Test.fPaint

				.DA 0
*--------------------------------------
CS.INIT			>LDYA L.LIBGUI
				>SYSCALL LoadLib
				bcs .9

				sta hLIBGUI

*				clc
.9				rts
*--------------------------------------
CS.RUN			>LDYA L.LOGOFILE
				>SYSCALL LoadStkObj
				bcs .9

				stx hLogo
				
				jsr WND.Test
				bcs .9
				
.1				>SLEEP


				bra .1
				
				clc

.9				rts
*--------------------------------------
CS.DOEVENT		lda (pEvent)
				bpl .9


.9				sec						never discard TIME event
				rts
*--------------------------------------
CS.QUIT			clc
CS.QUIT.RTS		rts
*--------------------------------------
WND.Test		>PUSHBI S.WND.F.RESIZE+S.WND.F.MOVE+S.WND.F.CLOSE+S.WND.F.MAX+S.WND.F.MIN

				>PUSHW MouseData+S.MOUSE.X1
				>PUSHW MouseData+S.MOUSE.Y1
				>PUSHWI 360
				>PUSHWI 96
				>LIBCALL hLIBGUI,LIBGUI.WND.New
				bcs CS.QUIT.RTS
				sta hWND

				>PUSHA					A = hWND
				>PUSHBI S.WND.BGCOLOR
				>PUSHWI C.WHITE
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp

				>PUSHB hWND
				>PUSHBI S.WND.BGBM
				>PUSHW hLogo
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp

				>PUSHB hWND
				>PUSHBI S.WND.TITLE
				>PUSHW L.WND.TITLE
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp

				>PUSHB hWND
				>PUSHBI S.WND.MBAR
				>PUSHW L.WND.MBAR
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp

				>PUSHB hWND
				>PUSHBI S.WND.STATUS
				>PUSHW L.WND.STATUS
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp

				>PUSHB hWND
				>PUSHBI S.WND.fPaint
				>PUSHW L.WND.Test.fPaint
				>LIBCALL hLIBGUI,LIBGUI.OBJ.SetProp
				>STYA WND.Test.fPaint1+1

				lda hWND
				>LIBCALL hLIBGUI,LIBGUI.WND.Show

				rts
*--------------------------------------
WND.Test.fPaint	sta hWND

WND.Test.fPaint1
				jsr $ffff				Default WND.fPaint

*				>PUSHB hWND
*				>PUSHBI S.CB.OP.SET
*				>PUSHBI C.BLACK
*				>PUSHWI 10
*				>PUSHWI 10
*				>PUSHWI 200
*				>PUSHWI 60
*				>LIBCALL hLIBGUI,LIBGUI.DrawLine

				rts
*--------------------------------------
CS.END
LIBGUI			.AZ "libgui"
hLIBGUI			.BS 1
*--------------------------------------
MouseData		.BS S.MOUSE
*--------------------------------------
LOGOFILE		.AZ "${ROOT}root/bmp/A2OSX.LOGO"
WND.TITLE		.AZ "Window Title"
WND.STATUS		.AZ "Window status bar message"
*--------------------------------------
WND.MBAR		.DA #.1-*				next
				.DA #0					status
				.DA 0					X1
				.DA 0					XT
				.DA 0					X2
				.DA 0					MENU
				.AZ "File"

.1				.DA #.2-*				next
				.DA #0					status
				.DA 0					X1
				.DA 0					XT
				.DA 0					X2
				.DA 0					MENU
				.AZ "Edit"

.2				.DA #.3-*				next
				.DA #0					status
				.DA 0					X1
				.DA 0					XT
				.DA 0					X2
				.DA 0					MENU
				.AZ "Options"

.3				.DA #.4-*				next
				.DA #0					status
				.DA 0					X1
				.DA 0					XT
				.DA 0					X2
				.DA 0					MENU
				.AZ "?"

.4				.DA #0
*--------------------------------------
WND.MENU.FILE	.DA #02				ID
				.DA #S.MITEM.KEYMOD.CTRL
				.DA #'N'
				.AZ "New"
				.DA #04				ID
				.DA #S.MITEM.KEYMOD.CTRL
				.DA #'O'
				.AZ "Open..."
				.DA #06				ID
				.DA #S.MITEM.KEYMOD.CTRL
				.DA #'S'
				.AZ "Save"
				.DA #08				ID
				.DA #S.MITEM.KEYMOD.OA+S.MITEM.KEYMOD.CTRL
				.DA #'S'
				.AZ "Save As..."
				.DA #10				ID
				.DA #S.MITEM.KEYMOD.CTRL
				.DA #'Q'
				.AZ "Quit"
				.DA #0
*--------------------------------------
WND.MENU.EDIT	.DA #12				ID
				.DA #S.MITEM.KEYMOD.OA
				.DA #'X'
				.AZ "Cut"
				.DA #14				ID
				.DA #S.MITEM.KEYMOD.OA
				.DA #'C'
				.AZ "Copy"
				.DA #16				ID
				.DA #S.MITEM.KEYMOD.OA
				.DA #'V'
				.AZ "Paste"
				.DA #0
*--------------------------------------
WND.MENU.OPTIONS	.DA #18				ID
				.DA #0
				.DA #0
				.AZ "Check Me"
				.DA #0
*--------------------------------------
WND.MENU.HELP	.DA #20				ID
				.DA #0
				.DA #0
				.AZ "About..."
				.DA #0
*--------------------------------------
				.DUMMY
				.OR 0
DS.START	
DS.END			.ED
*--------------------------------------
MAN
SAVE usr/src/bin/guitest1.s
ASM
