// // PreferenceOptions.swift // Privado // // Created by Juraldinio on 5/21/20. // Copyright © 2020 Privado LLC. All rights reserved. // import Foundation typealias PreferenceOptionsID = Int typealias PreferenceOptionsTitle = String typealias PreferenceOptionsEnabled = Bool typealias PreferenceOptionsIndex = Int typealias PreferenceRadioBoxForm = RadioBoxForm struct PreferenceOptionsValue { let title: String let value: Any? } protocol RadioButtonOption { var title: String { get set } } struct WindowDockStyle: Equatable, RadioButtonOption { var title: String let option: DockType enum DockType { case dock case undock } } struct RadioBoxForm { var size: CGSize var fontName: String var fontSize: CGFloat var textYoffset: CGFloat } struct AutoConnectPreferenceRecord: Equatable, RadioButtonOption { var title: String let type: PreferredServerType } enum PreferenceOptions: Equatable { case empty case check(PreferenceOptionsID, PreferenceOptionsEnabled, PreferenceOptionsValue) case toggle(PreferenceOptionsID, PreferenceOptionsEnabled, PreferenceOptionsValue) case menu(PreferenceOptionsID, PreferenceOptionsTitle, PreferenceOptionsIndex, [PreferenceOptionsValue]) case radio([RadioButtonOption], PreferenceOptionsTitle, PreferenceOptionsIndex, PreferenceRadioBoxForm) static func == (lhs: PreferenceOptions, rhs: PreferenceOptions) -> Bool { switch (lhs, rhs) { case (.check, .check), (.toggle, .toggle), (.menu, .menu), (.radio, .radio): return true default: return false } } }