Files
aqhomecontrol/avr/modules/lcd2/gui/base/cdialog.asm
2026-05-08 10:04:25 +02:00

111 lines
3.0 KiB
NASM

; ***************************************************************************
; 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_GUI_BASE_CDIALOG_ASM
#define AQH_AVR_GUI_BASE_CDIALOG_ASM
; ***************************************************************************
; defines
; CDIALOG data
.equ CDIALOG_OFFS_BEGIN = DIALOG_SIZE
.equ CDIALOG_OFFS_CONFIG_LO = CDIALOG_OFFS_BEGIN+0
.equ CDIALOG_OFFS_CONFIG_HI = CDIALOG_OFFS_BEGIN+1
.equ CDIALOG_SIZE = CDIALOG_OFFS_BEGIN+2
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine CDialog_Init @global
;
; @param Y pointer to MainWindow
; @param X pointer to root window
; @param R21:R20 title ressource
; @param r23:r22 pointer to settings (byte addr for LPM!)
; @return CFLAG set of okay, cleared otherwise
; @clobbers any, !Y
CDialog_Init:
push r22
push r23
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
bigcall Dialog_Init
pop r23
pop r22
brcc CDialog_Init_ret
; store config
std Y+CDIALOG_OFFS_CONFIG_LO, r22
std Y+CDIALOG_OFFS_CONFIG_HI, r23
; create content
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc CDialog_Init_ret
mov xl, r18 ; use content window as parent
mov xh, r19
push zl
push zh
push xl ; content window
push xh
ldd zl, Y+CDIALOG_OFFS_CONFIG_LO
ldd zh, Y+CDIALOG_OFFS_CONFIG_HI
push yl ; main window
push yh
bigcall CWidget_Create
pop yh
pop yl
pop xh
pop xl
pop zh
pop zl
CDialog_Init_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine CDialog_GetChildBySelector
;
; @param Y pointer to MainWindow
; @param r16 selector to search for
; @return CFLAG set if widget found, cleared otherwise
; @return r19:r18 resulting widget
; @clobbers R16-R19
CDialog_GetChildBySelector:
push r16
bigcall MainWindow_GetFirstChildOfContentWidget ; r19:r18=result (r16)
pop r16
brcc CDialog_GetChildBySelector_ret
push yl
push yh
mov yl, r18
mov yh, r19
bigcall OBJ_GetChildBySelector ; (R17, R18, R19)
pop yh
pop yl
CDialog_GetChildBySelector_ret:
ret
; @end
#endif