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)
|
[demand-callback ((is-a?/c menu-item%) . -> . any)
|
||||||
(lambda (i) (void))]
|
(lambda (i) (void))]
|
||||||
[checked any/c #f]
|
[checked any/c #f]
|
||||||
[shortcut-prefix (listof (or/c 'alt 'cmd 'meta 'ctl
|
[shortcut-prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||||
'shift 'option))
|
'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)])]{
|
(get-default-shortcut-prefix)])]{
|
||||||
|
|
||||||
Creates a new menu item in @racket[parent]. The item is initially
|
Creates a new menu item in @racket[parent]. The item is initially
|
||||||
|
|
|
@ -15,9 +15,12 @@
|
||||||
(require (for-label racket/gui/base
|
(require (for-label racket/gui/base
|
||||||
racket/class
|
racket/class
|
||||||
racket/contract
|
racket/contract
|
||||||
racket/base))
|
racket/base
|
||||||
(provide (for-label (all-from-out racket/gui/base)
|
racket/list
|
||||||
(all-from-out racket/class)
|
racket/bool))
|
||||||
(all-from-out racket/contract)
|
(provide (for-label (all-from-out racket/gui/base
|
||||||
(all-from-out racket/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))]
|
(lambda (i) (void))]
|
||||||
[shortcut-prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
[shortcut-prefix (and/c (listof (or/c 'alt 'cmd 'meta 'ctl
|
||||||
'shift 'option))
|
'shift 'option))
|
||||||
|
(λ (x) (implies (equal? 'unix (system-type))
|
||||||
|
(not (and (member 'alt x)
|
||||||
|
(member 'meta x)))))
|
||||||
(λ (x) (equal? x (remove-duplicates x))))
|
(λ (x) (equal? x (remove-duplicates x))))
|
||||||
(get-default-shortcut-prefix)])]{
|
(get-default-shortcut-prefix)])]{
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,12 @@ For a list of allowed key symbols, see @xmethod[key-event%
|
||||||
}
|
}
|
||||||
|
|
||||||
@defmethod[(get-shortcut-prefix)
|
@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
|
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:
|
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?]{
|
void?]{
|
||||||
|
|
||||||
Sets a list of symbols to indicates the keyboard prefix used for the
|
Sets a list of symbols to indicates the keyboard prefix used for the
|
||||||
|
|
Loading…
Reference in New Issue
Block a user