gui2: more work on layout code.

This commit is contained in:
Martin Preuss
2026-03-07 00:44:56 +01:00
parent 0af5aed2f6
commit 2cf4e414d2
5 changed files with 424 additions and 74 deletions

View File

@@ -148,35 +148,6 @@ HLayout_OnGetDefaultHeight:
; ---------------------------------------------------------------------------
; @routine hLayoutCountFillXChildren
;
; @param Y pointer to widget
; @return r16 number of children with opt WIDGET_OPTSLO_FILLX_BIT
; @clobbers r17, r18, r19
hLayoutCountFillXChildren:
clr r16
push yl
push yh
bigcall OBJ_GetFirstChild
hLayoutCountFillXChildren_loop:
brcc hLayoutCountFillXChildren_done
mov yl, r18
mov yh, r19
ldd r17, Y+OBJECT_OFFS_OPTS_LO
sbrc r17, WIDGET_OPTSLO_FILLX_BIT
inc r16
rcall OBJ_GetNext
rjmp hLayoutCountFillXChildren_loop
hLayoutCountFillXChildren_done:
pop yh
pop yl
ret
; @end
; ---------------------------------------------------------------------------
; @routine hLayoutSetX
;
@@ -302,7 +273,10 @@ hLayoutHorizontally:
brcs hLayoutHorizontally_setX
; r23:r22=remaining space to distribute
rcall hLayoutCountFillXChildren ; r16=number of expandable child widgets
push r22
ldi r22, (1<<WIDGET_OPTSLO_FILLX_BIT)
rcall LayoutCountExpandableChildren ; r16=number of expandable child widgets
pop r22
tst r16
breq hLayoutHorizontally_setX
@@ -314,6 +288,7 @@ hLayoutHorizontally:
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable child widget
mov r20, r16
mov r21, r17
ldi r22, (1<<WIDGET_OPTSLO_FILLX_BIT)
rcall Layout_AddToTmpOfFillXChildren
hLayoutHorizontally_setX: