mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00:00
MacPDF: Introduce MacPDFWindowController
I'd like to add a sidebar, and NSSplitViewItem apparently isn't accessibly in .xib files without contortions. So I want to move to creating the window in code, and this is a step towards that. No behavior change.
This commit is contained in:
parent
d6dff83397
commit
67f6baead0
|
@ -19,6 +19,7 @@ add_executable(MacPDF MACOSX_BUNDLE
|
|||
AppDelegate.mm
|
||||
MacPDFDocument.mm
|
||||
MacPDFView.mm
|
||||
MacPDFWindowController.mm
|
||||
)
|
||||
target_compile_options(MacPDF PRIVATE
|
||||
-fobjc-arc
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||
|
||||
#import "MacPDFWindowController.h"
|
||||
#include <LibPDF/Document.h>
|
||||
|
||||
@interface MacPDFDocument ()
|
||||
|
@ -71,9 +72,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (NSString*)windowNibName
|
||||
- (void)makeWindowControllers
|
||||
{
|
||||
return @"MacPDFDocument";
|
||||
[self addWindowController:[[MacPDFWindowController alloc] initWithDocument:self]];
|
||||
}
|
||||
|
||||
- (void)windowControllerDidLoadNib:(NSWindowController*)aController
|
||||
|
|
21
Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h
Normal file
21
Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CocoaWrapper.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MacPDFDocument;
|
||||
|
||||
@interface MacPDFWindowController : NSWindowController
|
||||
|
||||
- (instancetype)initWithDocument:(MacPDFDocument*)document;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
20
Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm
Normal file
20
Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#import "MacPDFWindowController.h"
|
||||
|
||||
@implementation MacPDFWindowController
|
||||
|
||||
- (instancetype)initWithDocument:(MacPDFDocument*)document
|
||||
{
|
||||
if (self = [super initWithWindowNibName:@"MacPDFDocument" owner:self]; !self)
|
||||
return nil;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@end
|
Loading…
Reference in a new issue