mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00:00
MacPDF: Create window UI in code instead of in xib
No intentional behavior change.
This commit is contained in:
parent
dcf40892b8
commit
6b9afcfb7c
|
@ -10,7 +10,6 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|||
add_compile_options(-DAK_DONT_REPLACE_STD)
|
||||
|
||||
set(RESOURCES
|
||||
MacPDFDocument.xib
|
||||
MainMenu.xib
|
||||
)
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
{
|
||||
_windowController = [[MacPDFWindowController alloc] initWithDocument:self];
|
||||
[self addWindowController:_windowController];
|
||||
[self windowIsReady];
|
||||
}
|
||||
|
||||
- (void)windowIsReady
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MacPDFWindowController">
|
||||
<connections>
|
||||
<outlet property="_pdfView" destination="gIp-Ho-8D9" id="bcT-vU-foe"/>
|
||||
<outlet property="window" destination="xOd-HO-29H" id="JIz-fz-R2o"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="133" y="235" width="600" height="800"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1728" height="1079"/>
|
||||
<value key="minSize" type="size" width="94" height="86"/>
|
||||
<view key="contentView" id="gIp-Ho-8D9" customClass="MacPDFView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="800"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139.5" y="430"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
|
@ -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()];
|
||||
|
|
Loading…
Reference in a new issue