gui2: more work on layouting.
This commit is contained in:
@@ -91,9 +91,10 @@ HLayout_Init:
|
||||
HLayout_OnLayout:
|
||||
rcall hLayoutHorizontally
|
||||
rcall hLayoutVerticalAdjust
|
||||
; force re-drawing of this widget
|
||||
; force re-drawing of this widget, clear layout bit
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
ori r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
sbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
cbr r16, (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
sec
|
||||
ret
|
||||
|
||||
@@ -79,21 +79,6 @@ MainWindow_Init:
|
||||
ldi r16, HIGH(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, 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)
|
||||
std Y+WIDGET_OFFS_WIDTH_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_WIDTH)
|
||||
std Y+WIDGET_OFFS_WIDTH_HI, r16
|
||||
ldi r16, LOW(DISPLAY_HEIGHT)
|
||||
std Y+WIDGET_OFFS_HEIGHT_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_HEIGHT)
|
||||
std Y+WIDGET_OFFS_HEIGHT_HI, r16
|
||||
|
||||
ldi r16, LOW(MainWindow_DefaultStyle)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_DefaultStyle)
|
||||
|
||||
@@ -71,6 +71,21 @@ RootWindow_Init:
|
||||
ldi r17, (ROOTWINDOW_SIZE-ROOTWINDOW_OFFS_BEGIN)
|
||||
bigcall Utils_FillSram ; (r17, X)
|
||||
|
||||
; 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)
|
||||
std Y+WIDGET_OFFS_WIDTH_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_WIDTH)
|
||||
std Y+WIDGET_OFFS_WIDTH_HI, r16
|
||||
ldi r16, LOW(DISPLAY_HEIGHT)
|
||||
std Y+WIDGET_OFFS_HEIGHT_LO, r16
|
||||
ldi r16, HIGH(DISPLAY_HEIGHT)
|
||||
std Y+WIDGET_OFFS_HEIGHT_HI, r16
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(RootWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
@@ -120,6 +135,53 @@ RootWindow_SetApp:
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine RootWindow_OnLayout
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
RootWindow_OnLayout:
|
||||
ldd r20, Y+WIDGET_OFFS_WIDTH_LO
|
||||
ldd r21, Y+WIDGET_OFFS_WIDTH_HI
|
||||
ldd r22, Y+WIDGET_OFFS_HEIGHT_LO
|
||||
ldd r23, Y+WIDGET_OFFS_HEIGHT_HI
|
||||
|
||||
push yl
|
||||
push yh
|
||||
bigcall OBJ_GetFirstChild
|
||||
RootWindow_OnLayout_loop:
|
||||
brcc RootWindow_OnLayout_ret
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
; all children are MainWindow, set to fullscreen
|
||||
std Y+WIDGET_OFFS_WIDTH_LO, r20
|
||||
std Y+WIDGET_OFFS_WIDTH_HI, r21
|
||||
std Y+WIDGET_OFFS_HEIGHT_LO, r22
|
||||
std Y+WIDGET_OFFS_HEIGHT_HI, r23
|
||||
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
|
||||
|
||||
; force redraw
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
sbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
|
||||
rcall OBJ_GetNext
|
||||
rjmp RootWindow_OnLayout_loop
|
||||
RootWindow_OnLayout_ret:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -129,9 +191,10 @@ RootWindow_SetApp:
|
||||
|
||||
RootWindow_DefaultSignalmap:
|
||||
; header
|
||||
.dw MainWindow_DefaultSignalmap ; next table to use
|
||||
.dw Widget_DefaultSignalmap ; next table to use
|
||||
; entries
|
||||
; none for now
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
|
||||
.db 0, WIDGET_SIGNAL_LAYOUT, LOW(RootWindow_OnLayout), HIGH(RootWindow_OnLayout)
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
@@ -146,7 +209,7 @@ RootWindow_DefaultStyle:
|
||||
.dw DISPLAY_COLOR_BLACK ; borderCol_activated
|
||||
.dw DISPLAY_COLOR_WHITE ; shadowCol_activated
|
||||
|
||||
.db 0, 1 ; outerBorderSize, innerBorderSize
|
||||
.db 0, 0 ; outerBorderSize, innerBorderSize
|
||||
.dw ili9341Font12x16_1*2 ; font
|
||||
.db 12, 16 ; charWidth, charHeight
|
||||
|
||||
|
||||
@@ -91,9 +91,10 @@ VLayout_Init:
|
||||
VLayout_OnLayout:
|
||||
rcall vLayoutVertically
|
||||
rcall vLayoutHorizontalAdjust
|
||||
; force re-drawing of this widget
|
||||
; force re-drawing of this widget, clear layout bit
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
ori r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
sbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
cbr r16, (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
sec
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user