protocol VariantRepresentable : VariantStorable
Types that conform to VariantRepresentable can be stored directly in Variant
with no conversion. These include all of the Variant types from Godot (for example GString
, Rect
, Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.
static func addCheckItem(rid: RID, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new checkable item with text label
to the global menu rid
.
static func addIconCheckItem(rid: RID, icon: Texture2D?, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new checkable item with text label
and icon icon
to the global menu rid
.
static func addIconItem(rid: RID, icon: Texture2D?, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new item with text label
and icon icon
to the global menu rid
.
static func addIconRadioCheckItem(rid: RID, icon: Texture2D?, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new radio-checkable item with text label
and icon icon
to the global menu rid
.
static func addItem(rid: RID, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new item with text label
to the global menu rid
.
static func addMultistateItem(rid: RID, label: String, maxStates: Int32, defaultState: Int32, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new item with text label
to the global menu rid
.
static func addRadioCheckItem(rid: RID, label: String, callback: Callable = Callable(), keyCallback: Callable = Callable(), tag: Variant, accelerator: Key = .none, index: Int32 = -1) -> Int32
Adds a new radio-checkable item with text label
to the global menu rid
.
static func addSubmenuItem(rid: RID, label: String, submenuRid: RID, tag: Variant, index: Int32 = -1) -> Int32
Adds an item that will act as a submenu of the global menu rid
. The submenuRid
argument is the RID of the global menu that will be shown when the item is clicked.
static func setItemTag(rid: RID, idx: Int32, tag: Variant)
Sets the metadata of an item, which may be of any type. You can later get it with getItemTag(rid:idx:)
, which provides a simple way of assigning context data to items.