mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
Everywhere: Move the Ladybird folder to UI
This commit is contained in:
parent
93712b24bf
commit
db47cc41f8
Notes:
github-actions[bot]
2024-11-10 11:51:45 +00:00
Author: https://github.com/trflynn89
Commit: db47cc41f8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
203 changed files with 266 additions and 244 deletions
50
UI/AppKit/Interface/TaskManagerController.swift
Normal file
50
UI/AppKit/Interface/TaskManagerController.swift
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
@objc
|
||||
public protocol TaskManagerDelegate where Self: NSObject {
|
||||
func onTaskManagerClosed()
|
||||
}
|
||||
|
||||
public class TaskManagerController: NSWindowController, NSWindowDelegate {
|
||||
|
||||
private weak var delegate: TaskManagerDelegate?
|
||||
|
||||
@objc
|
||||
public convenience init(delegate: TaskManagerDelegate) {
|
||||
self.init()
|
||||
self.delegate = delegate
|
||||
}
|
||||
|
||||
@IBAction public override func showWindow(_ sender: Any?) {
|
||||
self.window = TaskManager.init()
|
||||
self.window!.delegate = self
|
||||
self.window!.makeKeyAndOrderFront(sender)
|
||||
}
|
||||
|
||||
public func windowWillClose(_ sender: Notification) {
|
||||
self.delegate?.onTaskManagerClosed()
|
||||
}
|
||||
|
||||
public func windowDidResize(_ sender: Notification) {
|
||||
guard self.window != nil else { return }
|
||||
if !self.window!.inLiveResize {
|
||||
self.taskManager().web_view.handleResize()
|
||||
}
|
||||
}
|
||||
|
||||
public func windowDidChangeBackingProperties(_ sender: Notification) {
|
||||
self.taskManager().web_view.handleDevicePixelRatioChange()
|
||||
}
|
||||
|
||||
private func taskManager() -> TaskManager {
|
||||
return self.window as! TaskManager
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue