Amelioration du plugin de fenetre qui fonctionne corretement et ajoute meme les node ajouter via l'editeur automatiquement sous le node content.

This commit is contained in:
osquallo 2018-08-17 11:00:27 +02:00
parent 97c99cc0ef
commit c0e426ca00
4 changed files with 319 additions and 146 deletions

View file

@ -10,11 +10,25 @@ export(String) var background_texture = "res://assets/GUI/images/background_test
signal window_clicked( window ) signal window_clicked( window )
onready var header_box = $parts/header_box
onready var content_box = $parts/content_box
onready var footer_box = $parts/footer_box
var current_rect_size = Vector2( 0, 0 ) var current_rect_size = Vector2( 0, 0 )
var current_rect_position = Vector2( -1, -1 ) var current_rect_position = Vector2( -1, -1 )
var is_resizing = false var is_resizing = false
var is_moving = false var is_moving = false
func add_child( node):
if self.get_content():
self.get_content().add_child(node)
# else:
# .add_child( node )
# prints(self.get_name()+" just fathered", node.get_name())
func add_window_part( node ):
.add_child( node )
func set_mouse_pass_to_children( node ): func set_mouse_pass_to_children( node ):
for child in node.get_children(): for child in node.get_children():
set_mouse_pass_to_children( child ) set_mouse_pass_to_children( child )
@ -23,6 +37,26 @@ func set_mouse_pass_to_children( node ):
#func _ready(): #func _ready():
func _enter_tree(): func _enter_tree():
########
#### Window's part création.
# The interal elements structure is:
# self - MarginContainer
# background - NinePatchRect
# parts - VBoxContainer
# header_box - MarginContainer
# header - HBoxContainer
# quit - TextureButton
# close - TextureButton
# open - TextureButton
# label - Label
# content_box - MarginContainer
# scroll_container - Scrollcontainer
# content - VBoxContainer
# footer_box - MarginContainer
# footer - HBoxContainer
# contextual_help - Label
# resize - TextureButton
### ###
# self # self
self.size_flags_horizontal = SIZE_EXPAND self.size_flags_horizontal = SIZE_EXPAND
@ -37,11 +71,11 @@ func _enter_tree():
self.connect ( "gui_input", self, "_on_window_gui_input" ) self.connect ( "gui_input", self, "_on_window_gui_input" )
### ###
### ###
# Background # background
var background var background
if not self.has_node( "Background" ): if not self.has_node( "background" ):
background = NinePatchRect.new() background = NinePatchRect.new()
background.name = "Background" background.name = "background"
var background_image = Image.new() var background_image = Image.new()
if not background_image.load( background_texture ): if not background_image.load( background_texture ):
print("Erreur lors du chargement de l'image: "+background_texture ) print("Erreur lors du chargement de l'image: "+background_texture )
@ -62,61 +96,59 @@ func _enter_tree():
background.self_modulate = background_color background.self_modulate = background_color
self.add_child( background ) self.add_window_part( background )
background.set_owner( self ) background.set_owner( self )
### ###
### ###
var v_box_container # parts
# VBoxContainer var parts
if not self.has_node( "VBoxContainer" ): if not self.has_node( "parts" ):
v_box_container = VBoxContainer.new() parts = VBoxContainer.new()
v_box_container.name = "VBoxContainer" parts.name = "parts"
v_box_container.size_flags_horizontal = SIZE_EXPAND_FILL parts.size_flags_horizontal = SIZE_EXPAND_FILL
v_box_container.size_flags_vertical = SIZE_EXPAND_FILL parts.size_flags_vertical = SIZE_EXPAND_FILL
self.add_child( v_box_container ) self.add_window_part( parts )
v_box_container.set_owner( self ) parts.set_owner( self )
###
###
# Header
var header
if not v_box_container.has_node( "Header" ):
header = MarginContainer.new()
header.name = "Header"
header.size_flags_horizontal = SIZE_EXPAND_FILL
header.size_flags_vertical = SIZE_SHRINK_CENTER
header.set( "custom_constants/margin_right", 0)
header.set( "custom_constants/margin_top", 4)
header.set( "custom_constants/margin_left", 4)
header.set( "custom_constants/margin_bottom", 4)
if is_movable:
header.mouse_default_cursor_shape = CURSOR_MOVE
v_box_container.add_child( header )
header.set_owner( v_box_container )
header.connect ( "gui_input", self, "_on_Header_gui_input" )
### ###
### ###
# header_box
var header_box var header_box
# Header/HBoxContainer if not parts.has_node( "header_box" ):
if not header.has_node( "HBoxContainer" ): header_box = MarginContainer.new()
header_box = HBoxContainer.new() header_box.name = "header_box"
header_box.name = "HBoxContainer"
header_box.size_flags_horizontal = SIZE_EXPAND_FILL header_box.size_flags_horizontal = SIZE_EXPAND_FILL
header_box.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER header_box.size_flags_vertical = SIZE_SHRINK_CENTER
header_box.set( "custom_constants/margin_right", 0)
header_box.set( "custom_constants/margin_top", 4)
header_box.set( "custom_constants/margin_left", 4)
header_box.set( "custom_constants/margin_bottom", 4)
if is_movable:
header_box.mouse_default_cursor_shape = CURSOR_MOVE
parts.add_child( header_box )
header_box.set_owner( parts )
header_box.connect ( "gui_input", self, "_on_Header_gui_input" )
###
###
# header
var header
if not header_box.has_node( "header" ):
header = HBoxContainer.new()
header.name = "header"
header.size_flags_horizontal = SIZE_EXPAND_FILL
header.size_flags_vertical = SIZE_EXPAND | SIZE_SHRINK_CENTER
if is_movable: if is_movable:
header.mouse_default_cursor_shape = CURSOR_MOVE header.mouse_default_cursor_shape = CURSOR_MOVE
header.add_child( header_box ) header_box.add_child( header )
header_box.set_owner( header ) header.set_owner( header )
### ###
### ###
# Quit # quit
var quit_button var quit_button
if not header_box.has_node( "Quit" ): if not header.has_node( "quit" ):
quit_button = TextureButton.new() quit_button = TextureButton.new()
quit_button.name = "Quit" quit_button.name = "quit"
quit_button.size_flags_horizontal = SIZE_SHRINK_END quit_button.size_flags_horizontal = SIZE_SHRINK_END
quit_button.size_flags_vertical = SIZE_SHRINK_CENTER quit_button.size_flags_vertical = SIZE_SHRINK_CENTER
@ -126,15 +158,15 @@ func _enter_tree():
tex_quit.create_from_image( img_quit ) tex_quit.create_from_image( img_quit )
quit_button.texture_normal = tex_quit quit_button.texture_normal = tex_quit
header_box.add_child( quit_button ) header.add_child( quit_button )
quit_button.set_owner( header_box ) quit_button.set_owner( header )
quit_button.connect ( "pressed", self, "_on_Quit_pressed" ) quit_button.connect ( "pressed", self, "_on_Quit_pressed" )
### ###
# Close # close
var close_button = TextureButton.new() var close_button = TextureButton.new()
if not header_box.has_node( "Close" ): if not header.has_node( "close" ):
close_button = TextureButton.new() close_button = TextureButton.new()
close_button.name = "Close" close_button.name = "close"
close_button.size_flags_horizontal = SIZE_SHRINK_END close_button.size_flags_horizontal = SIZE_SHRINK_END
close_button.size_flags_vertical = SIZE_SHRINK_CENTER close_button.size_flags_vertical = SIZE_SHRINK_CENTER
@ -144,15 +176,15 @@ func _enter_tree():
tex_close.create_from_image( img_close ) tex_close.create_from_image( img_close )
close_button.texture_normal = tex_close close_button.texture_normal = tex_close
header_box.add_child( close_button ) header.add_child( close_button )
close_button.set_owner( header_box ) close_button.set_owner( header )
close_button.connect ( "pressed", self, "_on_Close_pressed" ) close_button.connect ( "pressed", self, "_on_Close_pressed" )
### ###
# Open # open
var open_button var open_button
if not header_box.has_node( "Open" ): if not header.has_node( "open" ):
open_button = TextureButton.new() open_button = TextureButton.new()
open_button.name = "Open" open_button.name = "open"
open_button.size_flags_horizontal = SIZE_SHRINK_END open_button.size_flags_horizontal = SIZE_SHRINK_END
open_button.size_flags_vertical = SIZE_SHRINK_CENTER open_button.size_flags_vertical = SIZE_SHRINK_CENTER
@ -162,64 +194,88 @@ func _enter_tree():
tex_open.create_from_image( img_open ) tex_open.create_from_image( img_open )
open_button.texture_normal = tex_open open_button.texture_normal = tex_open
open_button.visible = false open_button.visible = false
header_box.add_child( open_button ) header.add_child( open_button )
open_button.set_owner( header_box ) open_button.set_owner( header )
open_button.connect ( "pressed", self, "_on_Open_pressed" ) open_button.connect ( "pressed", self, "_on_Open_pressed" )
### ###
### ###
# Title Label # Title Label
var title_label var title_label
if not header_box.has_node( "Label" ): if not header.has_node( "label" ):
title_label = Label.new() title_label = Label.new()
title_label.name = "Label" title_label.name = "label"
title_label.text = title title_label.text = title
title_label.size_flags_horizontal = SIZE_EXPAND_FILL title_label.size_flags_horizontal = SIZE_EXPAND_FILL
title_label.size_flags_vertical = SIZE_SHRINK_CENTER title_label.size_flags_vertical = SIZE_SHRINK_CENTER
if is_movable: if is_movable:
title_label.mouse_default_cursor_shape = CURSOR_MOVE title_label.mouse_default_cursor_shape = CURSOR_MOVE
header_box.add_child( title_label ) header.add_child( title_label )
title_label.set_owner( header_box ) title_label.set_owner( header )
### ###
### ###
# Content # Content
var content_box
if not parts.has_node( "content_box" ):
content_box = MarginContainer.new()
content_box.name = "content_box"
content_box.size_flags_horizontal = SIZE_EXPAND_FILL
content_box.size_flags_vertical = SIZE_EXPAND_FILL
content_box.set( "custom_constants/margin_right", 8)
content_box.set( "custom_constants/margin_top", 8)
content_box.set( "custom_constants/margin_left", 8)
content_box.set( "custom_constants/margin_bottom", 8)
parts.add_child( content_box )
content_box.set_owner( parts )
###
###
# content_box/scroll_container
var content_scroll_container
if not content_box.has_node( "scroll_container" ):
content_scroll_container = ScrollContainer.new()
content_scroll_container.name = "scroll_container"
content_scroll_container.size_flags_horizontal = SIZE_FILL
content_scroll_container.size_flags_vertical = SIZE_FILL
content_box.add_child( content_scroll_container )
content_scroll_container.set_owner( content_box )
###
###
# content
var content var content
if not v_box_container.has_node( "Content" ): if not content_scroll_container.has_node( "content" ):
content = MarginContainer.new() content = VBoxContainer.new()
content.name = "Content" content.name = "content"
content.size_flags_horizontal = SIZE_EXPAND_FILL content.size_flags_horizontal = SIZE_EXPAND_FILL
content.size_flags_vertical = SIZE_EXPAND_FILL content.size_flags_vertical = SIZE_EXPAND_FILL
content.set( "custom_constants/margin_right", 8) content_scroll_container.add_child( content )
content.set( "custom_constants/margin_top", 8) content.set_owner( content_scroll_container )
content.set( "custom_constants/margin_left", 8)
content.set( "custom_constants/margin_bottom", 8)
v_box_container.add_child( content )
content.set_owner( v_box_container )
### ###
### ###
# Footer # Footer
var footer var footer_box
if not v_box_container.has_node( "Footer" ): if not parts.has_node( "footer_box" ):
footer = MarginContainer.new() footer_box = MarginContainer.new()
footer.name = "Footer" footer_box.name = "footer_box"
footer.size_flags_horizontal = SIZE_FILL footer_box.size_flags_horizontal = SIZE_FILL
footer.size_flags_vertical = SIZE_FILL footer_box.size_flags_vertical = SIZE_FILL
footer.set( "custom_constants/margin_right", 6) footer_box.set( "custom_constants/margin_right", 6)
footer.set( "custom_constants/margin_top", 2) footer_box.set( "custom_constants/margin_top", 2)
footer.set( "custom_constants/margin_left", 6) footer_box.set( "custom_constants/margin_left", 6)
footer.set( "custom_constants/margin_bottom", 6) footer_box.set( "custom_constants/margin_bottom", 6)
v_box_container.add_child( footer ) parts.add_child( footer_box )
footer.set_owner( v_box_container ) footer_box.set_owner( parts )
### ###
### ###
# Header/HBoxContainer # Header/HBoxContainer
var footer_box var footer
if not footer.has_node( "HBoxContainer" ): if not footer_box.has_node( "footer" ):
footer_box = HBoxContainer.new() footer = HBoxContainer.new()
footer_box.name = "HBoxContainer" footer.name = "footer"
footer_box.size_flags_horizontal = SIZE_FILL footer.size_flags_horizontal = SIZE_FILL
footer_box.size_flags_vertical = SIZE_FILL footer.size_flags_vertical = SIZE_FILL
footer.add_child( footer_box ) footer_box.add_child( footer )
footer_box.set_owner( footer ) footer.set_owner( footer_box )
### ###
### ###
# Open # Open
@ -245,23 +301,27 @@ func _enter_tree():
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( 3, 28+3, 512-6, 512-28-6 )
$VBoxContainer/Header/HBoxContainer/Close.visible = false header.get_node( "header/close").visible = false
$VBoxContainer/Header/HBoxContainer/Open.visible = false header.get_node( "header/open" ).visible = false
$VBoxContainer/Header/HBoxContainer/Quit.visible = false header.get_node( "header/quit" ).visible = false
$VBoxContainer/Header/HBoxContainer/Label.visible = false header.get_node( "header/label").visible = false
# else:
# $Background.region_rect = Rect2( 0, 0, 512, 512 )
# $VBoxContainer/Header/HBoxContainer/Close.visible = true
# $VBoxContainer/Header/HBoxContainer/Open.visible = false
# $VBoxContainer/Header/HBoxContainer/Quit.visible = true
# $VBoxContainer/Header/HBoxContainer/Label.visible = true
if not is_resizable: if not is_resizable:
$VBoxContainer/Footer/HBoxContainer/Resize.visible = false $v_box_container/Footer/HBoxContainer/Resize.visible = false
func _ready(): func _ready():
set_mouse_pass_to_children( self ) set_mouse_pass_to_children( self )
# On déplace les enfants ajouter via l'editeur sous content.
for child in self.get_children():
if not child.name =="parts" and not child.name =="background":
self.remove_child( child )
get_content().add_child( child )
func _on_Window_mouse_entered(): func _on_Window_mouse_entered():
print("mouse_entered") print("mouse_entered")
@ -274,23 +334,23 @@ func _on_Quit_pressed():
self.visible = false self.visible = false
func get_content(): func get_content():
return $VBoxContainer/Content return content_box.get_node( "scroll_container/content" )
func close(): func close():
if not is_borderless: if not is_borderless:
$VBoxContainer/Header/HBoxContainer/Close.visible = false header_box.get_node( "header/close" ).visible = false
$VBoxContainer/Header/HBoxContainer/Open.visible = true header_box.get_node( "header/open" ).visible = true
$VBoxContainer/Content.visible = false content_box.visible = false
$VBoxContainer/Footer.visible = false footer_box.visible = false
current_rect_size = self.rect_size current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 ) self.rect_size = Vector2( 0, 0 )
else: else:
$VBoxContainer/Header/HBoxContainer/Close.visible = false header_box.get_node( "header/close" ).visible = false
$VBoxContainer/Header/HBoxContainer/Open.visible = false header_box.get_node( "header/open" ).visible = false
$VBoxContainer/Content.visible = false content_box.visible = false
$VBoxContainer/Footer.visible = false footer_box.visible = false
current_rect_size = self.rect_size current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 ) self.rect_size = Vector2( 0, 0 )
@ -300,16 +360,16 @@ func _on_Close_pressed():
func open(): func open():
if not is_borderless: if not is_borderless:
$VBoxContainer/Header/HBoxContainer/Close.visible = true header_box.get_node( "header/close" ).visible = true
$VBoxContainer/Header/HBoxContainer/Open.visible = false header_box.get_node( "header/open" ).visible = false
$VBoxContainer/Content.visible = true content_box.visible = true
$VBoxContainer/Footer.visible = true footer_box.visible = true
self.rect_size = current_rect_size self.rect_size = current_rect_size
else: else:
$VBoxContainer/Header/HBoxContainer/Close.visible = false header_box.get_node( "header/close" ).visible = false
$VBoxContainer/Header/HBoxContainer/Open.visible = false header_box.get_node( "header/open" ).visible = false
$VBoxContainer/Content.visible = true content_box.visible = true
$VBoxContainer/Footer.visible = true footer_box.visible = true
self.rect_size = current_rect_size self.rect_size = current_rect_size
func _on_Open_pressed(): func _on_Open_pressed():

