1
0
Fork 0
ExampleProject/RetroWindowsGUI/DesktopWindow.tscn

345 lines
13 KiB
Plaintext
Raw Normal View History

[gd_scene load_steps=19 format=3 uid="uid://bedj3x7821sbp"]
[ext_resource type="Script" path="res://RetroWindowsGUI/DesktopWindow.gd" id="1_1566a"]
[ext_resource type="Theme" uid="uid://c23xui480a6b6" path="res://RetroWindowsGUI/RetroWindowsTheme.tres" id="1_clavd"]
[ext_resource type="Script" path="res://RetroWindowsGUI/RetroWindow.gd" id="2_5apeq"]
[ext_resource type="Texture2D" uid="uid://byysuusmylpjo" path="res://RetroWindowsGUI/Images/Window_Header_Inner.png" id="3_o2go2"]
[ext_resource type="Texture2D" uid="uid://f572ckglau50" path="res://RetroWindowsGUI/Images/Windows_Icon_Minimize.png" id="4_p55hd"]
[ext_resource type="Texture2D" uid="uid://bir5p8cnwtwrn" path="res://RetroWindowsGUI/Images/Windows_Icon_Maximize.png" id="5_6yn4a"]
[ext_resource type="Texture2D" uid="uid://lfo3fn4qyl3g" path="res://RetroWindowsGUI/Images/Windows_Icon_Question.png" id="6_0uvav"]
[ext_resource type="Texture2D" uid="uid://bluatk0bspn3x" path="res://RetroWindowsGUI/Images/Windows_Icon_Close.png" id="7_r5i4b"]
[ext_resource type="Texture2D" uid="uid://dxtjm7ivsy8s1" path="res://RetroWindowsGUI/Images/Windows_Inner_Frame_Inverted.png" id="8_lxvf8"]
[ext_resource type="Script" path="res://RetroWindowsGUI/ResizeHandle.gd" id="9_b570p"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_gihe0"]
texture = ExtResource("3_o2go2")
[sub_resource type="GDScript" id="GDScript_ly7j8"]
script/source = "extends PanelContainer
@export var window: DesktopWindow
var dragging: bool = false
var begmosposi: Vector2i # beginning mouse position integer
var begwndpos: Vector2i # beginning window position
# get windows mouse position integer
func getmosposi() -> Vector2i:
var mospos := get_global_mouse_position()
return Vector2i(floori(mospos.x), floori(mospos.y))
func _input(event: InputEvent):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
if event.is_released():
dragging = false
# snap within game window
var rect = window.get_global_rect()
if rect.position.x < 0:
rect.position.x = 0
if rect.position.y < 0:
rect.position.y = 0
window.position = rect.position
elif event is InputEventMouseMotion:
if dragging:
window.global_position = begwndpos + getmosposi() - begmosposi
func _gui_input(event: InputEvent):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
if event.double_click:
if get_global_rect().has_point(get_global_mouse_position()):
window.toggle_maximized()
elif event.pressed:
if get_global_rect().has_point(get_global_mouse_position()):
dragging = true
begmosposi = getmosposi()
begwndpos = window.get_global_rect().position
"
[sub_resource type="GDScript" id="GDScript_fvsxv"]
script/source = "extends Button
@export var window: DesktopWindow
func _ready():
pressed.connect(_on_pressed)
func _on_pressed():
window.minimize()
"
[sub_resource type="GDScript" id="GDScript_orv1v"]
script/source = "extends Button
@export var window: DesktopWindow
func _ready():
pressed.connect(_on_pressed)
func _on_pressed():
window.toggle_maximized()
"
[sub_resource type="GDScript" id="GDScript_go6nd"]
script/source = "extends Button
@export var window: DesktopWindow
func _ready():
pressed.connect(_on_pressed)
func _on_pressed():
window.close()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yu144"]
bg_color = Color(0.831373, 0.815686, 0.784314, 1)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_eejdr"]
content_margin_left = 2.0
content_margin_top = 2.0
content_margin_right = 2.0
content_margin_bottom = 2.0
texture = ExtResource("8_lxvf8")
texture_margin_left = 3.0
texture_margin_top = 3.0
texture_margin_right = 3.0
texture_margin_bottom = 3.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_sn8k8"]
texture = ExtResource("8_lxvf8")
texture_margin_left = 3.0
texture_margin_top = 3.0
texture_margin_right = 3.0
texture_margin_bottom = 3.0
[node name="DesktopWindow" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 161.0
offset_bottom = 137.0
size_flags_vertical = 3
theme = ExtResource("1_clavd")
script = ExtResource("1_1566a")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2_5apeq")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/separation = 2
[node name="PanelContainer (Header)" type="PanelContainer" parent="PanelContainer/VBoxContainer" node_paths=PackedStringArray("window")]
custom_minimum_size = Vector2(0, 25)
layout_mode = 2
theme_type_variation = &"HeaderPanelContainer"
theme_override_styles/panel = SubResource("StyleBoxTexture_gihe0")
script = SubResource("GDScript_ly7j8")
window = NodePath("../../..")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)"]
custom_minimum_size = Vector2(0, 26)
layout_mode = 2
theme_override_constants/separation = 0
[node name="MarginContainer (Title)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 5
theme_override_constants/margin_right = 5
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Title)"]
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 16
text = "Inventory"
[node name="MarginContainer (Minimize)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 6
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)" node_paths=PackedStringArray("window")]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_vertical = 0
expand_icon = true
script = SubResource("GDScript_fvsxv")
window = NodePath("../../../../../..")
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Minimize)"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 2
texture = ExtResource("4_p55hd")
[node name="MarginContainer (Maximize)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 6
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)" node_paths=PackedStringArray("window")]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_vertical = 0
expand_icon = true
script = SubResource("GDScript_orv1v")
window = NodePath("../../../../../..")
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Maximize)"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 2
texture = ExtResource("5_6yn4a")
[node name="MarginContainer (Help)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 6
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_vertical = 0
expand_icon = true
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Help)"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 2
texture = ExtResource("6_0uvav")
[node name="MarginContainer (Close)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 2
theme_override_constants/margin_top = 6
theme_override_constants/margin_right = 2
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)" node_paths=PackedStringArray("window")]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_vertical = 0
expand_icon = true
script = SubResource("GDScript_go6nd")
window = NodePath("../../../../../..")
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/PanelContainer (Header)/HBoxContainer/MarginContainer (Close)"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 2
texture = ExtResource("7_r5i4b")
[node name="PanelContainer (Menu Bar)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_yu144")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)"]
custom_minimum_size = Vector2(0, 16)
layout_mode = 2
theme_override_constants/separation = 0
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer"]
layout_mode = 2
theme_type_variation = &"FlatButton"
theme_override_colors/font_color = Color(0, 0, 0, 0)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 0)
theme_override_colors/font_hover_color = Color(0, 0, 0, 0)
theme_override_colors/font_focus_color = Color(0, 0, 0, 0)
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 0)
theme_override_colors/font_disabled_color = Color(0, 0, 0, 0)
theme_override_colors/font_outline_color = Color(0, 0, 0, 0)
text = "File"
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_top = 0
[node name="CenterContainer" type="CenterContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer"]
layout_mode = 2
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer/PanelContainer (Menu Bar)/HBoxContainer/Button/MarginContainer/CenterContainer"]
layout_mode = 2
size_flags_vertical = 8
mouse_filter = 2
bbcode_enabled = true
text = "[u]F[/u]ile"
fit_content = true
autowrap_mode = 0
[node name="PanelContainer (Body)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_type_variation = &"InvertedInnerPanelContainer"
theme_override_styles/panel = SubResource("StyleBoxTexture_eejdr")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 0
[node name="MarginContainer (Content)" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VScrollBar" type="VScrollBar" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 1
size_flags_vertical = 3
page = 100.0
[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer"]
custom_minimum_size = Vector2(0, 15)
layout_mode = 2
theme_override_constants/separation = 0
[node name="HScrollBar" type="HScrollBar" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
size_flags_horizontal = 3
page = 100.0
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/PanelContainer (Body)/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(16, 0)
layout_mode = 2
[node name="PanelContainer (Status Bar)" type="PanelContainer" parent="PanelContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 16)
layout_mode = 2
size_flags_vertical = 8
theme_override_styles/panel = SubResource("StyleBoxTexture_sn8k8")
[node name="Button (Resize Handle)" type="Button" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -17.0
offset_top = -18.0
offset_right = -5.0
offset_bottom = -6.0
grow_horizontal = 0
grow_vertical = 0
theme_type_variation = &"ResizeButton"
action_mode = 0
keep_pressed_outside = true
script = ExtResource("9_b570p")