Browse files

Added a private TUINSHostView class, which will become the new host o…

…f the layer hierarchy
  • Loading branch information...
1 parent fd2ea4b commit 001a7d8c5969ab0fd7bda6299fbd44a791435ad5 @jspahrsummers jspahrsummers committed Jul 17, 2012
Showing with 106 additions and 0 deletions.
  1. +13 −0 TwUI.xcodeproj/project.pbxproj
  2. +24 −0 lib/UIKit/TUINSHostView.h
  3. +69 −0 lib/UIKit/TUINSHostView.m
View
13 TwUI.xcodeproj/project.pbxproj
@@ -278,6 +278,9 @@
D0C7651615B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = D0C7651515B61E5900E7AC2C /* TUIBridgedScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0C7651715B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = D0C7651515B61E5900E7AC2C /* TUIBridgedScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0C7651815B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = D0C7651515B61E5900E7AC2C /* TUIBridgedScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ D0C7651115B6189D00E7AC2C /* TUINSHostView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C7650D15B6189D00E7AC2C /* TUINSHostView.m */; };
+ D0C7651215B6189D00E7AC2C /* TUINSHostView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C7650D15B6189D00E7AC2C /* TUINSHostView.m */; };
+ D0C7651315B6189D00E7AC2C /* TUINSHostView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C7650D15B6189D00E7AC2C /* TUINSHostView.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -425,6 +428,8 @@
D0C764EA15B611C200E7AC2C /* TUIBridgedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIBridgedView.h; sourceTree = "<group>"; };
D0C7650415B6156A00E7AC2C /* TUIHostView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIHostView.h; sourceTree = "<group>"; };
D0C7651515B61E5900E7AC2C /* TUIBridgedScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIBridgedScrollView.h; sourceTree = "<group>"; };
+ D0C7650C15B6189D00E7AC2C /* TUINSHostView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUINSHostView.h; sourceTree = "<group>"; };
+ D0C7650D15B6189D00E7AC2C /* TUINSHostView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUINSHostView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -619,6 +624,8 @@
CBB74C5B13BE6E1900C85CB5 /* TUIKit.m */,
CBB74C5C13BE6E1900C85CB5 /* TUILabel.h */,
CBB74C5D13BE6E1900C85CB5 /* TUILabel.m */,
+ D0C7650C15B6189D00E7AC2C /* TUINSHostView.h */,
+ D0C7650D15B6189D00E7AC2C /* TUINSHostView.m */,
8819794A13E26E5800AA39EB /* TUINSView+Accessibility.h */,
8819794B13E26E5800AA39EB /* TUINSView+Accessibility.m */,
CBB74C5E13BE6E1900C85CB5 /* TUINSView+Hyperfocus.h */,
@@ -713,6 +720,7 @@
D0C764ED15B611C200E7AC2C /* TUIBridgedView.h in Headers */,
D0C7650715B6156A00E7AC2C /* TUIHostView.h in Headers */,
D0C7651815B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */,
+ D0C7651015B6189D00E7AC2C /* TUINSHostView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -777,6 +785,7 @@
D0C764EB15B611C200E7AC2C /* TUIBridgedView.h in Headers */,
D0C7650515B6156A00E7AC2C /* TUIHostView.h in Headers */,
D0C7651615B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */,
+ D0C7650E15B6189D00E7AC2C /* TUINSHostView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -797,6 +806,7 @@
D0C764EC15B611C200E7AC2C /* TUIBridgedView.h in Headers */,
D0C7650615B6156A00E7AC2C /* TUIHostView.h in Headers */,
D0C7651715B61E5A00E7AC2C /* TUIBridgedScrollView.h in Headers */,
+ D0C7650F15B6189D00E7AC2C /* TUINSHostView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -999,6 +1009,7 @@
887F273113F9969800D75DE6 /* TUITableViewSectionHeader.m in Sources */,
884E8F5715387E11000F7A8D /* TUIPopover.m in Sources */,
884E8F601538809C000F7A8D /* CAAnimation+TUIExtensions.m in Sources */,
+ D0C7651315B6189D00E7AC2C /* TUINSHostView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1065,6 +1076,7 @@
884E8F5E1538809C000F7A8D /* CAAnimation+TUIExtensions.m in Sources */,
30D399C9156D8ADD006ECDAE /* TUIProgressBar.m in Sources */,
88D81D001577EF0D009D453B /* TUIStyledView.m in Sources */,
+ D0C7651115B6189D00E7AC2C /* TUINSHostView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1137,6 +1149,7 @@
887F273013F9969800D75DE6 /* TUITableViewSectionHeader.m in Sources */,
884E8F5615387E11000F7A8D /* TUIPopover.m in Sources */,
884E8F5F1538809C000F7A8D /* CAAnimation+TUIExtensions.m in Sources */,
+ D0C7651215B6189D00E7AC2C /* TUINSHostView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
24 lib/UIKit/TUINSHostView.h
@@ -0,0 +1,24 @@
+//
+// TUINSHostView.h
+// TwUI
+//
+// Created by Justin Spahr-Summers on 17.07.12.
+//
+// Portions of this code were taken from Velvet,
+// which is copyright (c) 2012 Bitswift, Inc.
+// See LICENSE.txt for more information.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class TUINSView;
+
+/*
+ * Private layer-hosted view class, containing the whole TwUI view hierarchy.
+ * This class needs to be a subview of an TUINSView, because the latter is
+ * layer-backed (not layer-hosted), in order to support a separate NSView
+ * hierarchy.
+ */
+@interface TUINSHostView : NSView
+- (TUINSView *)superview;
+@end
View
69 lib/UIKit/TUINSHostView.m
@@ -0,0 +1,69 @@
+//
+// TUINSHostView.m
+// TwUI
+//
+// Created by Justin Spahr-Summers on 17.07.12.
+//
+// Portions of this code were taken from Velvet,
+// which is copyright (c) 2012 Bitswift, Inc.
+// See LICENSE.txt for more information.
+//
+
+#import "TUINSHostView.h"
+
+@interface TUINSHostView ()
+/*
+ * Configures all the necessary properties on the receiver. This is outside of
+ * an initializer because NSView has no true designated initializer.
+ */
+- (void)setUp;
+@end
+
+@implementation TUINSHostView
+
+#pragma mark Properties
+
+- (TUINSView *)superview {
+ return (TUINSView *)[super superview];
+}
+
+#pragma mark Lifecycle
+
+- (id)initWithCoder:(NSCoder *)coder {
+ self = [super initWithCoder:coder];
+ if (!self)
+ return nil;
+
+ [self setUp];
+ return self;
+}
+
+- (id)initWithFrame:(NSRect)frame; {
+ self = [super initWithFrame:frame];
+ if (!self)
+ return nil;
+
+ [self setUp];
+ return self;
+}
+
+- (void)setUp; {
+ // set up layer hosting
+ self.layer = [CALayer layer];
+ self.wantsLayer = YES;
+}
+
+#pragma mark Rendering
+
+- (BOOL)needsDisplay {
+ // mark this view as needing display anytime the layer is
+ return [super needsDisplay] || [self.layer needsDisplay];
+}
+
+#pragma mark Event Handling
+
+- (NSView *)hitTest:(NSPoint)point {
+ return nil;
+}
+
+@end

0 comments on commit 001a7d8

Please sign in to comment.