split WID_SIGNAL_GETMINSIZE into two signals.
This commit is contained in:
@@ -72,15 +72,16 @@
|
||||
.equ OBJ_SIGNAL_TIMER = 3
|
||||
.equ OBJ_SIGNAL_NEXTFREE = 4
|
||||
|
||||
.equ WID_SIGNAL_SHOW = OBJ_SIGNAL_NEXTFREE
|
||||
.equ WID_SIGNAL_HIDE = OBJ_SIGNAL_NEXTFREE+1
|
||||
.equ WID_SIGNAL_DRAW = OBJ_SIGNAL_NEXTFREE+2
|
||||
.equ WID_SIGNAL_LAYOUT = OBJ_SIGNAL_NEXTFREE+3
|
||||
.equ WID_SIGNAL_TOUCH = OBJ_SIGNAL_NEXTFREE+4
|
||||
.equ WID_SIGNAL_MOUSE = OBJ_SIGNAL_NEXTFREE+5
|
||||
.equ WID_SIGNAL_KEY = OBJ_SIGNAL_NEXTFREE+6
|
||||
.equ WID_SIGNAL_GETMINSIZE = OBJ_SIGNAL_NEXTFREE+7
|
||||
.equ WID_SIGNAL_NEXTFREE = OBJ_SIGNAL_NEXTFREE+8
|
||||
.equ WID_SIGNAL_SHOW = OBJ_SIGNAL_NEXTFREE
|
||||
.equ WID_SIGNAL_HIDE = OBJ_SIGNAL_NEXTFREE+1
|
||||
.equ WID_SIGNAL_DRAW = OBJ_SIGNAL_NEXTFREE+2
|
||||
.equ WID_SIGNAL_LAYOUT = OBJ_SIGNAL_NEXTFREE+3
|
||||
.equ WID_SIGNAL_TOUCH = OBJ_SIGNAL_NEXTFREE+4
|
||||
.equ WID_SIGNAL_MOUSE = OBJ_SIGNAL_NEXTFREE+5
|
||||
.equ WID_SIGNAL_KEY = OBJ_SIGNAL_NEXTFREE+6
|
||||
.equ WID_SIGNAL_GETMINWIDTH = OBJ_SIGNAL_NEXTFREE+7
|
||||
.equ WID_SIGNAL_GETMINHEIGHT = OBJ_SIGNAL_NEXTFREE+8
|
||||
.equ WID_SIGNAL_NEXTFREE = OBJ_SIGNAL_NEXTFREE+9
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
; ***************************************************************************
|
||||
; defs
|
||||
|
||||
.equ WID_WIDGET_INTER_BORDER = 1
|
||||
.equ WID_WIDGET_INTER_BORDER = 2
|
||||
|
||||
|
||||
|
||||
@@ -99,55 +99,98 @@ WID_Widget_end:
|
||||
; @clobbers any, !Y
|
||||
|
||||
WID_Widget_Handler:
|
||||
cpi r16, WID_SIGNAL_GETMINSIZE
|
||||
breq WID_Widget_Handler_getMinSize
|
||||
cpi r16, WID_SIGNAL_GETMINWIDTH
|
||||
breq WID_Widget_Handler_getMinWidth
|
||||
cpi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
breq WID_Widget_Handler_getMinHeight
|
||||
; for now just forward signal to all children
|
||||
WID_Widget_Handler_forward:
|
||||
rcall OBJ_ForwardSignalToChildren
|
||||
ret
|
||||
WID_Widget_Handler_getMinSize:
|
||||
rjmp widgetGetMinSize
|
||||
WID_Widget_Handler_getMinWidth:
|
||||
rjmp widgetGetMinWidth
|
||||
WID_Widget_Handler_getMinHeight:
|
||||
rjmp widgetGetMinHeight
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinSize
|
||||
; @routine widgetGetMinWidth
|
||||
;
|
||||
; @return r18 minimum width of widget
|
||||
; @return r19 minimum height of widget
|
||||
; @return r19:r18 minimum width of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetMinSize:
|
||||
widgetGetMinWidth:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r20
|
||||
clr r21
|
||||
widgetGetMinSize_loop:
|
||||
clr r24
|
||||
clr r25
|
||||
widgetGetMinWidth_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq widgetGetMinSize_loopEnd
|
||||
breq widgetGetMinWidth_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
push r20
|
||||
push r21
|
||||
ldi r16, WID_SIGNAL_GETMINSIZE
|
||||
push r24
|
||||
push r25
|
||||
ldi r16, WID_SIGNAL_GETMINWIDTH
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
pop r21
|
||||
pop r20
|
||||
add r20, r18 ; TODO: handle carry later
|
||||
subi r20, -WID_WIDGET_INTER_BORDER
|
||||
add r21, r19 ; TODO: handle carry later
|
||||
subi r21, -WID_WIDGET_INTER_BORDER
|
||||
pop r25
|
||||
pop r24
|
||||
add r24, r18 ; TODO: handle carry later
|
||||
adc r25, r19
|
||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetGetMinSize_loop
|
||||
widgetGetMinSize_loopEnd:
|
||||
mov r18, r20
|
||||
mov r19, r21
|
||||
rjmp widgetGetMinWidth_loop
|
||||
widgetGetMinWidth_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinHeight
|
||||
;
|
||||
; @return r19:r18 minimum width of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetMinHeight:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
clr r25
|
||||
widgetGetMinHeight_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq widgetGetMinHeight_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
push r24
|
||||
push r25
|
||||
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
pop r25
|
||||
pop r24
|
||||
add r24, r18 ; TODO: handle carry later
|
||||
adc r25, r19
|
||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetGetMinHeight_loop
|
||||
widgetGetMinHeight_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user