Repository navigation
Expand file tree
/
Copy pathSCWeekGridView.h
More file actions
74 lines (51 loc) · 2.23 KB
/
Copy pathSCWeekGridView.h
File metadata and controls
74 lines (51 loc) · 2.23 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// SCWeekGridView.h
// SelfControl
//
// Custom view that displays the week grid with bundles as rows and days as columns.
// Each cell shows a mini 24-hour timeline with allowed windows highlighted.
//
#import <Cocoa/Cocoa.h>
#import "Block Management/SCBlockBundle.h"
#import "Block Management/SCWeeklySchedule.h"
NS_ASSUME_NONNULL_BEGIN
@class SCWeekGridView;
@protocol SCWeekGridViewDelegate <NSObject>
/// Called when user clicks on a cell to edit that day's schedule
- (void)weekGridView:(SCWeekGridView *)gridView
didSelectBundle:(SCBlockBundle *)bundle
forDay:(SCDayOfWeek)day;
/// Called when user wants to edit a bundle's settings
- (void)weekGridView:(SCWeekGridView *)gridView
didRequestEditBundle:(SCBlockBundle *)bundle;
/// Called when user wants to add a new bundle
- (void)weekGridViewDidRequestAddBundle:(SCWeekGridView *)gridView;
@optional
/// Called when user right-clicks a cell for copy/paste context menu
- (void)weekGridView:(SCWeekGridView *)gridView
didRightClickBundle:(SCBlockBundle *)bundle
forDay:(SCDayOfWeek)day
atPoint:(NSPoint)point;
@end
@interface SCWeekGridView : NSView
@property (nonatomic, weak, nullable) id<SCWeekGridViewDelegate> delegate;
/// Whether the view should only show remaining days (today forward)
@property (nonatomic, assign) BOOL showOnlyRemainingDays;
/// Whether the schedule is committed (affects editability display)
@property (nonatomic, assign) BOOL isCommitted;
/// Current week offset (0 = this week, 1 = next week). Affects whether current-time indicators are shown.
@property (nonatomic, assign) NSInteger weekOffset;
/// Bundles to display as rows
@property (nonatomic, copy, nullable) NSArray<SCBlockBundle *> *bundles;
/// Schedules (one per bundle)
@property (nonatomic, copy, nullable) NSArray<SCWeeklySchedule *> *schedules;
/// Reloads the grid with current data
- (void)reloadData;
/// Returns the schedule for a specific bundle
- (nullable SCWeeklySchedule *)scheduleForBundle:(SCBlockBundle *)bundle;
/// Highlights a specific cell (for copy/paste feedback)
- (void)highlightCellForBundle:(NSString *)bundleID day:(SCDayOfWeek)day;
/// Clears any cell highlight
- (void)clearCellHighlight;
@end
NS_ASSUME_NONNULL_END