Commit 7bf473dd authored by Marvin Scholz's avatar Marvin Scholz

macosx: Fix initializing the Cells in Slider subclasses

parent 73c8dce2
......@@ -28,18 +28,21 @@
- (instancetype)initWithCoder:(NSCoder *)coder
{
if ([coder isKindOfClass: [NSKeyedUnarchiver class]]) {
NSKeyedUnarchiver *keyedUnarchiver = (id)coder;
NSString *oldClass = NSStringFromClass([self.superclass cellClass]);
[keyedUnarchiver setClass:[VLCDefaultValueSliderCell class] forClassName:oldClass];
}
self = [super initWithCoder:coder];
if (self) {
if (![self.cell isKindOfClass:[VLCDefaultValueSliderCell class]]) {
self.cell = [[VLCDefaultValueSliderCell alloc] init];
}
_isScrollable = YES;
}
return self;
}
+ (Class)cellClass
{
return [VLCDefaultValueSliderCell class];
}
- (void)scrollWheel:(NSEvent *)event
{
if (!_isScrollable)
......
......@@ -26,6 +26,23 @@
@implementation VLCSlider
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
if (![self.cell isKindOfClass:[VLCSliderCell class]]) {
self.cell = [[VLCSliderCell alloc] init];
}
}
return self;
}
+ (Class)cellClass
{
return [VLCSliderCell class];
}
// Workaround for 10.7
// http://stackoverflow.com/questions/3985816/custom-nsslidercell
- (void)setNeedsDisplayInRect:(NSRect)invalidRect {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment