refactor out SimulateClick

This commit is contained in:
4am 2018-04-02 15:26:05 -04:00
parent 84cafe4c7f
commit 94b54cf04e
3 changed files with 27 additions and 20 deletions

View File

@ -9,6 +9,7 @@
; - CreateButton ; - CreateButton
; - PaintTitleBar ; - PaintTitleBar
; - PrintAt ; - PrintAt
; - SimulateClick
; ;
; Public constants ; Public constants
; - kStringOK ; - kStringOK
@ -95,18 +96,18 @@ PaintTitleBar
ldx #WGSetGlobalCursor ldx #WGSetGlobalCursor
jsr WeeGUI jsr WeeGUI
ldx #WGPlot ldx #WGPlot
lda .stringTitle,y lda kStringGlobalTitle,y
jsr WeeGUI jsr WeeGUI
dey dey
bpl - bpl -
ldx #WGSyncGlobalCursor ldx #WGSyncGlobalCursor
jmp WeeGUI jmp WeeGUI
.stringTitle kStringGlobalTitle
!raw " " !raw " "
!byte 16 !byte 16 ; inverse P
!raw "itch " !raw "itch "
!byte 4 !byte 4 ; inverse D
!raw "ark ",0 !raw "ark ",0
} }
@ -135,3 +136,23 @@ PrintAt
ldx #WGPrint ldx #WGPrint
jmp WeeGUI jmp WeeGUI
} }
;------------------------------------------------------------------------------
; SimulateClick
; select, focus, activate, and unfocus a WeeGUI view
;
; in: WeeGUI loaded and initialized
; A contains WeeGUI view ID
; out: X clobbered
;------------------------------------------------------------------------------
!zone {
SimulateClick
ldx #WGSelectView
jsr WeeGUI
ldx #WGViewFocus
jsr WeeGUI
ldx #WGViewFocusAction
jsr WeeGUI
ldx #WGViewUnfocus
jmp WeeGUI
}

View File

@ -99,15 +99,8 @@ HandleKey
tax tax
ldy gViewInUse,x ldy gViewInUse,x
beq .notFound beq .notFound
ldx #WGSelectView
jsr WeeGUI
.focusAndDoAction .focusAndDoAction
ldx #WGViewFocus jmp SimulateClick
jsr WeeGUI
ldx #WGViewFocusAction
jsr WeeGUI
ldx #WGViewUnfocus
jmp WeeGUI
.y .y
lda .xyzzy lda .xyzzy
cmp #1 cmp #1

View File

@ -127,14 +127,7 @@ HandleOptionsKey
jmp SoftBell jmp SoftBell
.foundKey .foundKey
lda .keys+1,x lda .keys+1,x
ldx #WGSelectView jmp SimulateClick
jsr WeeGUI
ldx #WGViewFocus
jsr WeeGUI
ldx #WGViewFocusAction
jsr WeeGUI
ldx #WGViewUnfocus
jmp WeeGUI
callback_options_ok callback_options_ok
jsr SetPrefByCheckbox jsr SetPrefByCheckbox