strengthen shortcut-prefix contract
(technically, strengthen the way it is written in the docs; it was already being enforced that way)
This commit is contained in:
parent
a7304d18eb
commit
370418ac2e
|
@ -19,8 +19,12 @@ A @racket[checkable-menu-item%] is a string-labelled menu item that
|
|||
[demand-callback ((is-a?/c menu-item%) . -> . any)
|
||||
(lambda (i) (void))]
|
||||
[checked any/c #f]
|
||||
[shortcut-prefix (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||
'shift 'option))
|
||||
[shortcut-prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||
'shift 'option))
|
||||
(λ (x) (implies (equal? 'unix (system-type))
|
||||
(not (and (member 'alt x)
|
||||
(member 'meta x)))))
|
||||
(λ (x) (equal? x (remove-duplicates x))))
|
||||
(get-default-shortcut-prefix)])]{
|
||||
|
||||
Creates a new menu item in @racket[parent]. The item is initially
|
||||
|
|
|
@ -15,9 +15,12 @@
|
|||
(require (for-label racket/gui/base
|
||||
racket/class
|
||||
racket/contract
|
||||
racket/base))
|
||||
(provide (for-label (all-from-out racket/gui/base)
|
||||
(all-from-out racket/class)
|
||||
(all-from-out racket/contract)
|
||||
(all-from-out racket/base))))
|
||||
|
||||
racket/base
|
||||
racket/list
|
||||
racket/bool))
|
||||
(provide (for-label (all-from-out racket/gui/base
|
||||
racket/class
|
||||
racket/contract
|
||||
racket/base
|
||||
racket/list
|
||||
racket/bool))))
|
||||
|
|
|
@ -17,6 +17,9 @@ A @racket[menu-item%] is a plain string-labelled menu item. Its
|
|||
(lambda (i) (void))]
|
||||
[shortcut-prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||
'shift 'option))
|
||||
(λ (x) (implies (equal? 'unix (system-type))
|
||||
(not (and (member 'alt x)
|
||||
(member 'meta x)))))
|
||||
(λ (x) (equal? x (remove-duplicates x))))
|
||||
(get-default-shortcut-prefix)])]{
|
||||
|
||||
|
|
|
@ -43,7 +43,12 @@ For a list of allowed key symbols, see @xmethod[key-event%
|
|||
}
|
||||
|
||||
@defmethod[(get-shortcut-prefix)
|
||||
(listof (or/c 'alt 'cmd 'meta 'ctl 'shift 'option))]{
|
||||
(and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||
'shift 'option))
|
||||
(λ (x) (implies (equal? 'unix (system-type))
|
||||
(not (and (member 'alt x)
|
||||
(member 'meta x)))))
|
||||
(λ (x) (equal? x (remove-duplicates x))))]{
|
||||
|
||||
Returns a list of symbols that indicates the keyboard prefix used for the menu
|
||||
item's keyboard shortcut. The allowed symbols for the list are the following:
|
||||
|
@ -99,7 +104,12 @@ keyboard shortcut.
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-shortcut-prefix [prefix (listof (or/c 'alt 'cmd 'meta 'ctl 'shift 'option))])
|
||||
@defmethod[(set-shortcut-prefix [prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||
'shift 'option))
|
||||
(λ (x) (implies (equal? 'unix (system-type))
|
||||
(not (and (member 'alt x)
|
||||
(member 'meta x)))))
|
||||
(λ (x) (equal? x (remove-duplicates x))))])
|
||||
void?]{
|
||||
|
||||
Sets a list of symbols to indicates the keyboard prefix used for the
|
||||
|
|
Loading…
Reference in New Issue
Block a user