NEW
  AUTO 3,1
				.LIST OFF
*--------------------------------------
* LBOX.New hParent,X1,Y1,W,H,EV.CHANGED,EV.PRESSED,pList,pVar,F	12
*--------------------------------------
LBOX.New		lda #S.OBJ.T.LBOX
				jsr OBJ.Create
				bcs .9

				>PULLA
				ldy #S.OBJ.F
				sta (ZPObjPtr),y

				ldy #S.OBJ.pVar
				jsr OBJ.PullWordY

				ldy #S.OBJ.pBuf
				jsr OBJ.PullWordY
				
				>PULLA
				ldy #S.LBOX.EV.PRESSED
				sta (ZPObjPtr),y

				>PULLA
				ldy #S.LBOX.EV.CHANGED
				sta (ZPObjPtr),y
				
				jsr OBJ.PullHW

				jsr OBJ.PullY1X1hParent

				jsr CONT.Insert
				bcs .99
				
				lda hObj
*				clc
				rts				

.9				>POP 12

.99				rts
*--------------------------------------
LBOX.Run		ldy #S.OBJ.S
				lda (ZPObjPtr),y
				bpl .9
				
				lda (pStack)			Event
				cmp #C.LF
				bne .2

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				inc
				tax
				
				jsr OBJ.GetLineXAtY
				bcs .8

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				inc
				sta (ZPObjPtr),y

				clc
				ldy #S.LBOX.VScroll
				adc (ZPObjPtr),y
			
				ldy #S.OBJ.InnerH
				cmp (ZPObjPtr),y
				bcc .7
				
				ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				inc
				sta (ZPObjPtr),y
				bra .7
				
.2				cmp #C.VT
				bne .3

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				beq .8

				dec
				sta (ZPObjPtr),y
				
				ldy #S.LBOX.VScroll
				cmp (ZPObjPtr),y
				bcs .7
				
				ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				dec
				sta (ZPObjPtr),y
				
.7				ldy #1					hObj
				lda (pStack),y
				>PUSHA

				jsr OBJ.Draw.Body
				
				inc pStack
				
				bcs .99

				jsr LBOX.SetpVar
				
				ldy #S.LBOX.EV.CHANGED
				lda (ZPObjPtr),y
				clc
				rts


.9				lda #0
				sec
.99				rts
				
.3				cmp #C.SPACE
				bne .9

				ldy #S.LBOX.EV.PRESSED
				lda (ZPObjPtr),y
				clc
				rts

.8				lda #0
				clc
				rts
*--------------------------------------
LBOX.Draw		ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				clc
				adc (pStack)			Relative Y
				tax

				jsr OBJ.GetLineXAtY
				bcs .5
				
				txa
				ldy #S.LBOX.Idx
				cmp (ZPObjPtr),y
				bne .1
	
				ldy #S.OBJ.S
				lda (ZPObjPtr),y		S.OBJ.S.bActive
				bpl .1

				ldx #SEQ.INVERSE-SEQS
				jsr LB.SeqOut
	
.1				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax

				jsr LB.Ptr1OutEscMaxX
				txa
				bne .6
				
				clc
				rts
				
.5				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax
				
.6				lda #C.SPACE

.7				jsr LB.COut
				dex
				bne .7
				
.8				clc
				rts
*--------------------------------------
LBOX.SetpVar	ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				tax
				
				jsr OBJ.GetLineXAtY
				bcs .8
				
				jsr OBJ.GetpVarPtr2

				lda ZPPtr1
				sta (ZPPtr2)
				lda ZPPtr1+1
				ldy #1
				sta (ZPPtr2),y

.8				clc				

LBOX.SetpVar.9	rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.lbox
LOAD usr/src/lib/libtui.s
ASM
