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