A2osX/LIB/LIBGUI.S.BUT.txt
burniouf 9a7d20a7e1 ProDOS 203 / FX:TC mod for year 2022-2026
FORMAT: new switches & checks
SH:BREAK in FOR and WHILE
ASM / S-C MASM: new directives, CString support and .HX
LC / UC:bugfix
DHGR.DRV:bugfix
LIBGUI:wip
CC:wip
2022-12-07 08:02:29 +01:00

184 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
* NewBut(HWND, bFlags, wW, pICON, pTEXT, bKEYMOD, bKEY, wID, wX, wY)
*--------------------------------------
BUT.New lda #S.OBJ.T.BUT
jsr OBJ.New
* bcs .9
phx hOBJ
ldy #S.OBJ.Y1
jsr OBJ.PullWordAtY
ldy #S.OBJ.X1
jsr OBJ.PullWordAtY
ldy #S.BUT.ID
jsr OBJ.PullWordAtY
ldy #S.BUT.KEYMOD
jsr OBJ.PullWordAtY
ldy #S.BUT.pTEXT
jsr OBJ.PullWordAtY
ldy #S.BUT.pICON
jsr OBJ.PullWordAtY
ldy #S.OBJ.W
jsr OBJ.PullWordAtY
ldy #S.OBJ.F
jsr OBJ.PullByteAtY
jsr OBJ.PullHWND
ldy #S.OBJ.W
jsr OBJ.GetPropAtY
bcc .5 W in !NULL, static size
stz DX
stz DX+1
ldy #S.BUT.pICON
jsr OBJ.GetPropAtY
bcs .1 no icon
lda #16 IconW
sta DX
.1 ldy #S.BUT.pTEXT
jsr OBJ.GetPropAtY
bcs .3 no text
ldx hSYSFON
jsr FON.GetTextSize
ldy #S.OBJ.F
lda (ZPObjPtr),y
and #S.BUT.F.NOSPACE
bne .2
lda DX
beq .2
clc
adc PREFS.XSeparator
sta DX
.2 clc
lda CB.CACHE+S.CB.SrcW
adc DX
sta DX
lda CB.CACHE+S.CB.SrcW+1
adc DX+1
sta DX+1
.3 lda PREFS.XSeparator
asl
* clc
adc DX
ldy #S.OBJ.W
sta (ZPObjPtr),y
lda #0
adc DX+1
iny
sta (ZPObjPtr),y
.5 lda SYSFON.Hp2
ldy #S.OBJ.H
sta (ZPObjPtr),y
>LDYA ZPObjPtr
jsr OBJ.SetX2Y2
.8 jsr WND.AddChild.I
pla hOBJ
clc
rts
.9 >POP 16
rts
*--------------------------------------
BUT.Enter ldy #S.OBJ.S
lda (ZPObjPtr),y
bpl BUT.Paint
.8 clc
rts
*--------------------------------------
BUT.Leave ldy #S.OBJ.S
lda (ZPObjPtr),y
bpl .8
bit #S.BUT.F.NOLEAVE
beq BUT.Paint
.8 clc
rts
*--------------------------------------
BUT.Close
clc
rts
*--------------------------------------
BUT.Paint eor #S.BUT.S.SELECTED
sta (ZPObjPtr),y
jsr WND.GetInnerInClip
BUT.fPaint jsr CB.GetBuf
bcs .9
ldx #1
jsr DRAW.BordersAtX
ldx #C.WHITE
ldy #S.OBJ.S
lda (ZPObjPtr),y
bpl .1
* and #S.BUT.S.SELECTED
* beq .1
ldx #C.BLACK
.1 txa
jsr CB.FillRectMonoA
jsr CB.GetObjX1Y1X2Y2
jsr CB.Cache2CBBufG
ldy #S.BUT.pTEXT
jsr OBJ.GetPropAtY
ldx hSYSFON
jsr FON.GetTextSize
jsr CB.SrcWCenterH
jsr CB.IncY1
ldy #S.BUT.pTEXT
jsr OBJ.GetPropAtY
ldx hSYSFON
jsr DRAW.YAText
.8 jmp CB.FlushBuf
.9 rts
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.but
LOAD usr/src/lib/libgui.s
ASM