mirror of
https://github.com/libretro/RetroArch
synced 2025-01-15 23:02:24 +00:00
01cb10d8b3
* Fetch translations from Crowdin * Support for showing and hiding indicator and navigation bar * Refactored to use a view model * Support defining helper bar items and support showing/hiding keyboard * reorganized source files into separate logical files * Moved mouse support to swift (except for delegate implementation), added support for enabling touch mouse in helper bar; reorganized swift source files * Reorganized keyboard files; added the touch mouse messages to the RA localization files; use the RA notification system * change keyboard letters to uppercase for clarity Co-authored-by: github-actions <github-actions@github.com>
56 lines
1.9 KiB
Swift
56 lines
1.9 KiB
Swift
//
|
|
// HelperBarItem.swift
|
|
// RetroArchiOS
|
|
//
|
|
// Created by Yoshi Sugawara on 3/1/22.
|
|
// Copyright © 2022 RetroArch. All rights reserved.
|
|
//
|
|
|
|
protocol HelperBarItem {
|
|
var image: UIImage? { get }
|
|
var selectedImage: UIImage? { get }
|
|
var isSelected: Bool { get }
|
|
var shortDescription: String { get }
|
|
var longDescription: String? { get }
|
|
func action()
|
|
}
|
|
|
|
struct KeyboardBarItem: HelperBarItem {
|
|
let image = UIImage(systemName: "keyboard")
|
|
let selectedImage = UIImage(systemName: "keyboard.fill")
|
|
var isSelected: Bool { actionDelegate?.isKeyboardEnabled ?? false }
|
|
let shortDescription = Strings.shortDescription
|
|
let longDescription: String? = Strings.longDescription
|
|
weak var actionDelegate: HelperBarActionDelegate?
|
|
|
|
init(actionDelegate: HelperBarActionDelegate?) {
|
|
self.actionDelegate = actionDelegate
|
|
}
|
|
|
|
func action() {
|
|
actionDelegate?.keyboardButtonTapped()
|
|
}
|
|
|
|
struct Strings {
|
|
static let shortDescription = NSLocalizedString("An on-screen keyboard", comment: "Description for on-screen keyboard item on helper bar")
|
|
static let longDescription = NSLocalizedString("An on-screen keyboard for cores that require keyboard input.", comment: "Description for on-screen keyboard item on helper bar")
|
|
}
|
|
}
|
|
|
|
struct MouseBarItem: HelperBarItem {
|
|
let image = UIImage(systemName: "computermouse")
|
|
let selectedImage = UIImage(systemName: "computermouse.fill")
|
|
var isSelected: Bool { actionDelegate?.isMouseEnabled ?? false }
|
|
let shortDescription = NSLocalizedString("Use the touch screen for mouse input.", comment: "Description for touch screen mouse item on helper bar")
|
|
var longDescription: String? { nil }
|
|
weak var actionDelegate: HelperBarActionDelegate?
|
|
|
|
init(actionDelegate: HelperBarActionDelegate?) {
|
|
self.actionDelegate = actionDelegate
|
|
}
|
|
|
|
func action() {
|
|
actionDelegate?.mouseButtonTapped()
|
|
}
|
|
}
|