win32: frame size and iconize fixes

original commit: 1f61bbdc513ea7f07ae764cd0a6ae640e4e19479
This commit is contained in:
Matthew Flatt 2010-11-26 08:10:31 -07:00
parent 0120b59ea5
commit 99c829cd5b
4 changed files with 25 additions and 11 deletions

View File

@ -400,7 +400,7 @@
(define BS_FLAT #x00008000)
(define BS_RIGHTBUTTON BS_LEFTTEXT)
(define CW_USEDEFAULT #x80000000)
(define CW_USEDEFAULT (- #x80000000)) ; minus sign => int instead of uint
(define WS_EX_LAYERED #x00080000)
(define WS_EX_TRANSPARENT #x00000020)

View File

@ -34,7 +34,7 @@
(class (dialog-mixin frame%)
(super-new)
(define/override (create-frame parent label w h style)
(define/override (create-frame parent label x y w h style)
(let ([hwnd
(CreateDialogIndirectParamW hInstance
(make-DLGTEMPLATE
@ -46,7 +46,9 @@
dialog-proc
0)])
(SetWindowTextW hwnd label)
(MoveWindow hwnd 0 0 w h #t)
(let ([x (if (= x -11111) 0 x)]
[y (if (= y -11111) 0 y)])
(MoveWindow hwnd x y w h #t))
hwnd))
(define/override (is-dialog?) #t)))

View File

@ -108,7 +108,7 @@
pre-on-char pre-on-event
reset-cursor-in-child)
(define/public (create-frame parent label w h style)
(define/public (create-frame parent label x y w h style)
(CreateWindowExW (if (memq 'float style)
(bitwise-ior WS_EX_TOOLWINDOW
(if (memq 'no-caption style)
@ -131,7 +131,9 @@
0
(bitwise-ior WS_CAPTION
WS_MINIMIZEBOX)))
0 0 w h
(if (= x -11111) CW_USEDEFAULT x)
(if (= y -11111) CW_USEDEFAULT y)
w h
#f
#f
hInstance
@ -146,7 +148,7 @@
(define max-height #f)
(super-new [parent #f]
[hwnd (create-frame parent label w h style)]
[hwnd (create-frame parent label x y w h style)]
[style (cons 'deleted style)])
(define hwnd (get-hwnd))
@ -185,7 +187,9 @@
(set! hidden-zoomed? (is-maximized?)))
(super direct-show on? (if hidden-zoomed?
SW_SHOWMAXIMIZED
SW_SHOW)))
SW_SHOW))
(when (and on? (iconized?))
(ShowWindow hwnd SW_RESTORE)))
(define/public (destroy)
(direct-show #f))
@ -393,7 +397,7 @@
(define/public (iconize on?)
(when (is-shown?)
(when (or on? (not (iconized?)))
(unless (eq? (and on? #t) (iconized?))
(ShowWindow hwnd (if on? SW_MINIMIZE SW_RESTORE)))))
(define/private (get-placement)

View File

@ -259,6 +259,14 @@
(pause)
(pause)
(st #t f is-iconized?)
(stv f iconize #f)
(pause)
(pause)
(st #f f is-iconized?)
(stv f iconize #t)
(pause)
(pause)
(st #t f is-iconized?)
(stv f show #t)
(pause)
(st #f f is-iconized?)
@ -277,16 +285,16 @@
(st 151 f get-height)
(printf "Resize\n")
(stv f resize 56 57)
(stv f resize 156 57)
(pause)
(FAILS (st 34 f get-x))
(FAILS (st 37 f get-y))
(st 56 f get-width)
(st 156 f get-width)
(st 57 f get-height)
(stv f center)
(pause)
(st 56 f get-width)
(st 156 f get-width)
(st 57 f get-height)
(client->screen-tests)