-
Notifications
You must be signed in to change notification settings - Fork 2
/
SRRecorderCell.h
137 lines (99 loc) · 3.25 KB
/
SRRecorderCell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//
// SRRecorderCell.h
// ShortcutRecorder
//
// Copyright 2006-2007 Contributors. All rights reserved.
//
// License: BSD
//
// Contributors:
// David Dauer
// Jesper
// Jamie Kirkpatrick
#import <Cocoa/Cocoa.h>
#import "SRCommon.h"
#define SRMinWidth 50
#define SRMaxHeight 22
#define SRTransitionFPS 30.0
#define SRTransitionDuration 0.35
//#define SRTransitionDuration 2.35
#define SRTransitionFrames (SRTransitionFPS * SRTransitionDuration)
#define SRAnimationAxisIsY YES
#define ShortcutRecorderNewStyleDrawing
#define SRAnimationOffsetRect(X, Y) (SRAnimationAxisIsY ? NSOffsetRect(X, 0.0, -NSHeight(Y)) : NSOffsetRect(X, NSWidth(Y), 0.0))
@class SRRecorderControl, CTGradient, SRValidator;
enum SRRecorderStyle {
SRGradientBorderStyle = 0,
SRGreyStyle = 1
};
typedef enum SRRecorderStyle SRRecorderStyle;
@interface SRRecorderCell : NSActionCell <NSCoding>
{
CTGradient *recordingGradient;
NSString *autosaveName;
BOOL isRecording;
BOOL mouseInsideTrackingArea;
BOOL mouseDown;
SRRecorderStyle style;
BOOL isAnimating;
double transitionProgress;
BOOL isAnimatingNow;
BOOL isAnimatingTowardsRecording;
BOOL comboJustChanged;
NSTrackingRectTag removeTrackingRectTag;
NSTrackingRectTag snapbackTrackingRectTag;
KeyCombo keyCombo;
BOOL hasKeyChars;
NSString *keyChars;
NSString *keyCharsIgnoringModifiers;
unsigned int allowedFlags;
unsigned int requiredFlags;
unsigned int recordingFlags;
BOOL allowsKeyOnly;
BOOL escapeKeysRecord;
NSSet *cancelCharacterSet;
SRValidator *validator;
IBOutlet id delegate;
BOOL globalHotKeys;
void *hotKeyModeToken;
}
- (void)resetTrackingRects;
#pragma mark *** Aesthetics ***
+ (BOOL)styleSupportsAnimation:(SRRecorderStyle)style;
- (BOOL)animates;
- (void)setAnimates:(BOOL)an;
- (SRRecorderStyle)style;
- (void)setStyle:(SRRecorderStyle)nStyle;
#pragma mark *** Delegate ***
- (id)delegate;
- (void)setDelegate:(id)aDelegate;
#pragma mark *** Responder Control ***
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;
#pragma mark *** Key Combination Control ***
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
- (void)flagsChanged:(NSEvent *)theEvent;
- (unsigned int)allowedFlags;
- (void)setAllowedFlags:(unsigned int)flags;
- (unsigned int)requiredFlags;
- (void)setRequiredFlags:(unsigned int)flags;
- (BOOL)allowsKeyOnly;
- (void)setAllowsKeyOnly:(BOOL)nAllowsKeyOnly escapeKeysRecord:(BOOL)nEscapeKeysRecord;
- (BOOL)escapeKeysRecord;
- (BOOL)canCaptureGlobalHotKeys;
- (void)setCanCaptureGlobalHotKeys:(BOOL)inState;
- (KeyCombo)keyCombo;
- (void)setKeyCombo:(KeyCombo)aKeyCombo;
#pragma mark *** Autosave Control ***
- (NSString *)autosaveName;
- (void)setAutosaveName:(NSString *)aName;
// Returns the displayed key combination if set
- (NSString *)keyComboString;
- (NSString *)keyChars;
- (NSString *)keyCharsIgnoringModifiers;
@end
// Delegate Methods
@interface NSObject (SRRecorderCellDelegate)
- (BOOL)shortcutRecorderCell:(SRRecorderCell *)aRecorderCell isKeyCode:(signed short)keyCode andFlagsTaken:(unsigned int)flags reason:(NSString **)aReason;
- (void)shortcutRecorderCell:(SRRecorderCell *)aRecorderCell keyComboDidChange:(KeyCombo)newCombo;
@end