tightened up the contract in the docs for key-event%s methods so they limit the symbols to just the legal ones
svn: r18466
This commit is contained in:
parent
ff0eb1757a
commit
6d4a546ca8
|
@ -320,4 +320,5 @@
|
|||
current-ps-cmap-file-paths
|
||||
hide-cursor-until-moved
|
||||
system-position-ok-before-cancel?
|
||||
label-string?))
|
||||
label-string?
|
||||
key-code-symbol?))
|
||||
|
|
|
@ -5,6 +5,18 @@
|
|||
"const.ss")
|
||||
(provide (protect (all-defined)))
|
||||
|
||||
(define (key-code-symbol? x)
|
||||
(and (member x '(start cancel clear shift control menu pause
|
||||
capital prior next end home left up right down
|
||||
escape select print execute snapshot insert help
|
||||
numpad0 numpad1 numpad2 numpad3 numpad4 numpad5
|
||||
numpad6 numpad7 numpad8 numpad9 numpad-enter
|
||||
multiply add separator subtract decimal divide
|
||||
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14
|
||||
f15 f16 f17 f18 f19 f20 f21 f22 f23 f24
|
||||
numlock scroll wheel-up wheel-down release press))
|
||||
#t))
|
||||
|
||||
(define (who->name who)
|
||||
(cond
|
||||
[(symbol? who) who]
|
||||
|
|
|
@ -16,7 +16,7 @@ For a key-press event, a virtual key code is provided by
|
|||
See also @|mousekeydiscuss|.
|
||||
|
||||
|
||||
@defconstructor[([key-code (or/c char? symbol?) #\nul]
|
||||
@defconstructor[([key-code (or/c char? key-code-symbol?) #\nul]
|
||||
[shift-down any/c #f]
|
||||
[control-down any/c #f]
|
||||
[meta-down any/c #f]
|
||||
|
@ -62,7 +62,7 @@ Under Mac OS X, if a control-key press is combined with a mouse button
|
|||
}
|
||||
|
||||
@defmethod[(get-key-code)
|
||||
(or/c char? symbol?)]{
|
||||
(or/c char? key-code-symbol?)]{
|
||||
|
||||
Gets the virtual key code for the key event. The virtual key code is
|
||||
either a character or a special key symbol, one of the following:
|
||||
|
@ -182,7 +182,7 @@ See also @method[key-event% get-other-shift-key-code].
|
|||
}
|
||||
|
||||
@defmethod[(get-key-release-code)
|
||||
(or/c char? symbol?)]{
|
||||
(or/c char? key-code-symbol?)]{
|
||||
|
||||
Gets the virtual key code for a key-release event; the result is
|
||||
@scheme['press] for a key-press event. See @method[key-event%
|
||||
|
@ -199,28 +199,28 @@ Returns @scheme[#t] if the Meta (X), Alt (Windows), or Command (Mac OS
|
|||
}
|
||||
|
||||
@defmethod[(get-other-altgr-key-code)
|
||||
(or/c char? symbol? false/c)]{
|
||||
(or/c char? key-code-symbol? false/c)]{
|
||||
|
||||
See @method[key-event% get-other-shift-key-code].
|
||||
|
||||
}
|
||||
|
||||
@defmethod[(get-other-caps-key-code)
|
||||
(or/c char? symbol? false/c)]{
|
||||
(or/c char? key-code-symbol? false/c)]{
|
||||
|
||||
See @method[key-event% get-other-shift-key-code].
|
||||
|
||||
}
|
||||
|
||||
@defmethod[(get-other-shift-altgr-key-code)
|
||||
(or/c char? symbol? false/c)]{
|
||||
(or/c char? key-code-symbol? false/c)]{
|
||||
|
||||
See @method[key-event% get-other-shift-key-code].
|
||||
|
||||
}
|
||||
|
||||
@defmethod[(get-other-shift-key-code)
|
||||
(or/c char? symbol? false/c)]{
|
||||
(or/c char? key-code-symbol? false/c)]{
|
||||
|
||||
Since keyboard mappings vary, it is sometimes useful in key mappings
|
||||
for a program to know the result that the keyboard would have
|
||||
|
@ -307,7 +307,7 @@ Under Mac OS X, if a control-key press is combined with a mouse button
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-key-code [code (or/c char? symbol?)])
|
||||
@defmethod[(set-key-code [code (or/c char? key-code-symbol?)])
|
||||
void?]{
|
||||
|
||||
Sets the virtual key code for the event, either a character or one of
|
||||
|
@ -315,7 +315,7 @@ Sets the virtual key code for the event, either a character or one of
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-key-release-code [code (or/c char? symbol?)])
|
||||
@defmethod[(set-key-release-code [code (or/c char? key-code-symbol?)])
|
||||
void?]{
|
||||
|
||||
Sets the virtual key code for a release event, either a character or
|
||||
|
@ -332,7 +332,7 @@ Sets whether the Meta (X), Alt (Windows), or Command (Mac OS X) key
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-other-altgr-key-code [code (or/c char? symbol? false/c)])
|
||||
@defmethod[(set-other-altgr-key-code [code (or/c char? key-code-symbol? false/c)])
|
||||
void?]{
|
||||
|
||||
Sets the key code produced by @method[key-event%
|
||||
|
@ -340,7 +340,7 @@ get-other-altgr-key-code].
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-other-caps-key-code [code (or/c char? symbol? false/c)])
|
||||
@defmethod[(set-other-caps-key-code [code (or/c char? key-code-symbol? false/c)])
|
||||
void?]{
|
||||
|
||||
Sets the key code produced by @method[key-event%
|
||||
|
@ -348,7 +348,7 @@ Sets the key code produced by @method[key-event%
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-other-shift-altgr-key-code [code (or/c char? symbol? false/c)])
|
||||
@defmethod[(set-other-shift-altgr-key-code [code (or/c char? key-code-symbol? false/c)])
|
||||
void?]{
|
||||
|
||||
Sets the key code produced by @method[key-event%
|
||||
|
@ -356,7 +356,7 @@ Sets the key code produced by @method[key-event%
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-other-shift-key-code [code (or/c char? symbol? false/c)])
|
||||
@defmethod[(set-other-shift-key-code [code (or/c char? key-code-symbol? false/c)])
|
||||
void?]{
|
||||
|
||||
Sets the key code produced by @method[key-event%
|
||||
|
|
|
@ -472,4 +472,9 @@ See also @scheme[get-resource].}
|
|||
|
||||
@defproc[(label-string? [v any/c]) boolean?]{
|
||||
Returns @scheme[#t] if @scheme[v] is a string whose length is less than or equal to @scheme[200].
|
||||
}
|
||||
|
||||
@defproc[(key-code-symbol? [v any/c]) boolean?]{
|
||||
Returns @scheme[#t] if the argument is a symbol that can be returned by
|
||||
@scheme[key-event%]'s method @method[key-event% get-key-code].
|
||||
}
|
Loading…
Reference in New Issue
Block a user