From 781478d2d2113992923c5d3a7274084c1c58a401 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Fri, 8 May 2026 12:31:53 +0200 Subject: [PATCH] gui: emit signal when dialog button clicked. --- avr/modules/lcd2/gui/base/dialog.asm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/avr/modules/lcd2/gui/base/dialog.asm b/avr/modules/lcd2/gui/base/dialog.asm index e0c43c7..d132682 100644 --- a/avr/modules/lcd2/gui/base/dialog.asm +++ b/avr/modules/lcd2/gui/base/dialog.asm @@ -24,6 +24,9 @@ .equ DIALOG_SEL_ABORTBUTTON = 2 .equ DIALOG_SEL_NEXTFREE = 3 +.equ DIALOG_RESULT_OK = 0 +.equ DIALOG_RESULT_ABORTED = 1 + ; *************************************************************************** @@ -89,18 +92,38 @@ Dialog_AddDefaultButtons_ret: + ; *************************************************************************** ; signal handlers +; --------------------------------------------------------------------------- +; @routine Dialog_OnOk @global +; +; @param Y pointer to dialog +; @clobbers any, !Y + Dialog_OnOk: - ; TODO: emit signal + ldi r16, WIDGET_SIGNAL_DIALOG_END + ldi xl, LOW(DIALOG_RESULT_OK) + ldi xh, HIGH(DIALOG_RESULT_OK) + bigcall OBJ_EmitSignal sec ret ; @end + +; --------------------------------------------------------------------------- +; @routine Dialog_OnOAbort @global +; +; @param Y pointer to dialog +; @clobbers any, !Y + Dialog_OnAbort: - ; TODO: emit signal + ldi r16, WIDGET_SIGNAL_DIALOG_END + ldi xl, LOW(DIALOG_RESULT_ABORTED) + ldi xh, HIGH(DIALOG_RESULT_ABORTED) + bigcall OBJ_EmitSignal sec ret ; @end