stick-the-quick/ui/EditableHorizontalListItem.gd

49 lines
1.4 KiB
GDScript3
Raw Normal View History

class_name EditableHorizontalListItem extends VBoxContainer
@onready var content := (
$'Content' as CenterContainer
)
@onready var button_insert_before := (
$'PositioningButtons/InsertBefore' as Button
)
@onready var button_shift_back := (
$'PositioningButtons/ShiftBack' as Button
)
@onready var button_remove := (
$'PositioningButtons/Remove' as Button
)
@onready var button_shift_forward := (
$'PositioningButtons/ShiftForward' as Button
)
@onready var button_insert_after := (
$'PositioningButtons/InsertAfter' as Button
)
signal insert_before_clicked(what: EditableHorizontalListItem)
signal shift_back_clicked(what: EditableHorizontalListItem)
signal remove_clicked(what: EditableHorizontalListItem)
signal shift_forward_clicked(what: EditableHorizontalListItem)
signal insert_after_clicked(what: EditableHorizontalListItem)
func _emit_insert_before() -> void:
insert_before_clicked.emit(self)
func _emit_shift_back() -> void:
shift_back_clicked.emit(self)
func _emit_remove() -> void:
remove_clicked.emit(self)
func _emit_shift_forward() -> void:
shift_forward_clicked.emit(self)
func _emit_insert_after() -> void:
insert_after_clicked.emit(self)
func _ready() -> void:
button_insert_before.pressed.connect(_emit_insert_before)
button_shift_back.pressed.connect(_emit_shift_back)
button_remove.pressed.connect(_emit_remove)
button_shift_forward.pressed.connect(_emit_shift_forward)
button_insert_after.pressed.connect(_emit_insert_after)