gui: added routines

- Widget_DrawRect
- Widget_DrawCharAt
- Widget_GetNormalColors
- Widget_GetActivatedColors
This commit is contained in:
Martin Preuss
2026-05-05 21:15:03 +02:00
parent c059b6aad3
commit 8a41b156aa

View File

@@ -821,6 +821,25 @@ Widget_DrawBorder_ret:
; ---------------------------------------------------------------------------
; @routine Widget_DrawRect @global
;
; @param Y address of widget
; @param r3:r2 color
; @param r5:r4 X0
; @param r7:r6 Y0
; @param r9:r8 X1/W
; @param r11:r10 Y1/H
; @clobbers any, !Z
Widget_DrawRect:
rcall Widget_MakeAbsPos ; (r16, r17, r18, r19)
bigcall Display_DrawRect
ret
; @end
; ---------------------------------------------------------------------------
; @routine Widget_FillRect @global
;
@@ -864,6 +883,31 @@ Widget_DrawImage:
; ---------------------------------------------------------------------------
; @routine Widget_DrawCharAt @global
;
; @param Y address of widget
; @param R16 char to write
; @param R1:R0 background color
; @param R3:R2 foreground color
; @param R5:R4 X relative to widget
; @param R7:R6 Y relative to widget
; @clobbers any, !Y
Widget_DrawCharAt:
push r16
rcall widgetCalcAbsPosAndBorders ; (R16, R17)
pop r16
push zl
push zh
rcall widgetDrawChar ; (any, !Y, !R6, !R7, !R8, !R9, !R10, !R11)
pop zh
pop zl
ret
; @end
; ---------------------------------------------------------------------------
; @routine Widget_DrawTextFlash @global
;
@@ -1115,18 +1159,53 @@ Widget_CheckDims_ret:
; @clobbers R16
Widget_SelectColors:
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrc r16, WIDGET_FLAGS_ACTIVATED_BIT
rjmp Widget_GetActivatedColors
rjmp Widget_GetNormalColors
; @end
; ---------------------------------------------------------------------------
; @routine Widget_GetNormalColors @global
;
; @param Y address of widget
; @return r1:r0 background color
; @return r3:r2 foreground color
; @clobbers none
Widget_GetNormalColors:
push zl
push zh
ldd zl, Y+WIDGET_OFFS_STYLE_LO
ldd zh, Y+WIDGET_OFFS_STYLE_HI
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrc r16, WIDGET_FLAGS_ACTIVATED_BIT
rjmp Widget_SelectColors_activated
adiw zh:zl, WIDGET_STYLE_OFFS_FRONTCOL_NORM
rjmp Widget_SelectColors_readColors
Widget_SelectColors_activated:
lpm r2, Z+ ; read foreground color
lpm r3, Z+
lpm r0, Z+ ; read background color
lpm r1, Z
pop zh
pop zl
ret
; @end
; ---------------------------------------------------------------------------
; @routine Widget_GetActivatedColors @global
;
; @param Y address of widget
; @return r1:r0 background color
; @return r3:r2 foreground color
; @clobbers none
Widget_GetActivatedColors:
push zl
push zh
ldd zl, Y+WIDGET_OFFS_STYLE_LO
ldd zh, Y+WIDGET_OFFS_STYLE_HI
adiw zh:zl, WIDGET_STYLE_OFFS_FRONTCOL_ACTIVATED
Widget_SelectColors_readColors:
lpm r2, Z+ ; read foreground color
lpm r3, Z+
lpm r0, Z+ ; read background color