1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

MacPDF: Create window UI in code instead of in xib

No intentional behavior change.
This commit is contained in:
Nico Weber 2023-10-03 09:07:55 -04:00 committed by Andreas Kling
parent dcf40892b8
commit 6b9afcfb7c
4 changed files with 12 additions and 41 deletions

View file

@ -19,20 +19,23 @@
- (instancetype)initWithDocument:(MacPDFDocument*)document
{
if (self = [super initWithWindowNibName:@"MacPDFDocument" owner:self]; !self)
auto const style_mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable;
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 600, 800)
styleMask:style_mask
backing:NSBackingStoreBuffered
defer:YES];
if (self = [super initWithWindow:window]; !self)
return nil;
_pdfView = [[MacPDFView alloc] initWithFrame:NSZeroRect];
window.contentView = _pdfView;
[_pdfView setDelegate:self];
_pdfDocument = document;
return self;
}
- (void)windowDidLoad
{
[super windowDidLoad];
[_pdfView setDelegate:self];
[_pdfDocument windowIsReady];
}
- (void)pdfDidInitialize
{
[_pdfView setDocument:_pdfDocument.pdf->make_weak_ptr()];