Repository navigation
Expand file tree
/
Copy pathSCBundleEditorController.h
More file actions
54 lines (36 loc) · 1.56 KB
/
Copy pathSCBundleEditorController.h
File metadata and controls
54 lines (36 loc) · 1.56 KB
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
//
// SCBundleEditorController.h
// SelfControl
//
// Sheet controller for creating/editing a bundle.
// Allows setting name, color, and adding apps/websites.
//
#import <Cocoa/Cocoa.h>
#import "Block Management/SCBlockBundle.h"
NS_ASSUME_NONNULL_BEGIN
@class SCBundleEditorController;
@protocol SCBundleEditorDelegate <NSObject>
/// Called when user saves the bundle
- (void)bundleEditor:(SCBundleEditorController *)editor didSaveBundle:(SCBlockBundle *)bundle;
/// Called when user cancels editing
- (void)bundleEditorDidCancel:(SCBundleEditorController *)editor;
/// Called when user deletes the bundle
- (void)bundleEditor:(SCBundleEditorController *)editor didDeleteBundle:(SCBlockBundle *)bundle;
@end
@interface SCBundleEditorController : NSWindowController
@property (nonatomic, weak, nullable) id<SCBundleEditorDelegate> delegate;
/// The bundle being edited (nil for new bundle)
@property (nonatomic, strong, readonly, nullable) SCBlockBundle *bundle;
/// Whether this is a new bundle (vs editing existing)
@property (nonatomic, readonly) BOOL isNewBundle;
/// Whether we're in committed state (restricts removals/deletions)
@property (nonatomic, assign) BOOL isCommitted;
/// Initialize for creating a new bundle
- (instancetype)initForNewBundle;
/// Initialize for editing an existing bundle
- (instancetype)initWithBundle:(SCBlockBundle *)bundle;
/// Show the editor as a sheet on the given window
- (void)beginSheetModalForWindow:(NSWindow *)parentWindow
completionHandler:(nullable void (^)(NSModalResponse))handler;
@end
NS_ASSUME_NONNULL_END