View file

@ -87,6 +87,7 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Theme", "Visibility", "custom_sty
[node name="Test" type="MarginContainer" parent="Windows" index="0"] [node name="Test" type="MarginContainer" parent="Windows" index="0"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -158,7 +159,6 @@ _sections_unfolded = [ "Mouse", "Rect", "Size Flags", "Visibility", "custom_cons
[node name="Header" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="0"] [node name="Header" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="0"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -179,7 +179,6 @@ _sections_unfolded = [ "Margin", "Mouse", "Rect", "Size Flags", "custom_constant
[node name="HBoxContainer" type="HBoxContainer" parent="Windows/Test/VBoxContainer/Header" index="0"] [node name="HBoxContainer" type="HBoxContainer" parent="Windows/Test/VBoxContainer/Header" index="0"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -309,7 +308,7 @@ custom_constants/margin_left = 8
custom_constants/margin_bottom = 8 custom_constants/margin_bottom = 8
_sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ] _sections_unfolded = [ "Mouse", "Rect", "Size Flags", "custom_constants" ]
[node name="RichTextLabel" type="RichTextLabel" parent="Windows/Test/VBoxContainer/Content" index="0"] [node name="scroll_container" type="ScrollContainer" parent="Windows/Test/VBoxContainer/Content" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -321,27 +320,77 @@ margin_right = 281.0
margin_bottom = 72.0 margin_bottom = 72.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true rect_clip_content = true
focus_mode = 2 mouse_filter = 0
mouse_filter = 1
mouse_default_cursor_shape = 0 mouse_default_cursor_shape = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 1 size_flags_vertical = 1
bbcode_enabled = false scroll_horizontal_enabled = true
bbcode_text = "" scroll_horizontal = 0
visible_characters = -1 scroll_vertical_enabled = true
scroll_vertical = 0
scroll_deadzone = 0
_sections_unfolded = [ "Scroll", "Size Flags" ]
[node name="v_box_container" type="VBoxContainer" parent="Windows/Test/VBoxContainer/Content/scroll_container" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 261.0
margin_bottom = 440.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/Test/VBoxContainer/Content/scroll_container/v_box_container" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 261.0
margin_bottom = 218.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
autowrap = true
percent_visible = 1.0 percent_visible = 1.0
meta_underlined = true lines_skipped = 0
tab_size = 4 max_lines_visible = -1
text = "Lorem [url]ipsum[/url] dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\\nLorem [url]ipsum[/url] dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
scroll_active = true [node name="label2" type="Label" parent="Windows/Test/VBoxContainer/Content/scroll_container/v_box_container" index="1"]
scroll_following = true
selection_enabled = true anchor_left = 0.0
override_selected_font_color = false anchor_top = 0.0
_sections_unfolded = [ "BBCode", "Mouse", "Rect", "Size Flags" ] anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 222.0
margin_right = 261.0
margin_bottom = 440.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
autowrap = true
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Footer" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="2"] [node name="Footer" type="MarginContainer" parent="Windows/Test/VBoxContainer" index="2"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -380,7 +429,29 @@ size_flags_vertical = 1
alignment = 0 alignment = 0
_sections_unfolded = [ "Mouse", "Size Flags" ] _sections_unfolded = [ "Mouse", "Size Flags" ]
[node name="Resize" type="TextureButton" parent="Windows/Test/VBoxContainer/Footer/HBoxContainer" index="0"] [node name="label" type="Label" parent="Windows/Test/VBoxContainer/Footer/HBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 82.0
margin_top = 1.0
margin_right = 175.0
margin_bottom = 15.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 6
size_flags_vertical = 4
text = "Contetual help"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="Resize" type="TextureButton" parent="Windows/Test/VBoxContainer/Footer/HBoxContainer" index="1"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -394,7 +465,7 @@ rect_clip_content = false
focus_mode = 2 focus_mode = 2
mouse_filter = 0 mouse_filter = 0
mouse_default_cursor_shape = 12 mouse_default_cursor_shape = 12
size_flags_horizontal = 10 size_flags_horizontal = 8
size_flags_vertical = 2 size_flags_vertical = 2
toggle_mode = false toggle_mode = false
action_mode = 0 action_mode = 0
@ -406,6 +477,8 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Textures" ]
[node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"] [node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"]
editor/display_folded = true
visible = false
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -772,6 +845,7 @@ _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 editor/display_folded = true
visible = false
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -1125,6 +1199,28 @@ 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"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 8.0
margin_top = 62.0
margin_right = 238.0
margin_bottom = 76.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 label editeur."
autowrap = true
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[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

View file

@ -11,6 +11,13 @@ var current_rect_position = Vector2( -1, -1 )
var is_resizing = false var is_resizing = false
var is_moving = false var is_moving = false
func add_child(node):
$VBoxContainer/Content/scroll_container/v_box_container.add_child(node)
prints(self.get_name()+" just fathered", node.get_name())
func set_mouse_pass_to_children( node ): func set_mouse_pass_to_children( node ):
for child in node.get_children(): for child in node.get_children():
set_mouse_pass_to_children( child ) set_mouse_pass_to_children( child )

View file

@ -5,6 +5,17 @@ func _ready():
for child in self.get_children(): for child in self.get_children():
child.connect( "window_clicked", self, "_on_window_clicked" ) child.connect( "window_clicked", self, "_on_window_clicked" )
var new_label = Label.new()
new_label.set_name( "azerty" )
new_label.set_text( "azertyuiop sdfghjklm wxcvbn" )
new_label.set_autowrap( true )
$ui_window.add_child( new_label )
new_label = Label.new()
new_label.set_name( "azerty2" )
new_label.set_text( "2azertyuiop2 2sdfghjklm2 wxcvbn2" )
new_label.set_autowrap( true )
$ui_window.add_child( new_label )
func _on_window_clicked( window ): func _on_window_clicked( window ):
var index = 0 var index = 0
@ -13,4 +24,3 @@ func _on_window_clicked( window ):
index += 1 index += 1
self.move_child(window, index) self.move_child(window, index)
# TODO deplacer le deplacement des fenetres ici et tout ce qui est management des fenetre et non de leur contenu.