win32: clearing of transparent canvases
original commit: 54fc1e276673afe6806110fc7c30220c17cc8411
This commit is contained in:
parent
2c639351de
commit
3b842c7acf
|
@ -28,6 +28,13 @@
|
||||||
(define-user32 ShowScrollBar (_wfun _HWND _int _BOOL -> (r : _BOOL)
|
(define-user32 ShowScrollBar (_wfun _HWND _int _BOOL -> (r : _BOOL)
|
||||||
-> (unless r (failed 'ShowScrollbar))))
|
-> (unless r (failed 'ShowScrollbar))))
|
||||||
|
|
||||||
|
(define-gdi32 CreateSolidBrush (_wfun _COLORREF -> _HBRUSH))
|
||||||
|
(define-gdi32 SelectObject (_wfun _HDC _pointer -> _pointer))
|
||||||
|
(define-gdi32 DeleteObject (_wfun _pointer -> (r : _BOOL)
|
||||||
|
-> (unless r (failed 'DeleteObject))))
|
||||||
|
(define-user32 FillRect (_wfun _HDC _RECT-pointer _HBRUSH -> (r : _int)
|
||||||
|
-> (when (zero? r) (failed 'FillRect))))
|
||||||
|
|
||||||
(define _HRGN _pointer)
|
(define _HRGN _pointer)
|
||||||
(define-user32 GetDCEx (_wfun _HWND _HRGN _DWORD -> _HDC))
|
(define-user32 GetDCEx (_wfun _HWND _HRGN _DWORD -> _HDC))
|
||||||
(define DCX_WINDOW #x00000001)
|
(define DCX_WINDOW #x00000001)
|
||||||
|
@ -149,9 +156,15 @@
|
||||||
(let* ([ps (malloc 128)]
|
(let* ([ps (malloc 128)]
|
||||||
[hdc (BeginPaint w ps)])
|
[hdc (BeginPaint w ps)])
|
||||||
(unless (positive? paint-suspended)
|
(unless (positive? paint-suspended)
|
||||||
|
(let* ([hbrush (if transparent?
|
||||||
|
background-hbrush
|
||||||
|
(CreateSolidBrush bg-colorref))])
|
||||||
|
(let ([r (GetClientRect canvas-hwnd)])
|
||||||
|
(FillRect hdc r hbrush))
|
||||||
|
(unless transparent?
|
||||||
|
(DeleteObject hbrush))
|
||||||
(unless (do-backing-flush this dc hdc)
|
(unless (do-backing-flush this dc hdc)
|
||||||
(queue-paint))
|
(queue-paint))))
|
||||||
(do-backing-flush this dc hdc))
|
|
||||||
(EndPaint hdc ps))
|
(EndPaint hdc ps))
|
||||||
0]
|
0]
|
||||||
[(= msg WM_NCPAINT)
|
[(= msg WM_NCPAINT)
|
||||||
|
@ -250,10 +263,16 @@
|
||||||
|
|
||||||
(define transparent? (memq 'transparent style))
|
(define transparent? (memq 'transparent style))
|
||||||
(define bg-col (make-object color% "white"))
|
(define bg-col (make-object color% "white"))
|
||||||
|
(define bg-colorref #xFFFFFF)
|
||||||
(define/public (get-canvas-background) (if transparent?
|
(define/public (get-canvas-background) (if transparent?
|
||||||
#f
|
#f
|
||||||
bg-col))
|
bg-col))
|
||||||
(define/public (set-canvas-background col) (set! bg-col col))
|
(define/public (set-canvas-background col)
|
||||||
|
(atomically
|
||||||
|
(set! bg-col col)
|
||||||
|
(set! bg-colorref (make-COLORREF (send col red)
|
||||||
|
(send col green)
|
||||||
|
(send col blue)))))
|
||||||
|
|
||||||
(define h-scroll-visible? hscroll?)
|
(define h-scroll-visible? hscroll?)
|
||||||
(define v-scroll-visible? vscroll?)
|
(define v-scroll-visible? vscroll?)
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
16 16
|
16 16
|
||||||
ai xi))))
|
ai xi))))
|
||||||
|
|
||||||
|
(define/public (ok?) (and handle #t))
|
||||||
(define/public (get-handle) handle)
|
(define/public (get-handle) handle)
|
||||||
|
|
||||||
(def/public-unimplemented ok?)
|
|
||||||
(super-new))
|
(super-new))
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
(define-unimplemented play-sound)
|
(define-unimplemented play-sound)
|
||||||
(define-unimplemented find-graphical-system-path)
|
(define-unimplemented find-graphical-system-path)
|
||||||
(define (register-collecting-blit . args) (void))
|
(define (register-collecting-blit . args) (void))
|
||||||
(define-unimplemented unregister-collecting-blit)
|
(define (unregister-collecting-blit . args) (void))
|
||||||
(define (shortcut-visible-in-label? [? #f]) #t)
|
(define (shortcut-visible-in-label? [? #f]) #t)
|
||||||
(define-unimplemented location->window)
|
(define-unimplemented location->window)
|
||||||
(define-unimplemented send-event)
|
(define-unimplemented send-event)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
GetWindowLongW
|
GetWindowLongW
|
||||||
SetWindowLongW
|
SetWindowLongW
|
||||||
SendMessageW SendMessageW/str
|
SendMessageW SendMessageW/str
|
||||||
GetSysColor GetRValue GetGValue GetBValue
|
GetSysColor GetRValue GetGValue GetBValue make-COLORREF
|
||||||
MoveWindow
|
MoveWindow
|
||||||
ShowWindow
|
ShowWindow
|
||||||
EnableWindow
|
EnableWindow
|
||||||
|
@ -59,6 +59,10 @@
|
||||||
(define (GetRValue v) (bitwise-and v #xFF))
|
(define (GetRValue v) (bitwise-and v #xFF))
|
||||||
(define (GetGValue v) (bitwise-and (arithmetic-shift v -8) #xFF))
|
(define (GetGValue v) (bitwise-and (arithmetic-shift v -8) #xFF))
|
||||||
(define (GetBValue v) (bitwise-and (arithmetic-shift v -16) #xFF))
|
(define (GetBValue v) (bitwise-and (arithmetic-shift v -16) #xFF))
|
||||||
|
(define (make-COLORREF r g b) (bitwise-ior
|
||||||
|
r
|
||||||
|
(arithmetic-shift g 8)
|
||||||
|
(arithmetic-shift b 16)))
|
||||||
|
|
||||||
(define-user32 MoveWindow(_wfun _HWND _int _int _int _int _BOOL -> (r : _BOOL)
|
(define-user32 MoveWindow(_wfun _HWND _int _int _int _int _BOOL -> (r : _BOOL)
|
||||||
-> (unless r (failed 'MoveWindow))))
|
-> (unless r (failed 'MoveWindow))))
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
queue-window-refresh-event
|
queue-window-refresh-event
|
||||||
|
|
||||||
CreateWindowExW
|
CreateWindowExW
|
||||||
GetWindowRect)
|
GetWindowRect
|
||||||
|
GetClientRect)
|
||||||
|
|
||||||
(define (unhide-cursor) (void))
|
(define (unhide-cursor) (void))
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
(provide hInstance
|
(provide hInstance
|
||||||
DefWindowProcW
|
DefWindowProcW
|
||||||
|
background-hbrush
|
||||||
hwnd->wx
|
hwnd->wx
|
||||||
any-hwnd->wx
|
any-hwnd->wx
|
||||||
set-hwnd-wx!
|
set-hwnd-wx!
|
||||||
|
@ -87,6 +88,10 @@
|
||||||
|
|
||||||
(define hInstance (GetModuleHandleW #f))
|
(define hInstance (GetModuleHandleW #f))
|
||||||
|
|
||||||
|
(define background-hbrush (let ([p (ptr-add #f (+ COLOR_BTNFACE 1))])
|
||||||
|
(cpointer-push-tag! p 'HBRUSH)
|
||||||
|
p))
|
||||||
|
|
||||||
(void (RegisterClassW (make-WNDCLASS CS_OWNDC
|
(void (RegisterClassW (make-WNDCLASS CS_OWNDC
|
||||||
wind-proc
|
wind-proc
|
||||||
0
|
0
|
||||||
|
@ -94,9 +99,7 @@
|
||||||
hInstance
|
hInstance
|
||||||
(LoadIconW #f IDI_APPLICATION)
|
(LoadIconW #f IDI_APPLICATION)
|
||||||
#f
|
#f
|
||||||
(let ([p (ptr-add #f (+ COLOR_BTNFACE 1))])
|
background-hbrush
|
||||||
(cpointer-push-tag! p 'HBRUSH)
|
|
||||||
p)
|
|
||||||
#f ; menu
|
#f ; menu
|
||||||
"PLTFrame")))
|
"PLTFrame")))
|
||||||
|
|
||||||
|
@ -118,9 +121,7 @@
|
||||||
hInstance
|
hInstance
|
||||||
#f
|
#f
|
||||||
#f
|
#f
|
||||||
(let ([p (ptr-add #f (+ COLOR_BTNFACE 1))])
|
background-hbrush
|
||||||
(cpointer-push-tag! p 'HBRUSH)
|
|
||||||
p)
|
|
||||||
#f ; menu
|
#f ; menu
|
||||||
"PLTPanel")))
|
"PLTPanel")))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user