ZeroTierOne/ZeroTier One/NetworkInfoCell.swift

70 lines
1.8 KiB
Swift
Raw Normal View History

2016-05-27 20:28:32 +00:00
//
// NetworkInfoCell.swift
// ZeroTier One
//
// Created by Grant Limberg on 5/24/16.
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
//
import Cocoa
class NetworkInfoCell: NSTableCellView {
weak var parent: ShowNetworksViewController!
2016-05-27 20:28:32 +00:00
@IBOutlet var networkIdField: NSTextField!
@IBOutlet var networkNameField: NSTextField!
2016-05-27 20:48:22 +00:00
@IBOutlet var statusField: NSTextField!
@IBOutlet var typeField: NSTextField!
@IBOutlet var macField: NSTextField!
@IBOutlet var mtuField: NSTextField!
@IBOutlet var broadcastField: NSTextField!
@IBOutlet var bridgingField: NSTextField!
@IBOutlet var deviceField: NSTextField!
@IBOutlet var addressesField: NSTextField!
@IBOutlet var allowManaged: NSButton!
@IBOutlet var allowGlobal: NSButton!
@IBOutlet var allowDefault: NSButton!
@IBOutlet var connectedCheckbox: NSButton!
@IBOutlet var deleteButton: NSButton!
2016-05-27 22:25:32 +00:00
override func awakeFromNib() {
super.awakeFromNib()
}
2016-05-27 20:28:32 +00:00
override func drawRect(dirtyRect: NSRect) {
super.drawRect(dirtyRect)
// Drawing code here.
}
@IBAction func onConnectCheckStateChanged(sender: NSButton) {
NSLog("Checked State Changed")
if(sender.state == NSOnState) {
NSLog("Checked")
joinNetwork(networkIdField.stringValue)
}
else {
NSLog("Unchecked")
leaveNetwork(networkIdField.stringValue)
}
}
@IBAction func deleteNetwork(sender: NSButton) {
leaveNetwork(networkIdField.stringValue)
parent.deleteNetworkFromList(networkIdField.stringValue)
}
func joinNetwork(nwid: String) {
ServiceCom.joinNetwork(nwid)
}
func leaveNetwork(nwid: String) {
ServiceCom.leaveNetwork(nwid)
}
2016-05-27 20:28:32 +00:00
}