27 lines
836 B
GDScript3
27 lines
836 B
GDScript3
|
extends Tree
|
||
|
|
||
|
var _root: TreeItem
|
||
|
|
||
|
onready var n_DropMenu = Shell.get_shell(self).get_node("DropMenu")
|
||
|
|
||
|
func _ready() -> void:
|
||
|
# todo: Selection via keys.
|
||
|
if connect("item_rmb_selected", self, "_on_mouse_selected") != OK:
|
||
|
assert(false)
|
||
|
|
||
|
_root = create_item()
|
||
|
var server = create_item(_root)
|
||
|
server.set_text(0, "user@poto.cafe")
|
||
|
var muc = create_item(server)
|
||
|
muc.set_text(0, "muc@poto.cafe")
|
||
|
muc.set_tooltip(0, "Conference")
|
||
|
var room = create_item(muc)
|
||
|
room.set_text(0, "room.muc@poto.cafe")
|
||
|
var button = room.add_button(0, Texture.new())
|
||
|
var members = create_item(room)
|
||
|
members.set_text(0, "8 participants")
|
||
|
|
||
|
func _on_mouse_selected(position: Vector2) -> void:
|
||
|
n_DropMenu.popup(Rect2(position, Vector2.ZERO))
|
||
|
n_DropMenu.rect_position = rect_global_position + position
|