gui2: started working on autolayout.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#ifndef AQH_AVR_GUI2_MAINWINDOW_ASM
|
||||
#define AQH_AVR_GUI2_MAINWINDOW_ASM
|
||||
|
||||
; TODO: base on VLayout!
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
@@ -32,15 +34,20 @@
|
||||
;
|
||||
; @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 X parent widget
|
||||
; @param r21:r20 ressource id for title
|
||||
; @clobbers any
|
||||
|
||||
MainWindow_new:
|
||||
ldi r24, LOW(MAINWINDOW_SIZE)
|
||||
ldi r25, HIGH(MAINWINDOW_SIZE)
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
push r20
|
||||
push r21
|
||||
ldi r24, LOW(MAINWINDOW_SIZE)
|
||||
ldi r25, HIGH(MAINWINDOW_SIZE)
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
pop r21
|
||||
pop r20
|
||||
brcc MainWindow_new_ret
|
||||
rcall MainWindow_Init ; (r16, r17, X)
|
||||
sec
|
||||
@@ -55,11 +62,22 @@ MainWindow_new_ret:
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param X parent widget (if any)
|
||||
; @param r21:r20 ressource id for title
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
MainWindow_Init:
|
||||
; call base class
|
||||
bigcall Widget_Init ; (r16, r17, X)
|
||||
push r20
|
||||
push r21
|
||||
; call base class
|
||||
bigcall Widget_Init ; (r16, r17, X)
|
||||
pop r21
|
||||
pop r20
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
; move widget
|
||||
clr r4
|
||||
@@ -79,6 +97,9 @@ MainWindow_Init:
|
||||
mov r11, r16
|
||||
bigcall Widget_Resize ; (R16)
|
||||
|
||||
; create sub widgets
|
||||
rcall mainWindowCreateTitleWidget
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -86,5 +107,158 @@ MainWindow_Init:
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_OnGetDefaultWidth @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param r17 value requested
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @return CFLAG set if signal handled
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MainWindow_OnGetDefaultWidth:
|
||||
ldi r18, LOW(DISPLAY_WIDTH)
|
||||
ldi r19, HIGH(DISPLAY_WIDTH)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_OnGetDefaultHeight @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param r17 value requested
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @return CFLAG set if signal handled
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MainWindow_OnGetDefaultHeight:
|
||||
ldi r18, LOW(DISPLAY_HEIGHT)
|
||||
ldi r19, HIGH(DISPLAY_HEIGHT)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @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
|
||||
;
|
||||
; @param Y address of main window widget
|
||||
; @param r21:r20 ressource id for title
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
|
||||
mainWindowCreateTitleWidget:
|
||||
; create title widget
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0
|
||||
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
|
||||
ldi r16, LOW(MainWindow_TitleStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_TitleStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
sec
|
||||
mainWindowCreateTitleWidget_done:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mainWindowCreateContentWidget
|
||||
;
|
||||
; @param Y address of main window widget
|
||||
; @param r21:r20 ressource id for title
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
|
||||
mainWindowCreateContentWidget:
|
||||
; create content widget
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0 ; opts lo
|
||||
ldi r17, 0 ; opts hi
|
||||
bigcall Widget_new
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
MainWindow_DefaultSignalmap:
|
||||
; header
|
||||
.dw Widget_DefaultSignalmap ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
|
||||
.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)
|
||||
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
|
||||
MainWindow_TitleStyle:
|
||||
.dw STYLE_WIN_TITLE_FOREGROUND ; frontCol_norm
|
||||
.dw STYLE_WIN_TITLE_BACKGROUND ; 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, 1 ; outerBorderSize, innerBorderSize
|
||||
.dw ili9341Font12x16_1*2 ; font
|
||||
.db 12, 16 ; charWidth, charHeight
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user