gui2: basic start works!

This commit is contained in:
Martin Preuss
2026-03-07 15:29:28 +01:00
parent 7bd83b32b4
commit 92efebccf1
4 changed files with 73 additions and 52 deletions

View File

@@ -106,6 +106,12 @@ GuiApp_Init:
ldi r16, 0 ; opts_lo
ldi r17, 0 ; opts_hi
bigcall RootWindow_new
; always visible
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
mov xl, yl
mov xh, yh
pop yh
@@ -115,6 +121,10 @@ GuiApp_Init:
std Y+GUIAPP_OFFS_ROOTWINDOW_LO, xl
std Y+GUIAPP_OFFS_ROOTWINDOW_HI, xh
; debug
std Y+GUIAPP_OFFS_CURRENTWINDOW_LO, xl
std Y+GUIAPP_OFFS_CURRENTWINDOW_HI, xh
ldi r16, GUIAPP_GUITIMER
std Y+GUIAPP_OFFS_GUITIMER, r16
@@ -235,6 +245,7 @@ GuiApp_UngrabTouchEvents_ret:
;
; @param Y address of object in SDRAM
; @param CFLAG set if response is not a NULL pointer
; @clobbers none
GuiApp_GetRootWindow:
ldd r18, Y+GUIAPP_OFFS_ROOTWINDOW_LO
@@ -430,11 +441,8 @@ guiAppSendTimerEvents:
guiAppCheckSendGuiEvents:
push yl
push yh
ldd r16, Y+GUIAPP_OFFS_CURRENTWINDOW_LO
ldd yh, Y+GUIAPP_OFFS_CURRENTWINDOW_HI
mov yl, r16
or yl, yh
breq guiAppCheckSendGuiEvents_done
rcall GuiApp_GetCurrentWindow
brcc guiAppCheckSendGuiEvents_done
ldd r16, Y+GUIAPP_OFFS_GUITIMER
tst r16
@@ -444,19 +452,23 @@ guiAppCheckSendGuiEvents:
brne guiAppCheckSendGuiEvents_done
; timer elapsed, send layout events, draw events
ldi r16, WIDGET_SIGNAL_LAYOUT
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
bigcall OBJ_TreeHandleSignalIfFlagsSet ; (any, !Y)
ldi r16, WIDGET_SIGNAL_DRAW
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
bigcall OBJ_TreeHandleSignalIfFlagsSet ; (any, !Y)
push yl
push yh
mov yl, r18
mov yh, r19
ldi r16, WIDGET_SIGNAL_LAYOUT
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
bigcall OBJ_TreeHandleSignalIfFlagsSet ; (any, !Y)
ldi r16, WIDGET_SIGNAL_DRAW
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
bigcall OBJ_TreeHandleSignalIfFlagsSet ; (any, !Y)
pop yh
pop yl
ldi r16, GUIAPP_GUITIMER
std Y+GUIAPP_OFFS_GUITIMER, r16
guiAppCheckSendGuiEvents_done:
pop yh
pop yl
@@ -488,11 +500,8 @@ guiAppSendTouchEvents:
bigcall OBJ_HandleSignal
rjmp guiAppSendTouchEvents_done
guiAppSendTouchEvents_sendToAll:
ldd r18, Y+GUIAPP_OFFS_CURRENTWINDOW_LO
ldd r19, Y+GUIAPP_OFFS_CURRENTWINDOW_HI
mov r16, r18
or r16, r19
breq guiAppSendTouchEvents_done
rcall GuiApp_GetCurrentWindow ; r19:r18=current window (none)
brcc guiAppSendTouchEvents_done
; send touch signal
mov yl, r18
mov yh, r19
@@ -550,12 +559,9 @@ guiAppSendRootMsgEvents:
guiAppSendRootEventsIfOptsLo:
push yl
push yh
ldd r18, Y+GUIAPP_OFFS_ROOTWINDOW_LO
ldd r19, Y+GUIAPP_OFFS_ROOTWINDOW_HI
mov r22, r18
or r22, r21
breq guiAppSendRootEventsIfOptsLo_done
; send touch signal
rcall GuiApp_GetRootWindow ; r19:r18=root window (none)
brcc guiAppSendRootEventsIfOptsLo_done
; send signal to root window and all below
mov yl, r18
mov yh, r19
bigcall OBJ_TreeHandleSignalIfMatchingOptsLo
@@ -605,6 +611,7 @@ GuiApp_DefaultSignalmap:
; header
.dw Object_DefaultSignalmap ; next table to use
; entries
.db 0, OBJECT_SIGNAL_TIMER, LOW(GuiApp_OnTimer), HIGH(GuiApp_OnTimer)
.db 0, OBJECT_SIGNAL_DESTROY, LOW(GuiApp_OnDestroy), HIGH(GuiApp_OnDestroy)
.db 0, 0, 0, 0 ; end of table

