blob: 208942c8d06d916e06d4abf7c1dd456bea3add20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//
// PopoverScrollView.m
// VKPC
//
// Created by Eugene on 11/3/14.
// Copyright (c) 2014 Eugene Z. All rights reserved.
//
#import "PopoverScrollView.h"
#import "PopoverClipView.h"
@implementation PopoverScrollView
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self == nil) return nil;
[self swapClipView];
return self;
}
- (void)awakeFromNib {
[super awakeFromNib];
if (![self.contentView isKindOfClass:PopoverClipView.class] ) {
[self swapClipView];
}
}
- (void)swapClipView {
self.wantsLayer = YES;
id documentView = self.documentView;
PopoverClipView *clipView = [[PopoverClipView alloc] initWithFrame:self.contentView.frame];
self.contentView = clipView;
self.documentView = documentView;
}
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
- (BOOL)wantsLayer {
return YES;
}
@end
|