-
Notifications
You must be signed in to change notification settings - Fork 3
/
MCCDebugReasonSheet.m
47 lines (34 loc) · 1.18 KB
/
MCCDebugReasonSheet.m
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
//
// MCCDebugReasonSheet.m
// MailCommon
//
// Created by Little Known on 13/11/14.
//
//
#import "MCCDebugReasonSheet.h"
NSString * const MCC_PREFIXED_CONSTANT(DebugReasonGivenNotification) = MCC_NSSTRING(MCC_PLUGIN_PREFIX, DebugReasonGivenNotification);
@interface MCC_PREFIXED_NAME(DebugReasonSheet) ()
@property (MCC_WEAK) NSWindow * parentWindow;
@end
@implementation MCC_PREFIXED_NAME(DebugReasonSheet)
- (void)showSheetInWindow:(NSWindow *)aWindow {
if (!self.sheet) {
//Check the myCustomSheet instance variable to make sure the custom sheet does not already exist.
[[NSBundle bundleForClass:[MCC_PREFIXED_NAME(DebugReasonSheet) class]] loadNibNamed:@"MCCDebugReasonSheet" owner:self topLevelObjects:NULL];
}
self.parentWindow = aWindow;
[aWindow beginSheet:self.sheet completionHandler:^(NSModalResponse returnCode) {
if (returnCode == 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:MCC_PREFIXED_CONSTANT(DebugReasonGivenNotification) object:self];
}
}];
}
- (void)closeSheet:(NSButton *)sender {
[self.parentWindow endSheet:self.sheet returnCode:sender.tag];
}
- (void)dealloc {
self.problemText = nil;
self.sheet = nil;
MCC_DEALLOC();
}
@end