center dialogs that have no location
svn: r3183
This commit is contained in:
parent
c127c5f422
commit
c5c852b88e
|
@ -208,7 +208,7 @@
|
|||
(class100*/kw basic-top-level-window% ()
|
||||
[(label [parent #f] [width #f] [height #f] [x #f] [y #f] [style null])
|
||||
top-level-window%-keywords]
|
||||
(inherit on-traverse-char on-system-menu-char)
|
||||
(inherit on-traverse-char on-system-menu-char center)
|
||||
(sequence
|
||||
(let ([cwho '(constructor dialog)])
|
||||
(check-label-string cwho label)
|
||||
|
@ -228,7 +228,7 @@
|
|||
(super-init (lambda (finish)
|
||||
(set! wx (finish (make-object wx-dialog% this this
|
||||
(and parent (mred->wx parent)) label #t
|
||||
(or x -1) (or y -1) (or width 0) (or height 0)
|
||||
(or x -11111) (or y -11111) (or width 0) (or height 0)
|
||||
style)
|
||||
#f))
|
||||
wx)
|
||||
|
|
|
@ -337,18 +337,20 @@
|
|||
(force-redraw))
|
||||
(when (and on? use-default-position?)
|
||||
(set! use-default-position? #f)
|
||||
(let*-values ([(w) (get-width)]
|
||||
[(h) (get-height)]
|
||||
[(sw sh) (get-display-size)]
|
||||
[(x x-reset?) (if (< (+ top-x w) sw)
|
||||
(values top-x #f)
|
||||
(values (max 0 (- sw w 10)) #t))]
|
||||
[(y y-reset?) (if (< (+ top-y h) sh)
|
||||
(values top-y #f)
|
||||
(values (max 0 (- sh h 20)) #t))])
|
||||
(move x y)
|
||||
(set! top-x (if x-reset? init-top-x (+ top-x 10)))
|
||||
(set! top-y (if y-reset? init-top-y (+ top-y 20)))))
|
||||
(if dlg?
|
||||
(center 'both)
|
||||
(let*-values ([(w) (get-width)]
|
||||
[(h) (get-height)]
|
||||
[(sw sh) (get-display-size)]
|
||||
[(x x-reset?) (if (< (+ top-x w) sw)
|
||||
(values top-x #f)
|
||||
(values (max 0 (- sw w 10)) #t))]
|
||||
[(y y-reset?) (if (< (+ top-y h) sh)
|
||||
(values top-y #f)
|
||||
(values (max 0 (- sh h 20)) #t))])
|
||||
(move x y)
|
||||
(set! top-x (if x-reset? init-top-x (+ top-x 10)))
|
||||
(set! top-y (if y-reset? init-top-y (+ top-y 20))))))
|
||||
(if on?
|
||||
(hash-table-put! top-level-windows this #t)
|
||||
(hash-table-remove! top-level-windows this))
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
Version 301.16
|
||||
When no location is given for a dialog%, it is centered when
|
||||
shown
|
||||
|
||||
Version 301.8
|
||||
Added 'no-sheet dialog% style
|
||||
|
|
|
@ -61,7 +61,7 @@ void wxbDialogBox::Centre(int direction)
|
|||
int width, height, x, y;
|
||||
wxFrame *frame;
|
||||
|
||||
if (direction & wxCENTER_FRAME) {
|
||||
if (1 /* direction & wxCENTER_FRAME */) {
|
||||
frame = (wxFrame*)GetParent();
|
||||
if (frame) {
|
||||
frame->GetPosition(&x_offset, &y_offset);
|
||||
|
|
Loading…
Reference in New Issue
Block a user