gui: added textButton

This commit is contained in:
Martin Preuss
2026-05-06 17:14:48 +02:00
parent 957c2ccc71
commit c7de06f812
2 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_GUI2_TEXTBUTTON_ASM
#define AQH_AVR_GUI2_TEXTBUTTON_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine TextButton_new
;
; @param X parent
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @param r21:r20 text ressource
; @param r22 selector (target will be parent, can be overridden later)
; @param r23 button mode
; @return CFLAG set if new object created, cleared on error
; @return Y button created
; @clobbers any, !X
TextButton_new:
push xl
push xh
push r20
push r21
push r22
mov r20, r23
push r16 ; opts
bigcall Button_new
pop r16
pop r22
pop r21
pop r20
brcc TextButton_new_done
mov xl, yl
mov xh, yh
push xl ; Button
push xh
push r22
; use opts from button ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
bigcall Label_new
pop r22
pop yh ; pop button into Y
pop yl
brcc TextButton_new_done
pop xh
pop xl
std Y+OBJECT_OFFS_TARGET_LO, xl
std Y+OBJECT_OFFS_TARGET_HI, xh
std Y+OBJECT_OFFS_SELECTOR, r22
rjmp TextButton_new_ret
TextButton_new_done:
pop xh
pop xl
TextButton_new_ret:
ret
; @end
#endif