2024-04-09 22:35:20 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2024-11-09 12:50:33 -05:00
|
|
|
#import <Interface/LadybirdWebView.h>
|
|
|
|
|
#import <Interface/TaskManager.h>
|
|
|
|
|
#import <Interface/TaskManagerController.h>
|
2024-04-09 22:35:20 -04:00
|
|
|
|
|
|
|
|
#if !__has_feature(objc_arc)
|
|
|
|
|
# error "This project requires ARC"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
@interface TaskManagerController () <NSWindowDelegate>
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, weak) id<TaskManagerDelegate> delegate;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation TaskManagerController
|
|
|
|
|
|
2024-07-16 05:33:39 -06:00
|
|
|
- (instancetype)initWithDelegate:(id<TaskManagerDelegate>)delegate
|
2024-04-09 22:35:20 -04:00
|
|
|
{
|
|
|
|
|
if (self = [super init]) {
|
|
|
|
|
self.delegate = delegate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Private methods
|
|
|
|
|
|
|
|
|
|
- (TaskManager*)taskManager
|
|
|
|
|
{
|
|
|
|
|
return (TaskManager*)[self window];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - NSWindowController
|
|
|
|
|
|
|
|
|
|
- (IBAction)showWindow:(id)sender
|
|
|
|
|
{
|
|
|
|
|
self.window = [[TaskManager alloc] init];
|
|
|
|
|
[self.window setDelegate:self];
|
|
|
|
|
[self.window makeKeyAndOrderFront:sender];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - NSWindowDelegate
|
|
|
|
|
|
|
|
|
|
- (void)windowWillClose:(NSNotification*)notification
|
|
|
|
|
{
|
|
|
|
|
[self.delegate onTaskManagerClosed];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)windowDidResize:(NSNotification*)notification
|
|
|
|
|
{
|
2024-11-08 13:36:20 -05:00
|
|
|
[[[self taskManager] web_view] handleResize];
|
2024-04-09 22:35:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)windowDidChangeBackingProperties:(NSNotification*)notification
|
|
|
|
|
{
|
|
|
|
|
[[[self taskManager] web_view] handleDevicePixelRatioChange];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|