Implement closing the file window

This commit is contained in:
Juhani Krekelä 2023-03-22 20:54:57 +02:00
parent 59535b12f9
commit bffa0c06a2
1 changed files with 28 additions and 3 deletions

View File

@ -173,9 +173,11 @@ mouse:
sub cx, [si + window.x]
cmp [si + window.width], cx
jle .outside
add cx, [si + window.x]
sub bx, [si + window.y]
cmp [si + window.height], bx
jle .outside
add bx, [si + window.y]
cmp byte [si + window.mouse_released_inside], 0
je .not_clicking
@ -213,8 +215,8 @@ mouse:
; in:
; ax = window ID
; bx = X coördinate
; cx = Y coördinate
; bx = Y coördinate
; cx = X coördinate
; dl = which buttons are held down
; si = pointer to window structure
; out:
@ -229,6 +231,18 @@ click:
.file_window:
call raise_window
; If clicked the window close button
cmp bx, [si + window.y]
jne .not_close
mov ax, [si + window.x]
add ax, [si + window.width]
dec ax
cmp ax, cx
jne .not_close
.close:
call hide_file_window
.not_close:
.end:
ret
@ -255,6 +269,16 @@ show_file_window:
.already_visible:
ret
hide_file_window:
mov cx, cs
add cx, 0x001
call unhook_window
mov byte [file_window_visible], 0
call request_redraw
ret
; in:
; al = WM_KEYBOARD
; bx = window ID
@ -589,7 +613,8 @@ disk_icon:
file_window:
db 'A', 0x0f, ':', 0x0f
times 38 db ' ', 0x0f
times 37 db ' ', 0x0f
db 'x', 0x0f
times 40 db ' ', 0xf0
times 40 db ' ', 0xf0
times 40 db ' ', 0xf0