1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // NCMenuAction.swift
- // Nextcloud
- //
- // Created by Philippe Weidmann on 16.01.20.
- // Copyright © 2020 Philippe Weidmann. All rights reserved.
- // Copyright © 2020 Marino Faggiana All rights reserved.
- //
- // Author Philippe Weidmann <philippe.weidmann@infomaniak.com>
- // Author Marino Faggiana <marino.faggiana@nextcloud.com>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- import Foundation
- class NCMenuAction {
- let title: String
- let icon: UIImage
- let selectable: Bool
- var onTitle: String?
- var onIcon: UIImage?
- var selected: Bool = false
- var isOn: Bool = false
- var action: ((_ menuAction: NCMenuAction) -> Void)?
- init(title: String, icon: UIImage, action: ((_ menuAction: NCMenuAction) -> Void)?) {
- self.title = title
- self.icon = icon
- self.action = action
- self.selectable = false
- }
- init(title: String, icon: UIImage, onTitle: String? = nil, onIcon: UIImage? = nil, selected: Bool, on: Bool, action: ((_ menuAction: NCMenuAction) -> Void)?) {
- self.title = title
- self.icon = icon
- self.onTitle = onTitle ?? title
- self.onIcon = onIcon ?? icon
- self.action = action
- self.selected = selected
- self.isOn = on
- self.selectable = true
- }
- }
|