UTMScripting.swift 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. //
  2. // Copyright © 2022 osy. All rights reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. // !! THIS FILE IS GENERATED FROM bridge-gen.sh, DO NOT MODIFY MANUALLY !!
  17. public enum UTMScripting: String {
  18. case application = "application"
  19. case serialPort = "serial port"
  20. case virtualMachine = "virtual machine"
  21. case window = "window"
  22. }
  23. import AppKit
  24. import ScriptingBridge
  25. @objc public protocol SBObjectProtocol: NSObjectProtocol {
  26. func get() -> Any!
  27. }
  28. @objc public protocol SBApplicationProtocol: SBObjectProtocol {
  29. func activate()
  30. var delegate: SBApplicationDelegate! { get set }
  31. var isRunning: Bool { get }
  32. }
  33. // MARK: UTMScriptingPrintingErrorHandling
  34. @objc public enum UTMScriptingPrintingErrorHandling : AEKeyword {
  35. case standard = 0x6c777374 /* 'lwst' */
  36. case detailed = 0x6c776474 /* 'lwdt' */
  37. }
  38. // MARK: UTMScriptingBackend
  39. @objc public enum UTMScriptingBackend : AEKeyword {
  40. case apple = 0x4170506c /* 'ApPl' */
  41. case qemu = 0x51654d75 /* 'QeMu' */
  42. case unavailable = 0x556e4176 /* 'UnAv' */
  43. }
  44. // MARK: UTMScriptingStatus
  45. @objc public enum UTMScriptingStatus : AEKeyword {
  46. case stopped = 0x53745361 /* 'StSa' */
  47. case starting = 0x53745362 /* 'StSb' */
  48. case started = 0x53745363 /* 'StSc' */
  49. case pausing = 0x53745364 /* 'StSd' */
  50. case paused = 0x53745365 /* 'StSe' */
  51. case resuming = 0x53745366 /* 'StSf' */
  52. case stopping = 0x53745367 /* 'StSg' */
  53. }
  54. // MARK: UTMScriptingStopMethod
  55. @objc public enum UTMScriptingStopMethod : AEKeyword {
  56. case force = 0x466f5263 /* 'FoRc' */
  57. case kill = 0x4b694c6c /* 'KiLl' */
  58. case request = 0x52655175 /* 'ReQu' */
  59. }
  60. // MARK: UTMScriptingSerialInterface
  61. @objc public enum UTMScriptingSerialInterface : AEKeyword {
  62. case ptty = 0x50745479 /* 'PtTy' */
  63. case tcp = 0x54635020 /* 'TcP ' */
  64. case unavailable = 0x49556e41 /* 'IUnA' */
  65. }
  66. // MARK: UTMScriptingGenericMethods
  67. @objc public protocol UTMScriptingGenericMethods {
  68. @objc optional func close() // Close a document.
  69. }
  70. // MARK: UTMScriptingApplication
  71. @objc public protocol UTMScriptingApplication: SBApplicationProtocol {
  72. @objc optional func windows() -> SBElementArray
  73. @objc optional var name: String { get } // The name of the application.
  74. @objc optional var frontmost: Bool { get } // Is this the active application?
  75. @objc optional var version: String { get } // The version number of the application.
  76. @objc optional func quit() // Quit the application.
  77. @objc optional func exists(_ x: Any!) -> Bool // Verify that an object exists.
  78. @objc optional func virtualMachines() -> SBElementArray
  79. @objc optional var autoTerminate: Bool { get } // Auto terminate the application when all windows are closed?
  80. @objc optional func setAutoTerminate(_ autoTerminate: Bool) // Auto terminate the application when all windows are closed?
  81. }
  82. extension SBApplication: UTMScriptingApplication {}
  83. // MARK: UTMScriptingWindow
  84. @objc public protocol UTMScriptingWindow: SBObjectProtocol, UTMScriptingGenericMethods {
  85. @objc optional var name: String { get } // The title of the window.
  86. @objc optional func id() -> Int // The unique identifier of the window.
  87. @objc optional var index: Int { get } // The index of the window, ordered front to back.
  88. @objc optional var bounds: NSRect { get } // The bounding rectangle of the window.
  89. @objc optional var closeable: Bool { get } // Does the window have a close button?
  90. @objc optional var miniaturizable: Bool { get } // Does the window have a minimize button?
  91. @objc optional var miniaturized: Bool { get } // Is the window minimized right now?
  92. @objc optional var resizable: Bool { get } // Can the window be resized?
  93. @objc optional var visible: Bool { get } // Is the window visible right now?
  94. @objc optional var zoomable: Bool { get } // Does the window have a zoom button?
  95. @objc optional var zoomed: Bool { get } // Is the window zoomed right now?
  96. @objc optional func setIndex(_ index: Int) // The index of the window, ordered front to back.
  97. @objc optional func setBounds(_ bounds: NSRect) // The bounding rectangle of the window.
  98. @objc optional func setMiniaturized(_ miniaturized: Bool) // Is the window minimized right now?
  99. @objc optional func setVisible(_ visible: Bool) // Is the window visible right now?
  100. @objc optional func setZoomed(_ zoomed: Bool) // Is the window zoomed right now?
  101. }
  102. extension SBObject: UTMScriptingWindow {}
  103. // MARK: UTMScriptingVirtualMachine
  104. @objc public protocol UTMScriptingVirtualMachine: SBObjectProtocol, UTMScriptingGenericMethods {
  105. @objc optional func serialPorts() -> SBElementArray
  106. @objc optional func id() -> String // The unique identifier of the VM.
  107. @objc optional var name: String { get } // The name of the VM.
  108. @objc optional var notes: String { get } // User specified notes.
  109. @objc optional var machine: String { get } // Target machine name.
  110. @objc optional var architecture: String { get } // Target architecture name.
  111. @objc optional var memory: String { get } // RAM size.
  112. @objc optional var backend: UTMScriptingBackend { get } // Emulation/virtualization engine used.
  113. @objc optional var status: UTMScriptingStatus { get } // Current running status.
  114. @objc optional func startSaving(_ saving: Bool)
  115. @objc optional func suspendSaving(_ saving: Bool)
  116. @objc optional func stopBy(_ by: UTMScriptingStopMethod)
  117. }
  118. extension SBObject: UTMScriptingVirtualMachine {}
  119. // MARK: UTMScriptingSerialPort
  120. @objc public protocol UTMScriptingSerialPort: SBObjectProtocol, UTMScriptingGenericMethods {
  121. @objc optional func id() -> Int // The unique identifier of the tag.
  122. @objc optional var interface: UTMScriptingSerialInterface { get } // The type of serial interface on the host.
  123. @objc optional var address: String { get } // Host address of the serial port (determined by the interface type).
  124. @objc optional var port: Int { get } // Port number of the serial port (not used in some interface types).
  125. }
  126. extension SBObject: UTMScriptingSerialPort {}