Remove website, now in yukkurigames.com repository.
[enjoyable.git] / Classes / NJKeyInputField.h
1 //
2 // NJKeyInputField.h
3 // Enjoyable
4 //
5 // Copyright 2013 Joe Wreschnig.
6 //
7
8 #import <Cocoa/Cocoa.h>
9
10 extern const CGKeyCode NJKeyInputFieldEmpty;
11
12 @protocol NJKeyInputFieldDelegate;
13
14 @interface NJKeyInputField : NSControl
15 // An NJKeyInputField is a NSTextField-like widget that receives
16 // exactly one key press, and displays the name of that key, then
17 // resigns its first responder status. It can also inform a
18 // special delegate when its content changes.
19
20 + (NSString *)displayNameForKeyCode:(CGKeyCode)keyCode;
21
22 @property (nonatomic, weak) IBOutlet id <NJKeyInputFieldDelegate> delegate;
23
24 @property (nonatomic, assign) CGKeyCode keyCode;
25 // The currently displayed key code, or NJKeyInputFieldEmpty if no
26 // key is active. Changing this will update the display but not
27 // inform the delegate.
28
29 @property (nonatomic, readonly) BOOL hasKeyCode;
30 // YES if any key is set, NO otherwise.
31
32 - (void)clear;
33 // Clear the currently active key and call the delegate.
34
35 @end
36
37 @protocol NJKeyInputFieldDelegate
38
39 - (void)keyInputField:(NJKeyInputField *)keyInput
40 didChangeKey:(CGKeyCode)keyCode;
41 - (void)keyInputFieldDidClear:(NJKeyInputField *)keyInput;
42
43 @end
44