.
original commit: 47134b7404d7c72ff05a6d68f70aabadf4034800
This commit is contained in:
parent
859e7602ec
commit
5841c75590
|
@ -382,15 +382,59 @@
|
||||||
|
|
||||||
|
|
||||||
(define wx-make-window%
|
(define wx-make-window%
|
||||||
(lambda (%)
|
(lambda (% top?)
|
||||||
(class % args
|
(class % args
|
||||||
(rename [super-on-set-focus on-set-focus]
|
(rename [super-on-set-focus on-set-focus]
|
||||||
[super-on-kill-focus on-kill-focus]
|
[super-on-kill-focus on-kill-focus]
|
||||||
[super-drag-accept-files drag-accept-files])
|
[super-drag-accept-files drag-accept-files]
|
||||||
|
[super-show show]
|
||||||
|
[super-enable enable])
|
||||||
(private
|
(private
|
||||||
[top-level #f]
|
[top-level #f]
|
||||||
[focus? #f]
|
[focus? #f]
|
||||||
[container this])
|
[container this]
|
||||||
|
[visible? #f]
|
||||||
|
[active? #f])
|
||||||
|
(private
|
||||||
|
[currently?
|
||||||
|
(lambda (m)
|
||||||
|
(let loop ([p this])
|
||||||
|
(and (or (is-a? p wx:windowless-panel%)
|
||||||
|
((ivar/proc p m)))
|
||||||
|
(or (is-a? p wx:frame%)
|
||||||
|
(is-a? p wx:dialog%)
|
||||||
|
(loop (send p get-parent))))))])
|
||||||
|
(public
|
||||||
|
[on-visible
|
||||||
|
(lambda ()
|
||||||
|
(let ([vis? (currently? 'is-shown?)])
|
||||||
|
(unless (eq? vis? visible?)
|
||||||
|
(set! visible? vis?)
|
||||||
|
(as-exit
|
||||||
|
(lambda ()
|
||||||
|
(send (wx->proxy this) on-superwindow-show vis?))))))]
|
||||||
|
[queue-visible
|
||||||
|
(lambda ()
|
||||||
|
(parameterize ([wx:current-eventspace (ivar (get-top-level) eventspace)])
|
||||||
|
(wx:queue-callback (entry-point on-visible) wx:middle-queue-key)))])
|
||||||
|
(public
|
||||||
|
[on-active
|
||||||
|
(lambda ()
|
||||||
|
(let ([act? (currently? 'is-enabled?)])
|
||||||
|
(unless (eq? act? active?)
|
||||||
|
(set! active? act?)
|
||||||
|
(as-exit
|
||||||
|
(lambda ()
|
||||||
|
(send (wx->proxy this) on-superwindow-enable act?))))))]
|
||||||
|
[queue-active
|
||||||
|
(lambda ()
|
||||||
|
(parameterize ([wx:current-eventspace (ivar (get-top-level) eventspace)])
|
||||||
|
(wx:queue-callback (entry-point on-active) wx:middle-queue-key)))]
|
||||||
|
|
||||||
|
;; Needed for radio boxes:
|
||||||
|
[orig-enable
|
||||||
|
(lambda args (apply super-enable args))])
|
||||||
|
|
||||||
(public
|
(public
|
||||||
[accept-drag? #f]
|
[accept-drag? #f]
|
||||||
[get-container (lambda () container)]
|
[get-container (lambda () container)]
|
||||||
|
@ -411,6 +455,15 @@
|
||||||
[else (loop (send window get-parent))])))
|
[else (loop (send window get-parent))])))
|
||||||
top-level)])
|
top-level)])
|
||||||
(override
|
(override
|
||||||
|
[show
|
||||||
|
(lambda (on?)
|
||||||
|
(queue-visible)
|
||||||
|
(super-show on?))]
|
||||||
|
[enable
|
||||||
|
(lambda (on?)
|
||||||
|
(queue-active)
|
||||||
|
(super-enable on?))]
|
||||||
|
|
||||||
[drag-accept-files
|
[drag-accept-files
|
||||||
(lambda (on?)
|
(lambda (on?)
|
||||||
(set! accept-drag? (and on? #t))
|
(set! accept-drag? (and on? #t))
|
||||||
|
@ -429,7 +482,11 @@
|
||||||
(super-on-kill-focus)))])
|
(super-on-kill-focus)))])
|
||||||
(public
|
(public
|
||||||
[has-focus? (lambda () focus?)])
|
[has-focus? (lambda () focus?)])
|
||||||
(sequence (apply super-init args)))))
|
(sequence
|
||||||
|
(apply super-init args)
|
||||||
|
(unless top?
|
||||||
|
(set! visible? (currently? 'is-shown?))
|
||||||
|
(set! active? (currently? 'is-enabled?)))))))
|
||||||
|
|
||||||
; make-container% - for panels and top-level windows
|
; make-container% - for panels and top-level windows
|
||||||
(define (wx-make-container% %) %)
|
(define (wx-make-container% %) %)
|
||||||
|
@ -444,13 +501,14 @@
|
||||||
; capabilities necessary to serve as the frame/dialog which
|
; capabilities necessary to serve as the frame/dialog which
|
||||||
; contains container classes.
|
; contains container classes.
|
||||||
(define (make-top-container% base% dlg?)
|
(define (make-top-container% base% dlg?)
|
||||||
(class (wx-make-container% (wx-make-window% base%)) (parent . args)
|
(class (wx-make-container% (wx-make-window% base% #t)) (parent . args)
|
||||||
(inherit get-x get-y get-width get-height set-size
|
(inherit get-x get-y get-width get-height set-size
|
||||||
get-client-size is-shown? on-close)
|
get-client-size is-shown? on-close)
|
||||||
(rename [super-show show] [super-move move] [super-center center]
|
(rename [super-show show] [super-move move] [super-center center]
|
||||||
[super-on-size on-size]
|
[super-on-size on-size]
|
||||||
[super-enable enable])
|
[super-enable enable]
|
||||||
|
[super-on-visible on-visible]
|
||||||
|
[super-on-active on-active])
|
||||||
(private
|
(private
|
||||||
; have we had any redraw requests while the window has been
|
; have we had any redraw requests while the window has been
|
||||||
; hidden?
|
; hidden?
|
||||||
|
@ -688,6 +746,15 @@
|
||||||
(hash-table-remove! top-level-windows this))
|
(hash-table-remove! top-level-windows this))
|
||||||
(as-exit ; as-exit because there's an implicit wx:yield for dialogs
|
(as-exit ; as-exit because there's an implicit wx:yield for dialogs
|
||||||
(lambda () (super-show on?))))]
|
(lambda () (super-show on?))))]
|
||||||
|
|
||||||
|
[on-visible
|
||||||
|
(lambda ()
|
||||||
|
(send panel queue-visible)
|
||||||
|
(super-on-visible))]
|
||||||
|
[on-active
|
||||||
|
(lambda ()
|
||||||
|
(send panel queue-active)
|
||||||
|
(super-on-active))]
|
||||||
|
|
||||||
[move (lambda (x y) (set! use-default-position? #f) (super-move x y))]
|
[move (lambda (x y) (set! use-default-position? #f) (super-move x y))]
|
||||||
[center (lambda (dir)
|
[center (lambda (dir)
|
||||||
|
@ -866,7 +933,7 @@
|
||||||
|
|
||||||
(define make-item%
|
(define make-item%
|
||||||
(lambda (item% x-margin-w y-margin-h stretch-x stretch-y)
|
(lambda (item% x-margin-w y-margin-h stretch-x stretch-y)
|
||||||
(class (wx-make-window% item%) args
|
(class (wx-make-window% item% #f) args
|
||||||
(rename [super-on-set-focus on-set-focus]
|
(rename [super-on-set-focus on-set-focus]
|
||||||
[super-on-kill-focus on-kill-focus])
|
[super-on-kill-focus on-kill-focus])
|
||||||
(inherit get-width get-height get-x get-y
|
(inherit get-width get-height get-x get-y
|
||||||
|
@ -899,8 +966,6 @@
|
||||||
(super-set-size x y width height)))])
|
(super-set-size x y width height)))])
|
||||||
|
|
||||||
(public
|
(public
|
||||||
[orig-enable
|
|
||||||
(lambda args (apply super-enable args))]
|
|
||||||
[is-enabled?
|
[is-enabled?
|
||||||
(lambda () enabled?)])
|
(lambda () enabled?)])
|
||||||
|
|
||||||
|
@ -1184,7 +1249,7 @@
|
||||||
|
|
||||||
(define (make-top-level-window-glue% %) ; implies make-window-glue%
|
(define (make-top-level-window-glue% %) ; implies make-window-glue%
|
||||||
(class (make-window-glue% %) (mred proxy . args)
|
(class (make-window-glue% %) (mred proxy . args)
|
||||||
(inherit is-shown? get-mred)
|
(inherit is-shown? get-mred queue-visible)
|
||||||
(rename [super-on-activate on-activate])
|
(rename [super-on-activate on-activate])
|
||||||
(public
|
(public
|
||||||
[act-date/seconds 0] [act-date/milliseconds 0] [act-on? #f]
|
[act-date/seconds 0] [act-date/milliseconds 0] [act-on? #f]
|
||||||
|
@ -1202,6 +1267,7 @@
|
||||||
(if (as-exit (lambda () (send mred can-close?)))
|
(if (as-exit (lambda () (send mred can-close?)))
|
||||||
(begin
|
(begin
|
||||||
(as-exit (lambda () (send mred on-close)))
|
(as-exit (lambda () (send mred on-close)))
|
||||||
|
(queue-visible)
|
||||||
#t)
|
#t)
|
||||||
#f)
|
#f)
|
||||||
#t))))]
|
#t))))]
|
||||||
|
@ -1845,13 +1911,19 @@
|
||||||
(format "cannot make non-window area inactive in ~e: "
|
(format "cannot make non-window area inactive in ~e: "
|
||||||
(wx->proxy this))
|
(wx->proxy this))
|
||||||
non-window)))
|
non-window)))
|
||||||
|
|
||||||
|
;; Newly-added children may have been removed when
|
||||||
|
;; disabled, or now added into a disabled panel:
|
||||||
|
(for-each (lambda (child) (send child queue-active))
|
||||||
|
added-children)
|
||||||
|
|
||||||
(for-each (lambda (child) (send child show #f))
|
(for-each (lambda (child) (send child show #f))
|
||||||
removed-children)
|
removed-children)
|
||||||
(set! children new-children)
|
(set! children new-children)
|
||||||
(force-redraw)
|
(force-redraw)
|
||||||
(for-each (lambda (child) (send child show #t))
|
(for-each (lambda (child) (send child show #t))
|
||||||
added-children))))]
|
added-children))))]
|
||||||
|
|
||||||
; delete-child: removes a child from the panel.
|
; delete-child: removes a child from the panel.
|
||||||
; input: child: child to delete.
|
; input: child: child to delete.
|
||||||
; returns: nothing
|
; returns: nothing
|
||||||
|
@ -2082,9 +2154,16 @@
|
||||||
|
|
||||||
(define (wx-make-pane% wx:panel% stretch?)
|
(define (wx-make-pane% wx:panel% stretch?)
|
||||||
(class (make-container-glue% (make-glue% (wx-make-basic-panel% wx:panel% stretch?))) args
|
(class (make-container-glue% (make-glue% (wx-make-basic-panel% wx:panel% stretch?))) args
|
||||||
(inherit get-parent get-x get-y need-move-children)
|
(inherit get-parent get-x get-y need-move-children children)
|
||||||
(rename [super-set-size set-size])
|
(rename [super-set-size set-size])
|
||||||
(override
|
(override
|
||||||
|
[on-visible
|
||||||
|
(lambda ()
|
||||||
|
(for-each (lambda (c) (send c queue-visible)) children))]
|
||||||
|
[on-active
|
||||||
|
(lambda ()
|
||||||
|
(for-each (lambda (c) (send c queue-active)) children))]
|
||||||
|
|
||||||
[get-window (lambda () (send (get-parent) get-window))]
|
[get-window (lambda () (send (get-parent) get-window))]
|
||||||
[set-size (lambda (x y w h)
|
[set-size (lambda (x y w h)
|
||||||
(super-set-size x y w h)
|
(super-set-size x y w h)
|
||||||
|
@ -2095,7 +2174,20 @@
|
||||||
(apply super-init args))))
|
(apply super-init args))))
|
||||||
|
|
||||||
(define (wx-make-panel% wx:panel%)
|
(define (wx-make-panel% wx:panel%)
|
||||||
(make-container-glue% (make-window-glue% (wx-make-basic-panel% wx:panel% #t))))
|
(class (make-container-glue% (make-window-glue% (wx-make-basic-panel% wx:panel% #t))) args
|
||||||
|
(rename [super-on-visible on-visible]
|
||||||
|
[super-on-active on-active])
|
||||||
|
(inherit children)
|
||||||
|
(override
|
||||||
|
[on-visible
|
||||||
|
(lambda ()
|
||||||
|
(for-each (lambda (c) (send c queue-visible)) children)
|
||||||
|
(super-on-visible))]
|
||||||
|
[on-active
|
||||||
|
(lambda ()
|
||||||
|
(for-each (lambda (c) (send c queue-active)) children)
|
||||||
|
(super-on-active))])
|
||||||
|
(sequence (apply super-init args))))
|
||||||
|
|
||||||
(define (wx-make-linear-panel% wx-panel%)
|
(define (wx-make-linear-panel% wx-panel%)
|
||||||
(class wx-panel% args
|
(class wx-panel% args
|
||||||
|
@ -2713,12 +2805,11 @@
|
||||||
accept-drop-files on-drop-file
|
accept-drop-files on-drop-file
|
||||||
on-subwindow-char on-subwindow-event
|
on-subwindow-char on-subwindow-event
|
||||||
client->screen screen->client
|
client->screen screen->client
|
||||||
enable is-enabled?
|
enable is-enabled? on-superwindow-enable
|
||||||
get-label set-label get-plain-label
|
get-label set-label get-plain-label
|
||||||
get-client-size get-size get-width get-height get-x get-y
|
get-client-size get-size get-width get-height get-x get-y
|
||||||
get-cursor set-cursor
|
get-cursor set-cursor
|
||||||
show is-shown?
|
show is-shown? on-superwindow-show refresh))
|
||||||
refresh))
|
|
||||||
|
|
||||||
(define (make-window% top? %) ; % implements area<%>
|
(define (make-window% top? %) ; % implements area<%>
|
||||||
(class* % (window<%>) (mk-wx get-wx-panel label parent cursor)
|
(class* % (window<%>) (mk-wx get-wx-panel label parent cursor)
|
||||||
|
@ -2807,6 +2898,8 @@
|
||||||
this))))
|
this))))
|
||||||
(send wx show on?)))]
|
(send wx show on?)))]
|
||||||
[is-shown? (entry-point (lambda () (send wx is-shown?)))]
|
[is-shown? (entry-point (lambda () (send wx is-shown?)))]
|
||||||
|
[on-superwindow-show (lambda (visible?) (void))]
|
||||||
|
[on-superwindow-enable (lambda (active?) (void))]
|
||||||
|
|
||||||
[refresh (entry-point (lambda () (send wx refresh)))])
|
[refresh (entry-point (lambda () (send wx refresh)))])
|
||||||
(private
|
(private
|
||||||
|
@ -2840,7 +2933,8 @@
|
||||||
can-exit? on-exit
|
can-exit? on-exit
|
||||||
get-focus-window get-edit-target-window
|
get-focus-window get-edit-target-window
|
||||||
get-focus-object get-edit-target-object
|
get-focus-object get-edit-target-object
|
||||||
center move resize))
|
center move resize
|
||||||
|
on-message))
|
||||||
|
|
||||||
(define basic-top-level-window%
|
(define basic-top-level-window%
|
||||||
(class* (make-area-container-window% (make-window% #t (make-container% area%))) (top-level-window<%>) (mk-wx label parent)
|
(class* (make-area-container-window% (make-window% #t (make-container% area%))) (top-level-window<%>) (mk-wx label parent)
|
||||||
|
@ -2904,7 +2998,9 @@
|
||||||
(and o (wx-object->proxy o)))))]
|
(and o (wx-object->proxy o)))))]
|
||||||
[get-edit-target-object (entry-point
|
[get-edit-target-object (entry-point
|
||||||
(lambda () (let ([o (send wx get-edit-target-object)])
|
(lambda () (let ([o (send wx get-edit-target-object)])
|
||||||
(and o (wx-object->proxy o)))))])
|
(and o (wx-object->proxy o)))))]
|
||||||
|
|
||||||
|
[on-message (lambda (m) (void))])
|
||||||
(private
|
(private
|
||||||
[wx #f]
|
[wx #f]
|
||||||
[wx-panel #f]
|
[wx-panel #f]
|
||||||
|
@ -5243,3 +5339,9 @@
|
||||||
[(script) "Geneva"]
|
[(script) "Geneva"]
|
||||||
[(symbol) "Symbol"])]))
|
[(symbol) "Symbol"])]))
|
||||||
|
|
||||||
|
(define (send-message-to-window x y m)
|
||||||
|
(check-slider-integer 'send-message-to-window x)
|
||||||
|
(check-slider-integer 'send-message-to-window y)
|
||||||
|
(let ([w (wx:location->window x y)])
|
||||||
|
(and w (let ([f (wx->proxy w)])
|
||||||
|
(and f (send f on-message m))))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user