summaryrefslogtreecommitdiffstats
path: root/macosx/HBPasteboardItem.m
blob: 50a6387f31d1400813ee255ad5ec46a38e8d68d5 (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
//
//  HBPasteboardWriter.m
//  HandBrake
//
//  Created by Damiano Galassi on 04/10/20.
//  Copyright © 2021 HandBrake. All rights reserved.
//

#import "HBPasteboardItem.h"

NSPasteboardType const tableViewIndex = @"fr.handbrake.tableViewIndex";

@implementation HBPasteboardItem

- (instancetype)initWithIndex:(NSInteger)index
{
    self = [super init];
    if (self)
    {
        _index = index;
    }
    return self;
}

- (NSArray<NSPasteboardType> *)writableTypesForPasteboard:(NSPasteboard *)pasteboard
{
    return @[tableViewIndex];
}

- (nullable id)pasteboardPropertyListForType:(nonnull NSPasteboardType)type
{
    if ([type isEqualTo:tableViewIndex])
    {
        return @(self.index);
    }
    else
    {
        return nil;
    }
}

@end