gui2: more work on layout code.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -216,6 +216,38 @@ Layout_AddToTmpOfFillXChildren_done:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine LayoutCountExpandableChildren
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param r22 mask for OBJECT_OFFS_OPTS_LO (e.g. 1<<WIDGET_OPTSLO_FILLX_BIT)
|
||||
; @return r16 number of children with opt WIDGET_OPTSLO_FILLX_BIT
|
||||
; @clobbers r17, r18, r19
|
||||
|
||||
LayoutCountExpandableChildren:
|
||||
clr r16
|
||||
push yl
|
||||
push yh
|
||||
bigcall OBJ_GetFirstChild
|
||||
LayoutCountExpandableChildren_loop:
|
||||
brcc LayoutCountExpandableChildren_done
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
ldd r17, Y+OBJECT_OFFS_OPTS_LO
|
||||
and r17, r22
|
||||
breq LayoutCountExpandableChildren_next
|
||||
inc r16
|
||||
LayoutCountExpandableChildren_next:
|
||||
rcall OBJ_GetNext
|
||||
rjmp LayoutCountExpandableChildren_loop
|
||||
LayoutCountExpandableChildren_done:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ MAINWINDOW_OFFS_BEGIN = WIDGET_SIZE
|
||||
.equ MAINWINDOW_OFFS_BEGIN = VLAYOUT_SIZE
|
||||
; no data for now
|
||||
.equ MAINWINDOW_SIZE = MAINWINDOW_OFFS_BEGIN+0
|
||||
|
||||
@@ -69,7 +69,7 @@ MainWindow_Init:
|
||||
push r20
|
||||
push r21
|
||||
; call base class
|
||||
bigcall Widget_Init ; (r16, r17, X)
|
||||
bigcall VLayout_Init ; (r16, r17, X)
|
||||
pop r21
|
||||
pop r20
|
||||
|
||||
@@ -79,26 +79,29 @@ MainWindow_Init:
|
||||
ldi r16, HIGH(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
; move widget
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
bigcall Widget_Move ; (R16)
|
||||
; set pos and size of widget to display size
|
||||
clr r16
|
||||
std Y+WIDGET_OFFS_X_LO, r16
|
||||
std Y+WIDGET_OFFS_X_HI, r16
|
||||
std Y+WIDGET_OFFS_Y_LO, r16
|
||||
std Y+WIDGET_OFFS_Y_HI, r16
|
||||
ldi r16, LOW(DISPLAY_WIDTH)
|
||||
mov r8, r16
|
||||
std Y+WIDGET_OFFS_WIDTH_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_WIDTH)
|
||||
mov r9, r16
|
||||
|
||||
; resize widget
|
||||
std Y+WIDGET_OFFS_WIDTH_HI, r16
|
||||
ldi r16, LOW(DISPLAY_HEIGHT)
|
||||
mov r10, r16
|
||||
std Y+WIDGET_OFFS_HEIGHT_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_HEIGHT)
|
||||
mov r11, r16
|
||||
bigcall Widget_Resize ; (R16)
|
||||
std Y+WIDGET_OFFS_HEIGHT_HI, r16
|
||||
|
||||
ldi r16, LOW(MainWindow_DefaultStyle)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_DefaultStyle)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
|
||||
; create sub widgets
|
||||
rcall mainWindowCreateTitleWidget
|
||||
rcall mainWindowCreateContentWidget
|
||||
|
||||
ret
|
||||
; @end
|
||||
@@ -148,28 +151,6 @@ MainWindow_OnGetDefaultHeight:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_OnLayout @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Y
|
||||
|
||||
MainWindow_OnLayout:
|
||||
ldd r16, Y+OBJECT_OFFS_OPTS_LO
|
||||
|
||||
clr r4 ; X
|
||||
clr r5
|
||||
clr r6 ; Y
|
||||
clr r7
|
||||
|
||||
; TODO
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mainWindowCreateTitleWidget
|
||||
;
|
||||
@@ -183,11 +164,11 @@ mainWindowCreateTitleWidget:
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0
|
||||
ldi r16, (1<<WIDGET_OPTSLO_FILLX_BIT)
|
||||
ldi r17, (WIDGET_XALIGN_LEFT<<WIDGET_OPTSHI_CONTENT_XALIGN0_BIT) | (WIDGET_YALIGN_CENTER<<WIDGET_OPTSHI_CONTENT_YALIGN0_BIT)
|
||||
bigcall Label_new
|
||||
; set style for title widget
|
||||
brcc mainWindowCreateTitleWidget_done
|
||||
; set style for title widget
|
||||
ldi r16, LOW(MainWindow_TitleStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_TitleStyle*2)
|
||||
@@ -214,9 +195,16 @@ mainWindowCreateContentWidget:
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0 ; opts lo
|
||||
ldi r16, (1<<WIDGET_OPTSLO_FILLX_BIT) | (1<<WIDGET_OPTSLO_FILLY_BIT)
|
||||
ldi r17, 0 ; opts hi
|
||||
bigcall Widget_new
|
||||
brcc mainWindowCreateContentWidget_done
|
||||
; set style for title widget
|
||||
ldi r16, LOW(MainWindow_ContentStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_ContentStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
mainWindowCreateContentWidget_done:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
@@ -231,9 +219,9 @@ mainWindowCreateContentWidget:
|
||||
|
||||
MainWindow_DefaultSignalmap:
|
||||
; header
|
||||
.dw Widget_DefaultSignalmap ; next table to use
|
||||
.dw VLayout_DefaultSignalmap ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||
.db WIDGET_VALUE_DEFAULT_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(MainWindow_OnGetDefaultWidth), HIGH(MainWindow_OnGetDefaultWidth)
|
||||
.db WIDGET_VALUE_DEFAULT_HEIGHT, WIDGET_SIGNAL_GETVALUE, LOW(MainWindow_OnGetDefaultHeight), HIGH(MainWindow_OnGetDefaultHeight)
|
||||
|
||||
@@ -241,6 +229,22 @@ MainWindow_DefaultSignalmap:
|
||||
|
||||
|
||||
|
||||
MainWindow_DefaultStyle:
|
||||
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
|
||||
.dw DISPLAY_COLOR_LIGHTGREY ; backCol_norm
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_norm
|
||||
.dw DISPLAY_COLOR_WHITE ; shadowCol_norm
|
||||
|
||||
.dw DISPLAY_COLOR_WHITE ; frontCol_activated
|
||||
.dw DISPLAY_COLOR_NAVY ; backCol_activated
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_activated
|
||||
.dw DISPLAY_COLOR_WHITE ; shadowCol_activated
|
||||
|
||||
.db 0, 0 ; outerBorderSize, innerBorderSize
|
||||
.dw ili9341Font12x16_1*2 ; font
|
||||
.db 12, 16 ; charWidth, charHeight
|
||||
|
||||
|
||||
|
||||
MainWindow_TitleStyle:
|
||||
.dw STYLE_WIN_TITLE_FOREGROUND ; frontCol_norm
|
||||
@@ -259,6 +263,23 @@ MainWindow_TitleStyle:
|
||||
|
||||
|
||||
|
||||
MainWindow_ContentStyle:
|
||||
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
|
||||
.dw DISPLAY_COLOR_LIGHTGREY ; backCol_norm
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_norm
|
||||
.dw DISPLAY_COLOR_WHITE ; shadowCol_norm
|
||||
|
||||
.dw DISPLAY_COLOR_WHITE ; frontCol_activated
|
||||
.dw DISPLAY_COLOR_NAVY ; backCol_activated
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_activated
|
||||
.dw DISPLAY_COLOR_WHITE ; shadowCol_activated
|
||||
|
||||
.db 2, 1 ; outerBorderSize, innerBorderSize
|
||||
.dw ili9341Font12x16_1*2 ; font
|
||||
.db 12, 16 ; charWidth, charHeight
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
321
avr/modules/lcd2/gui2/base/vlayout.asm
Normal file
321
avr/modules/lcd2/gui2/base/vlayout.asm
Normal file
@@ -0,0 +1,321 @@
|
||||
; ***************************************************************************
|
||||
; 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_VLAYOUT_ASM
|
||||
#define AQH_AVR_GUI2_VLAYOUT_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ VLAYOUT_OFFS_BEGIN = WIDGET_SIZE
|
||||
; no data for now
|
||||
.equ VLAYOUT_SIZE = VLAYOUT_OFFS_BEGIN+0
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine VLayout_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_LO
|
||||
; @param r17 value for OBJECT_OFFS_OPTS_HI
|
||||
; @param r21:r20 ressource id for title
|
||||
; @clobbers any
|
||||
|
||||
VLayout_new:
|
||||
push r20
|
||||
push r21
|
||||
ldi r24, LOW(VLAYOUT_SIZE)
|
||||
ldi r25, HIGH(VLAYOUT_SIZE)
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
pop r21
|
||||
pop r20
|
||||
brcc VLayout_new_ret
|
||||
rcall VLayout_Init ; (r16, r17, X)
|
||||
sec
|
||||
VLayout_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine VLayout_Init @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param X parent widget (if any)
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
VLayout_Init:
|
||||
push r20
|
||||
push r21
|
||||
; call base class
|
||||
bigcall Widget_Init ; (r16, r17, X)
|
||||
pop r21
|
||||
pop r20
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(VLayout_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(VLayout_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine VLayout_OnLayout
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
VLayout_OnLayout:
|
||||
rcall vLayoutVertically
|
||||
rcall vLayoutHorizontalAdjust
|
||||
; force re-drawing of this widget
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
ori r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine VLayout_OnGetDefaultWidth
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
VLayout_OnGetDefaultWidth:
|
||||
rcall Layout_SetDefaultWidths
|
||||
rcall Layout_GetMaxTmp
|
||||
|
||||
; get outer border
|
||||
ldd zl, Y+WIDGET_OFFS_STYLE_LO
|
||||
ldd zh, Y+WIDGET_OFFS_STYLE_HI
|
||||
adiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
lpm r16, Z
|
||||
clr r17
|
||||
sbiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
|
||||
add r18, r16 ; add outer border (top)
|
||||
adc r19, r17
|
||||
|
||||
add r18, r16 ; add outer border (bottom)
|
||||
adc r19, r17
|
||||
|
||||
sec
|
||||
ret
|
||||
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine VLayout_OnGetDefaultHeight
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
VLayout_OnGetDefaultHeight:
|
||||
rcall Layout_SetDefaultHeights
|
||||
rcall Layout_SumTmpValues ; r19:r18=default width
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine vLayoutSetY
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @clobbers r16, r17, r18, r19, r20, r21, r22, r23, Z
|
||||
|
||||
vLayoutSetY:
|
||||
ldd zl, Y+WIDGET_OFFS_STYLE_LO
|
||||
ldd zh, Y+WIDGET_OFFS_STYLE_HI
|
||||
|
||||
; get spacing
|
||||
adiw zh:zl, WIDGET_STYLE_OFFS_SPACING
|
||||
lpm r22, Z
|
||||
clr r23
|
||||
sbiw zh:zl, WIDGET_STYLE_OFFS_SPACING
|
||||
; get outer border
|
||||
adiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
lpm r20, Z
|
||||
clr r21
|
||||
sbiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
|
||||
push yl
|
||||
push yh
|
||||
bigcall OBJ_GetFirstChild
|
||||
vLayoutSetY_loop:
|
||||
brcc vLayoutSetY_loopEnd
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
; set Y
|
||||
std Y+WIDGET_OFFS_Y_LO, r20
|
||||
std Y+WIDGET_OFFS_Y_HI, r21
|
||||
; set width
|
||||
ldd r16, Y+WIDGET_OFFS_TMP_LO
|
||||
ldd r17, Y+WIDGET_OFFS_TMP_HI
|
||||
std Y+WIDGET_OFFS_HEIGHT_LO, r16
|
||||
std Y+WIDGET_OFFS_HEIGHT_HI, r17
|
||||
; advance r21:r20
|
||||
add r20, r16 ; add widget size
|
||||
adc r21, r17
|
||||
add r20, r22 ; add spacing
|
||||
adc r21, r23
|
||||
|
||||
; force direct children to re-layout and re-draw
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
ori r16, (1<<WIDGET_FLAGS_DIRTY_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
|
||||
rcall OBJ_GetNext
|
||||
rjmp vLayoutSetY_loop
|
||||
vLayoutSetY_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine vLayoutHorizontalAdjust
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @clobbers r17, r18, r19, r20, r21, r22, r23, Z
|
||||
|
||||
vLayoutHorizontalAdjust:
|
||||
bigcall Layout_SetDefaultHeights
|
||||
|
||||
ldd zl, Y+WIDGET_OFFS_STYLE_LO
|
||||
ldd zh, Y+WIDGET_OFFS_STYLE_HI
|
||||
|
||||
; get outer border
|
||||
adiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
lpm r20, Z
|
||||
clr r21
|
||||
sbiw zh:zl, WIDGET_STYLE_OFFS_OUTERBORDERSIZE
|
||||
|
||||
ldd r22, Y+WIDGET_OFFS_WIDTH_LO
|
||||
ldd r23, Y+WIDGET_OFFS_WIDTH_HI
|
||||
sub r22, r20 ; subtract border (top)
|
||||
sbc r23, r21
|
||||
sub r22, r20 ; subtract border (bottom)
|
||||
sbc r23, r21
|
||||
|
||||
push yl
|
||||
push yh
|
||||
bigcall OBJ_GetFirstChild
|
||||
vLayoutHorizontalAdjust_loop:
|
||||
brcc vLayoutHorizontalAdjust_loopEnd
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
std Y+WIDGET_OFFS_X_LO, r20
|
||||
std Y+WIDGET_OFFS_X_HI, r21
|
||||
|
||||
ldd r18, Y+WIDGET_OFFS_TMP_LO
|
||||
ldd r19, Y+WIDGET_OFFS_TMP_HI
|
||||
|
||||
ldd r17, Y+OBJECT_OFFS_OPTS_LO
|
||||
sbrs r17, WIDGET_OPTSLO_FILLY_BIT
|
||||
rjmp vLayoutHorizontalAdjust_setWidth
|
||||
mov r18, r22 ; increase height to full height
|
||||
mov r19, r23
|
||||
vLayoutHorizontalAdjust_setWidth:
|
||||
std Y+WIDGET_OFFS_WIDTH_LO, r18
|
||||
std Y+WIDGET_OFFS_WIDTH_HI, r19
|
||||
rcall OBJ_GetNext
|
||||
rjmp vLayoutHorizontalAdjust_loop
|
||||
vLayoutHorizontalAdjust_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
vLayoutVertically:
|
||||
rcall Layout_SetDefaultHeights
|
||||
rcall Layout_SumTmpValues ; r21:r20=width
|
||||
|
||||
ldd r22, Y+WIDGET_OFFS_HEIGHT_LO
|
||||
ldd r23, Y+WIDGET_OFFS_HEIGHT_HI
|
||||
sub r22, r20
|
||||
sbc r23, r21
|
||||
breq vLayoutVertically_setY
|
||||
brcs vLayoutVertically_setY
|
||||
|
||||
; r23:r22=remaining space to distribute
|
||||
push r22
|
||||
ldi r22, (1<<WIDGET_OPTSLO_FILLY_BIT)
|
||||
rcall LayoutCountExpandableChildren ; r16=number of expandable child widgets
|
||||
pop r22
|
||||
tst r16
|
||||
breq vLayoutVertically_setY
|
||||
|
||||
; calc space to add to each expandable child widget and add it
|
||||
mov r20, r22
|
||||
mov r21, r23
|
||||
mov r22, r16
|
||||
clr r23
|
||||
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable child widget
|
||||
mov r20, r16
|
||||
mov r21, r17
|
||||
|
||||
ldi r22, (1<<WIDGET_OPTSLO_FILLY_BIT)
|
||||
rcall Layout_AddToTmpOfFillXChildren
|
||||
|
||||
vLayoutVertically_setY:
|
||||
rcall vLayoutSetY
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
VLayout_DefaultSignalmap:
|
||||
; header
|
||||
.dw Widget_DefaultSignalmap ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_LAYOUT, LOW(VLayout_OnLayout), HIGH(VLayout_OnLayout)
|
||||
.db WIDGET_VALUE_DEFAULT_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(VLayout_OnGetDefaultWidth), HIGH(VLayout_OnGetDefaultWidth)
|
||||
.db WIDGET_VALUE_DEFAULT_HEIGHT, WIDGET_SIGNAL_GETVALUE, LOW(VLayout_OnGetDefaultHeight), HIGH(VLayout_OnGetDefaultHeight)
|
||||
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user