View File

@@ -162,14 +162,16 @@ RootWindow_DefaultSignalmap:
; header
.dw Widget_DefaultSignalmap ; next table to use
; entries
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
; .db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
.db 0, WIDGET_SIGNAL_LAYOUT, LOW(RootWindow_OnLayout), HIGH(RootWindow_OnLayout)
.db 0, 0, 0, 0 ; end of table
RootWindow_DefaultStyle:
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
.dw DISPLAY_COLOR_LIGHTGREY ; backCol_norm
; .dw DISPLAY_COLOR_LIGHTGREY ; backCol_norm
.dw DISPLAY_COLOR_YELLOW ; backCol_norm
.dw DISPLAY_COLOR_BLACK ; borderCol_norm
.dw DISPLAY_COLOR_WHITE ; shadowCol_norm

View File

@@ -33,20 +33,20 @@
; widget style object
.equ WIDGET_STYLE_OFFS_FRONTCOL_NORM = 0
.equ WIDGET_STYLE_OFFS_BACKCOL_NORM = 1
.equ WIDGET_STYLE_OFFS_BORDERCOL_NORM = 2
.equ WIDGET_STYLE_OFFS_SHADOWCOL_NORM = 3
.equ WIDGET_STYLE_OFFS_FRONTCOL_ACTIVATED = 4
.equ WIDGET_STYLE_OFFS_BACKCOL_ACTIVATED = 5
.equ WIDGET_STYLE_OFFS_BORDERCOL_ACTIVATED = 6
.equ WIDGET_STYLE_OFFS_SHADOWCOL_ACTIVATED = 7
.equ WIDGET_STYLE_OFFS_OUTERBORDERSIZE = 8
.equ WIDGET_STYLE_OFFS_SPACING = 9
.equ WIDGET_STYLE_OFFS_FONT_LO = 10
.equ WIDGET_STYLE_OFFS_FONT_HI = 11
.equ WIDGET_STYLE_OFFS_CHARWIDTH = 12
.equ WIDGET_STYLE_OFFS_CHARHEIGHT = 13
.equ WIDGET_STYLE_SIZE = 14
.equ WIDGET_STYLE_OFFS_BACKCOL_NORM = 2
.equ WIDGET_STYLE_OFFS_BORDERCOL_NORM = 4
.equ WIDGET_STYLE_OFFS_SHADOWCOL_NORM = 6
.equ WIDGET_STYLE_OFFS_FRONTCOL_ACTIVATED = 8
.equ WIDGET_STYLE_OFFS_BACKCOL_ACTIVATED = 10
.equ WIDGET_STYLE_OFFS_BORDERCOL_ACTIVATED = 12
.equ WIDGET_STYLE_OFFS_SHADOWCOL_ACTIVATED = 14
.equ WIDGET_STYLE_OFFS_OUTERBORDERSIZE = 16
.equ WIDGET_STYLE_OFFS_SPACING = 17
.equ WIDGET_STYLE_OFFS_FONT_LO = 18
.equ WIDGET_STYLE_OFFS_FONT_HI = 19
.equ WIDGET_STYLE_OFFS_CHARWIDTH = 20
.equ WIDGET_STYLE_OFFS_CHARHEIGHT = 21
.equ WIDGET_STYLE_SIZE = 22
; widget opts_lo (bits 7 and 6 used by OBJECT_OPTSLO)
.equ WIDGET_OPTSLO_INPUT_BIT = 5 ; TOUCH, KEY