Better ui for the page entry.

This commit is contained in:
Relintai 2022-08-25 11:03:21 +02:00
parent 36e8b84eec
commit f523f60cea
2 changed files with 58 additions and 37 deletions

View File

@ -1,27 +1,38 @@
tool
extends PanelContainer
extends VBoxContainer
var _entry : WebPageEntry = null
var _entry_type_label : Label = null
signal entry_add_requested_after(entry)
signal entry_move_up_requested(entry)
signal entry_move_down_requested(entry)
signal entry_delete_requested(entry)
func set_entry(entry : WebPageEntry) -> void:
_entry = entry
_entry_type_label.text = entry.get_class()
func _on_add_button_pressed():
pass
emit_signal("entry_add_requested_after", _entry)
func _on_up_button_pressed():
pass
emit_signal("entry_move_up_requested", _entry)
func _on_down_button_pressed():
pass
emit_signal("entry_move_down_requested", _entry)
func _on_delete_button_pressed():
pass
emit_signal("entry_delete_requested", _entry)
func _notification(what):
if what == NOTIFICATION_INSTANCED:
get_node("VBoxContainer/HBoxContainer/AddButton").connect("pressed", self, "_on_add_button_pressed")
get_node("VBoxContainer/HBoxContainer/UpButton").connect("pressed", self, "_on_up_button_pressed")
get_node("VBoxContainer/HBoxContainer/DownButton").connect("pressed", self, "_on_down_button_pressed")
get_node("VBoxContainer/HBoxContainer/Delete").connect("pressed", self, "_on_delete_button_pressed")
_entry_type_label = get_node("PC/VBC/TopBar/EntryTypeLabel")
get_node("AddButton").connect("pressed", self, "_on_add_button_pressed")
get_node("PC/VBC/TopBar/UpButton").connect("pressed", self, "_on_up_button_pressed")
get_node("PC/VBC/TopBar/DownButton").connect("pressed", self, "_on_down_button_pressed")
get_node("PC/VBC/TopBar/Delete").connect("pressed", self, "_on_delete_button_pressed")

View File

@ -2,52 +2,62 @@
[ext_resource path="res://addons/web_pages/editor/PageEntryEditor.gd" type="Script" id=1]
[node name="Entry" type="PanelContainer"]
[node name="Entry" type="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 20.0
size_flags_horizontal = 3
script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
[node name="PC" type="PanelContainer" parent="."]
margin_right = 1024.0
margin_bottom = 46.0
[node name="VBC" type="VBoxContainer" parent="PC"]
margin_left = 7.0
margin_top = 7.0
margin_right = 1017.0
margin_bottom = 39.0
[node name="MainContainer" type="MarginContainer" parent="VBoxContainer"]
[node name="TopBar" type="HBoxContainer" parent="PC/VBC"]
margin_right = 1010.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
margin_top = 4.0
margin_right = 1010.0
margin_bottom = 8.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 12.0
margin_right = 1010.0
margin_bottom = 32.0
alignment = 1
[node name="AddButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 414.0
margin_right = 451.0
margin_bottom = 20.0
text = "Add"
[node name="UpButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 455.0
margin_right = 485.0
[node name="EntryTypeLabel" type="Label" parent="PC/VBC/TopBar"]
margin_top = 3.0
margin_right = 865.0
margin_bottom = 17.0
size_flags_horizontal = 3
[node name="UpButton" type="Button" parent="PC/VBC/TopBar"]
margin_left = 869.0
margin_right = 899.0
margin_bottom = 20.0
text = "Up"
[node name="DownButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 489.0
margin_right = 537.0
[node name="DownButton" type="Button" parent="PC/VBC/TopBar"]
margin_left = 903.0
margin_right = 951.0
margin_bottom = 20.0
text = "Down"
[node name="Delete" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 541.0
margin_right = 596.0
[node name="Delete" type="Button" parent="PC/VBC/TopBar"]
margin_left = 955.0
margin_right = 1010.0
margin_bottom = 20.0
text = "Delete"
[node name="HSeparator" type="HSeparator" parent="PC/VBC"]
margin_top = 24.0
margin_right = 1010.0
margin_bottom = 28.0
[node name="MainContainer" type="MarginContainer" parent="PC/VBC"]
margin_top = 32.0
margin_right = 1010.0
margin_bottom = 32.0
[node name="AddButton" type="Button" parent="."]
margin_top = 50.0
margin_right = 1024.0
margin_bottom = 70.0
text = "Add"