107 lines
2.8 KiB
NASM
107 lines
2.8 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_GUI2_HBUTTONGROUP_ASM
|
|
#define AQH_AVR_GUI2_HBUTTONGROUP_ASM
|
|
|
|
|
|
; ***************************************************************************
|
|
; This modules is an implementation of the ButtonGroup module using a HLayout
|
|
; as base widget.
|
|
; It assumes all children to be CheckButton widgets.
|
|
; ***************************************************************************
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; defines
|
|
|
|
.equ HBUTTONGRP_OFFS_BEGIN = HLAYOUT_SIZE
|
|
.equ HBUTTONGRP_SIZE = HBUTTONGRP_OFFS_BEGIN+0
|
|
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine HButtonGroup_new @global
|
|
;
|
|
; @return CFLAG set of okay, cleared otherwise
|
|
; @return Y address of newly created object
|
|
; @param X parent widget
|
|
; @param r16 value for OBJECT_OFFS_OPTS
|
|
; @param r17 value for WIDGET_OFFS_PACK
|
|
; @param r20 layout mode (HLAYOUT_MODE_EXPAND, HLAYOUT_MODE_SPREAD)
|
|
; @clobbers any
|
|
|
|
HButtonGroup_new:
|
|
push r20
|
|
push r21
|
|
ldi r24, LOW(HBUTTONGRP_SIZE)
|
|
ldi r25, HIGH(HBUTTONGRP_SIZE)
|
|
bigcall Object_Alloc ; (!r16, !r17, !X)
|
|
pop r21
|
|
pop r20
|
|
brcc HButtonGroup_new_ret
|
|
rcall HButtonGroup_Init ; (r16, r17, X)
|
|
sec
|
|
HButtonGroup_new_ret:
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine HButtonGroup_Init @global
|
|
;
|
|
; @param Y address of widget
|
|
; @param X parent widget (if any)
|
|
; @param r16 value for OBJECT_OFFS_OPTS
|
|
; @param r17 value for WIDGET_OFFS_PACK
|
|
; @param r20 layout mode (HLAYOUT_MODE_EXPAND, HLAYOUT_MODE_SPREAD)
|
|
; @clobbers r16, r17, X
|
|
|
|
HButtonGroup_Init:
|
|
; call base class
|
|
bigcall HLayout_Init ; (r16, r17, X)
|
|
|
|
; set default signal map
|
|
ldi r16, LOW(HButtonGroup_DefaultSignalmap*2)
|
|
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
|
ldi r16, HIGH(HButtonGroup_DefaultSignalmap*2)
|
|
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
|
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; data in FLASH
|
|
|
|
HButtonGrp_DefaultSignalmap:
|
|
; header
|
|
.dw HLayout_DefaultSignalmap*2 ; next table to use
|
|
; entries
|
|
|
|
.db 0, WIDGET_SIGNAL_COMMAND, LOW(ButtonGroup_OnCommand), HIGH(ButtonGroup_OnCommand)
|
|
.db 0, 0, 0, 0 ; end of table
|
|
|
|
|
|
#endif
|
|
|