123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- //
- // ViewController.swift
- // KdanAuto
- //
- // Created by 朱东勇 on 2022/11/17.
- //
- import Cocoa
- let testCaseNames = [
- "PDF2RTF_Font_Auto_Test",
- "PDF2RTF_Color_Auto_Test",
- "PDF2RTF_China_Auto_Test",
- "PDF2RTF_SpecialCharacter_Auto_Test"
- ]
- class ViewController : NSViewController, SettingViewControllerDelegate,
- NSTableViewDelegate, NSTableViewDataSource {
-
- @IBOutlet var settingVCWindow : NSWindow!
- @IBOutlet var settingVC : SettingViewController!
-
- @IBOutlet var itemsList : NSTableView!
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- override var representedObject: Any? {
- didSet {
- // Update the view, if already loaded.
- }
- }
-
- func reloadListData() {
-
- }
- // IBAction
- @IBAction func showSettingVC(_ sender:NSButton) {
- let settingVC = SettingViewController.shared()
- settingVC.delegate = self
- settingVC.show()
- }
- // TableView Delegate
- func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
- let cellView = TestCaseCellView.shared()
-
- cellView?.setTitle(testCaseNames[row])
- cellView?.setCheckKeys(["Color", "Font Size", "Font Name", "Font Style"])
-
- return cellView
- }
- //
- // func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
- // let cell = TestCaseCellView.shared()
- //
- // cell?.setTitle(testCaseNames[row])
- //
- // return cell as! NSTableRowView
- // }
-
- // func tableView(_ tableView: NSTableView, dataCellFor tableColumn: NSTableColumn?, row: Int) -> NSCell? {
- // var cell = NSCell.init(textCell: testCaseNames[row]);
- //
- // cell.title = testCaseNames[row]
- //
- // return cell
- // }
- func selectionShouldChange(in tableView: NSTableView) -> Bool {
-
-
- return true
- }
-
- func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool {
-
-
- return true
- }
-
- func tableView(_ tableView: NSTableView, shouldSelect tableColumn: NSTableColumn?) -> Bool {
-
- return false
- }
-
- func tableView(_ tableView: NSTableView, mouseDownInHeaderOf tableColumn: NSTableColumn) {
-
- }
-
- func tableView(_ tableView: NSTableView, didClick tableColumn: NSTableColumn) {
-
- }
-
- func tableView(_ tableView: NSTableView, didDrag tableColumn: NSTableColumn) {
-
- }
-
- func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
- return 60
- }
-
- func tableView(_ tableView: NSTableView, isGroupRow row: Int) -> Bool {
- return false
- }
-
- func tableView(_ tableView: NSTableView, sizeToFitWidthOfColumn column: Int) -> CGFloat {
- return tableView.frame.width
- }
-
- func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge: NSTableView.RowActionEdge) -> [NSTableViewRowAction] {
- return []
- }
-
-
-
-
-
- // TableView Data Source
- func numberOfRows(in tableView: NSTableView) -> Int {
- return testCaseNames.count;
- }
-
- /* This method is required for the "Cell Based" TableView, and is optional for the "View Based" TableView. If implemented in the latter case, the value will be set to the view at a given row/column if the view responds to -setObjectValue: (such as NSControl and NSTableCellView). Note that NSTableCellView does not actually display the objectValue, and its value is to be used for bindings. See NSTableCellView.h for more information.
- */
- func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
- return testCaseNames[row]
- }
-
-
- // SettingViewConntroller
- func settingViewDidFinished() {
- reloadListData()
- }
-
- }
|