]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Editor/Common/reference_manager.gd
Initial Godot project with Dialogic 2.0-Alpha-17
[wolf-seeking-sheep.git] / addons / dialogic / Editor / Common / reference_manager.gd
1 @tool
2 extends PanelContainer
3
4
5 func _ready() -> void:
6         if get_parent() is SubViewport:
7                 return
8
9         add_theme_stylebox_override("panel", get_theme_stylebox("Background", "EditorStyles"))
10         $Tabs/Close.icon = get_theme_icon("Close", "EditorIcons")
11
12         for tab in $Tabs/Tabs.get_children():
13                 tab.add_theme_color_override("font_selected_color", get_theme_color("accent_color", "Editor"))
14                 tab.add_theme_font_override("font", get_theme_font("main", "EditorFonts"))
15                 tab.toggled.connect(tab_changed.bind(tab.get_index()+1))
16
17
18 func tab_changed(enabled:bool, index:int) -> void:
19         for child in $Tabs.get_children():
20                 if child.get_index() == 0 or child.get_index() == index or child is Button:
21                         child.show()
22                         if child.get_index() == index:
23                                 child.open()
24                 else:
25                         if child.visible:
26                                 child.close()
27                         child.hide()
28         for child in $Tabs/Tabs.get_children():
29                 child.set_pressed_no_signal(index-1 == child.get_index())
30
31
32 func open() -> void:
33         show()
34         $Tabs/BrokenReferences.update_indicator()
35
36
37 func _on_close_pressed() -> void:
38         get_parent()._on_close_requested()