gui: adapt to latest changes.

need to work on other MainWindow derivates next.
This commit is contained in:
Martin Preuss
2026-05-11 00:42:42 +02:00
parent 0ec290e29c
commit 39b3d4d174
3 changed files with 288 additions and 55 deletions

View File

@@ -54,12 +54,31 @@ MenuWin_new:
mov xl, r18 ; use root window as parent for main window
mov xh, r19
ldi r24, LOW(DLGLIGHTCONNS_SIZE)
ldi r25, HIGH(DLGLIGHTCONNS_SIZE)
bigcall Object_Alloc ; Y=space (!r16, !r17, !X)
brcc MenuWin_new_ret
rcall MenuWin_Init
MenuWin_new_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine MenuWin_new @global
;
; @param Y pointer to new MainWindow
; @param X parent widget
; @return CFLAG set of okay, cleared otherwise
MenuWin_Init:
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSOURCE_TXT_AQHOME)
ldi r21, HIGH(RESSOURCE_TXT_AQHOME)
bigcall MainWindow_new
brcc MenuWin_new_ret
bigcall MainWindow_Init
brcc MenuWin_Init_ret
; set default signal map
ldi r16, LOW(MenuWin_DefaultSignalmap*2)
@@ -67,24 +86,7 @@ MenuWin_new:
ldi r16, HIGH(MenuWin_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
; Y=MainWindow
push yl
push yh
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc MenuWin_new_popRet
mov xl, r18 ; use content window as parent
mov xh, r19
push xl ; content window
push xh
rcall menuWinCreateContent
pop xh
pop xl
MenuWin_new_popRet:
pop yh
pop yl
MenuWin_new_ret:
MenuWin_Init_ret:
ret
; @end
@@ -96,7 +98,6 @@ MenuWin_new_ret:
; @param Y pointer to MainWindow
; @param X pointer to MainWindow content window (becomes parent)
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
menuWinCreateContent:
; create MLayout
@@ -188,6 +189,74 @@ menuWinCreateButton_ret:
; ---------------------------------------------------------------------------
; @routine MenuWin_OnShow
;
; @param Y MainWindow
MenuWin_OnShow:
; check visible flag
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrc r16, WIDGET_FLAGS_VISIBLE_BIT
rjmp MenuWin_OnShow_ret
; create content
bigcall MainWindow_CreateContentWidget ; r19:r18=content window
brcc MenuWin_OnShow_ret
mov xl, r18 ; use content window as parent
mov xh, r19
; set VISIBLE flag
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
rcall menuWinCreateContent
MenuWin_OnShow_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine MenuWin_OnHide @global
;
; @param Y pointer to dialog
; @return CFLAG set of okay, cleared otherwise
; @clobbers any, !Y
MenuWin_OnHide:
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
rjmp MenuWin_OnHide_ret
; prepare destruction of content
bigcall MainWindow_GetContentWidget
brcc MenuWin_OnHide_ret
push yl
push yh
mov yl, r18
mov yh, r19
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<OBJECT_FLAGS_DESTROY_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
pop yh
pop yl
; clr VISIBLE flag
ldd r16, Y+OBJECT_OFFS_FLAGS
cbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
MenuWin_OnHide_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine MenuWin_OnCmdClimate
@@ -253,6 +322,8 @@ MenuWin_DefaultSignalmap:
; header
.dw MainWindow_DefaultSignalmap*2 ; next table to use
; entries
.db 0, WIDGET_SIGNAL_SHOW, LOW(MenuWin_OnShow), HIGH(MenuWin_OnShow)
.db 0, WIDGET_SIGNAL_HIDE, LOW(MenuWin_OnHide), HIGH(MenuWin_OnHide)
.db MENUWIN_SEL_CLIMATE, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdClimate), HIGH(MenuWin_OnCmdClimate)
.db MENUWIN_SEL_LIGHT, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdLight), HIGH(MenuWin_OnCmdLight)
.db MENUWIN_SEL_WINDOWS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdWindows), HIGH(MenuWin_OnCmdWindows)