From 31e0386019f1a82454c14a81787445e7704255e1 Mon Sep 17 00:00:00 2001 From: Mikhail Rubanov Date: Mon, 19 Dec 2022 20:57:13 +0500 Subject: [PATCH] Add enumeration managment --- .../ContainerSettingsViewController.swift | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/VoiceOver Designer/Features/Sources/Settings/States/Container/ContainerSettingsViewController.swift b/VoiceOver Designer/Features/Sources/Settings/States/Container/ContainerSettingsViewController.swift index 51cd2051..bdc760ca 100644 --- a/VoiceOver Designer/Features/Sources/Settings/States/Container/ContainerSettingsViewController.swift +++ b/VoiceOver Designer/Features/Sources/Settings/States/Container/ContainerSettingsViewController.swift @@ -26,9 +26,14 @@ class ContainerSettingsViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() + renderSettings() + } + + private func renderSettings() { view().isModal = presenter.container.isModal view().isTabTrait = presenter.container.isTabTrait view().isEnumerated = presenter.container.isEnumerated + view().isEnumeratedEnabled = !presenter.container.isTabTrait } @IBAction func didChangeContainerType(sender: Any) { @@ -44,7 +49,15 @@ class ContainerSettingsViewController: NSViewController { } @IBAction func isTabDidChanged(sender: Any) { - presenter.container.isTabTrait = view().isTabTrait + let isTab = view().isTabTrait + presenter.container.isTabTrait = isTab + + if isTab { + // Tab trait enumerates itself + presenter.container.isEnumerated = false + } + + renderSettings() } @IBAction func isEnumerateDidChanged(sender: Any) { @@ -107,6 +120,16 @@ class ContainerSettingsView: NSView { } } + var isEnumeratedEnabled: Bool { + set { + isEnumeratedButton.isEnabled = newValue + } + + get { + isEnumeratedButton.isEnabled + } + } + @IBOutlet private var containerTypeSegmentedControl: NSSegmentedControl! @IBOutlet private var navigationStyleSegmentedControl: NSSegmentedControl! @IBOutlet private var isModalButton: NSButton!