add kanban
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
@tool
|
||||
extends Button
|
||||
|
||||
|
||||
signal state_changed(expanded: bool)
|
||||
|
||||
@export var expanded: bool = true:
|
||||
set(value):
|
||||
if value != expanded:
|
||||
expanded = value
|
||||
__update_icon()
|
||||
state_changed.emit(expanded)
|
||||
|
||||
var __texture_rect := TextureRect.new()
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
focus_mode = Control.FOCUS_NONE
|
||||
flat = true
|
||||
var center := CenterContainer.new()
|
||||
center.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
add_child(center)
|
||||
center.add_child(__texture_rect)
|
||||
pressed.connect(__on_pressed)
|
||||
__update_icon()
|
||||
|
||||
|
||||
func _notification(what) -> void:
|
||||
if what == NOTIFICATION_THEME_CHANGED and not is_part_of_edited_scene():
|
||||
__texture_rect.texture = get_theme_icon(&"Collapse", &"EditorIcons")
|
||||
|
||||
|
||||
func __update_icon() -> void:
|
||||
__texture_rect.flip_v = expanded
|
||||
|
||||
|
||||
func __on_pressed() -> void:
|
||||
expanded = !expanded
|
||||
@@ -0,0 +1 @@
|
||||
uid://guc56bqr2khq
|
||||
Reference in New Issue
Block a user