Amelioration des fenetres.

This commit is contained in:
osquallo 2018-08-17 20:41:03 +02:00
parent 92693ed294
commit a9c9c857f0
2 changed files with 286 additions and 28 deletions

View file

@ -267,24 +267,35 @@ func _enter_tree():
footer_box.set_owner( parts ) footer_box.set_owner( parts )
### ###
### ###
# Header/HBoxContainer # footer_box/footer
var footer var footer
if not footer_box.has_node( "footer" ): if not footer_box.has_node( "footer" ):
footer = HBoxContainer.new() footer = HBoxContainer.new()
footer.name = "footer" footer.name = "footer"
footer.size_flags_horizontal = SIZE_FILL footer.size_flags_horizontal = SIZE_EXPAND_FILL
footer.size_flags_vertical = SIZE_FILL footer.size_flags_vertical = SIZE_EXPAND_FILL
footer_box.add_child( footer ) footer_box.add_child( footer )
footer.set_owner( footer_box ) footer.set_owner( footer_box )
###
### ###
# Open ###
# footer_label
var footer_label
if not footer.has_node( "footer_label" ):
footer_label = Label.new()
footer_label.name = "footer_label"
footer_label.size_flags_horizontal = SIZE_EXPAND
footer_label.size_flags_vertical = SIZE_EXPAND
footer.add_child( footer_label )
###
# resize
var resize_button var resize_button
if not footer_box.has_node( "Resize" ): if not footer.has_node( "resize" ):
resize_button = TextureButton.new() resize_button = TextureButton.new()
resize_button.name = "Resize" resize_button.name = "resize"
resize_button.size_flags_horizontal = SIZE_EXPAND | SIZE_SHRINK_END resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END
resize_button.size_flags_vertical = SIZE_EXPAND resize_button.size_flags_vertical = SIZE_SHRINK_END
var tex_resize = ImageTexture.new() var tex_resize = ImageTexture.new()
var img_resize = Image.new() var img_resize = Image.new()
@ -293,32 +304,50 @@ func _enter_tree():
resize_button.texture_normal = tex_resize resize_button.texture_normal = tex_resize
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
footer_box.add_child( resize_button ) footer.add_child( resize_button )
resize_button.set_owner( footer_box ) resize_button.set_owner( footer )
resize_button.connect ( "pressed", self, "_on_Resize_pressed" ) resize_button.connect ( "pressed", self, "_on_Resize_pressed" )
### ###er_label.set_owner( footer )
###
current_rect_size = self.rect_min_size current_rect_size = self.rect_min_size
if is_borderless: if is_borderless:
$background.region_rect = Rect2( 3, 28+3, 512-6, 512-28-6 ) $background.region_rect = Rect2( $background.patch_margin_left-1
header.get_node( "header/close").visible = false , $background.patch_margin_top-1
header.get_node( "header/open" ).visible = false , 256-($background.patch_margin_left+$background.patch_margin_right)+2
header.get_node( "header/quit" ).visible = false , 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
header.get_node( "header/label").visible = false $background.patch_margin_left = 1
$background.patch_margin_top = 1
$background.patch_margin_right = 1
$background.patch_margin_bottom = 1
close_button.visible = false
open_button.visible = false
quit_button.visible = false
title_label.visible = false
if not is_resizable: if not is_resizable:
$v_box_container/Footer/HBoxContainer/Resize.visible = false $v_box_container/Footer/HBoxContainer/Resize.visible = false
func _ready(): func _ready():
set_mouse_pass_to_children( self )
# On déplace les enfants ajouter via l'editeur sous content. # On déplace les enfants ajouter via l'editeur sous content.
for child in self.get_children(): for child in self.get_children():
if not child.name =="parts" and not child.name =="background": if not child.name =="parts" and not child.name =="background":
self.remove_child( child ) if child.name.begins_with( "footer_" ):
get_content().add_child( child ) if footer_box.get_node("footer").has_node("footer_label"):
footer_box.get_node("footer").remove_child( footer_box.get_node("footer").get_node("footer_label") )
self.remove_child( child )
get_footer().add_child( child )
get_footer().move_child( child, 0 )
else:
self.remove_child( child )
get_content().add_child( child )
set_mouse_pass_to_children( self )
@ -336,6 +365,8 @@ func _on_Quit_pressed():
func get_content(): func get_content():
return content_box.get_node( "scroll_container/content" ) return content_box.get_node( "scroll_container/content" )
func get_footer():
return footer_box.get_node( "footer" )
func close(): func close():

View file

@ -331,7 +331,7 @@ scroll_vertical = 0
scroll_deadzone = 0 scroll_deadzone = 0
_sections_unfolded = [ "Scroll", "Size Flags" ] _sections_unfolded = [ "Scroll", "Size Flags" ]
[node name="v_box_container" type="VBoxContainer" parent="Windows/Test/VBoxContainer/Content/scroll_container" index="2"] [node name="v_box_container" type="VBoxContainer" parent="Windows/Test/VBoxContainer/Content/scroll_container" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -844,7 +844,6 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Textures" ]
[node name="Music" type="MarginContainer" parent="Windows" index="2"] [node name="Music" type="MarginContainer" parent="Windows" index="2"]
editor/display_folded = true
visible = false visible = false
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -1199,28 +1198,256 @@ title = "Test window plugin"
background_color = Color( 0.808594, 0.808594, 0.808594, 1 ) background_color = Color( 0.808594, 0.808594, 0.808594, 1 )
background_texture = "res://assets/GUI/images/background_test.png" background_texture = "res://assets/GUI/images/background_test.png"
[node name="label" type="Label" parent="Windows/ui_window" index="0"] [node name="chat" type="MarginContainer" parent="Windows" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 20.0
margin_top = 435.0
margin_right = 258.0
margin_bottom = 574.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
script = ExtResource( 10 )
_sections_unfolded = [ "custom_constants" ]
__meta__ = {
"_editor_icon": ExtResource( 11 )
}
is_movable = true
is_resizable = true
is_borderless = true
title = "Test Chat"
background_color = Color( 0.808594, 0.808594, 0.808594, 1 )
background_texture = "res://assets/GUI/images/background_test.png"
[node name="v_box_container" type="VBoxContainer" parent="Windows/chat" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 62.0
margin_right = 238.0 margin_right = 238.0
margin_bottom = 76.0 margin_bottom = 190.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 0
_sections_unfolded = [ "Size Flags" ]
[node name="label" type="Label" parent="Windows/chat/v_box_container" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 230.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 2 mouse_filter = 2
mouse_default_cursor_shape = 0 mouse_default_cursor_shape = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 4 size_flags_vertical = 4
text = "Test label editeur." text = "Test"
autowrap = true
percent_visible = 1.0 percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
[node name="label2" type="Label" parent="Windows/chat/v_box_container" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 18.0
margin_right = 230.0
margin_bottom = 32.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label3" type="Label" parent="Windows/chat/v_box_container" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 36.0
margin_right = 230.0
margin_bottom = 50.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label4" type="Label" parent="Windows/chat/v_box_container" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 54.0
margin_right = 230.0
margin_bottom = 68.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label5" type="Label" parent="Windows/chat/v_box_container" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 72.0
margin_right = 230.0
margin_bottom = 86.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label6" type="Label" parent="Windows/chat/v_box_container" index="5"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 90.0
margin_right = 230.0
margin_bottom = 104.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label7" type="Label" parent="Windows/chat/v_box_container" index="6"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 108.0
margin_right = 230.0
margin_bottom = 122.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label8" type="Label" parent="Windows/chat/v_box_container" index="7"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 126.0
margin_right = 230.0
margin_bottom = 140.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="label9" type="Label" parent="Windows/chat/v_box_container" index="8"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 144.0
margin_right = 230.0
margin_bottom = 158.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Test"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="footer_line_edit" type="LineEdit" parent="Windows/chat" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 8.0
margin_top = 166.0
margin_right = 238.0
margin_bottom = 190.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 1
size_flags_horizontal = 3
size_flags_vertical = 10
focus_mode = 2
context_menu_enabled = true
placeholder_alpha = 0.6
caret_blink = false
caret_blink_speed = 0.65
caret_position = 0
_sections_unfolded = [ "Placeholder", "Size Flags" ]
[node name="Music" parent="." index="3" instance=ExtResource( 9 )] [node name="Music" parent="." index="3" instance=ExtResource( 9 )]
margin_left = 942.0 margin_left = 942.0