//
//  TeseCaseCell.swift
//  KdanAuto
//
//  Created by 朱东勇 on 2022/11/21.
//

import Foundation
import AppKit

class TestFileTypeCellView : NSTableCellView {
    @IBOutlet var _titleLbl : NSTextField!
    @IBOutlet var _sepLine : NSView!
    
    var _title : String!
    var _isExpad: Bool!
    
    class func shared() -> TestFileTypeCellView? {
        var objects : NSArray!
        
        Bundle.main.loadNibNamed("TestFileTypeCellView", owner: nil, topLevelObjects: &objects)
        
        for tView in objects {
            if let tv = tView as? TestFileTypeCellView {
                return tv
            }
        }
        
        return nil
    }
    
    class func isExpand(_ fileType:String) -> Bool {
        return DataModel.shared.isExpand(fileType)
    }
    
    override func awakeFromNib() {
        _sepLine.wantsLayer = true;
        _sepLine.layer?.backgroundColor = NSColor.lightGray.cgColor
    }
    
    // Setter & Getter
    public func setTitle(_ title:String) {
        _title = title;
        
        _titleLbl.stringValue = _title ?? ""
    }
    
    public func title() -> String? {
        return _title
    }
    
    public func fileType() -> String? {
        return _title
    }
    
    public func setIsExpand(_ expand:Bool) {
        _isExpad = expand
        
        
    }
    
    public func isExpand() -> Bool {
        return _isExpad
    }
}
