private void ConfigureQualifierPopupMenu() { PopupMenu menu = _qualifierNode.GetPopup(); menu.AddItem("N"); menu.AddItem("P+"); menu.AddItem("P-"); menu.Connect("id_pressed", this, nameof(OnPopupElementSelected)); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { // Set up the menu bar items FileButton = GetNode <MenuButton>("MenuBar/btnFile"); PopupMenu FileButtonPopup = FileButton.GetPopup(); EditButton = GetNode <MenuButton>("MenuBar/btnEdit"); PopupMenu EditButtonPopup = EditButton.GetPopup(); ViewButton = GetNode <MenuButton>("MenuBar/btnView"); HelpButton = GetNode <MenuButton>("MenuBar/btnHelp"); // Populate file FileButtonPopup.AddItem("New"); FileButtonPopup.AddItem("Open"); FileButtonPopup.AddItem("Import"); FileButtonPopup.AddSeparator(); FileButtonPopup.AddItem("Save"); FileButtonPopup.AddItem("Save As"); FileButtonPopup.AddSeparator(); FileButtonPopup.AddItem("Preferences"); FileButtonPopup.AddSeparator(); FileButtonPopup.AddItem("Exit"); FileButtonPopup.Connect("id_pressed", this, "FileButtonPressed"); PreferencesWindow = GetNode <WindowDialog>("/root/main/UI/PreferencesWindow"); ImportWindow = GetNode <FileDialog>("/root/main/UI/ImportWindow"); // Populate edit // Create Insert shape submenu PopupMenu AddShapeMenu = new PopupMenu(); AddShapeMenu.Name = "Shape"; AddShapeMenu.AddItem("Square"); AddShapeMenu.AddItem("Sphere"); AddShapeMenu.AddItem("Cylinder"); AddShapeMenu.AddItem("Prism"); AddShapeMenu.AddItem("Capsule"); EditButtonPopup.AddChild(AddShapeMenu); EditButtonPopup.AddSubmenuItem("Add Shape", "Shape"); // Populate view ViewButton.GetPopup().AddItem("1"); ViewButton.GetPopup().AddItem("2"); ViewButton.GetPopup().AddItem("2alt"); ViewButton.GetPopup().AddItem("3"); ViewButton.GetPopup().AddItem("3alt"); ViewButton.GetPopup().AddItem("4"); ViewButton.GetPopup().Connect("id_pressed", GetNode("/root/main/UI/AppWindow/EnvironmentContainer/4WayViewport/"), "toolbarViewItemPressed"); this.Connect("gui_input", this, "TitleBarGUIInputHandler"); GD.Print("TITLEBAR.CS: READY"); }
public override void _Ready() { Main = Owner as Program; Schd = Main !.GetNode <SceneHandler>("SceneHandler"); MyMenu = GetNode <MenuButton>("MenuHBox/MenuButton"); PopupMenu myPopup = MyMenu.GetPopup(); myPopup.Connect("id_pressed", this, "_OnMenuPopupPressed"); }
public void ConnectSignals() { PlayBtn.Connect("pressed", this, nameof(PlayStream)); StopBtn.Connect("pressed", this, nameof(StopStream)); NextBtn.Connect("pressed", this, nameof(NextStation)); Radio.Connect("index_pressed", this, nameof(RadioPressed)); VolumeBar.Connect("value_changed", this, nameof(ChangeVolume)); AddStation.Connect("pressed", this, nameof(PopupAddStation)); NewStation.Connect("confirmed", this, nameof(AddNewStation)); StationHandler.Connect(nameof(StationHandler.AddNewStation), this, nameof(AddRadioItem)); }
private void Link() { if (linked) { return; } jobSelector = GetNode <MenuButton>("Body/Right/Button"); actionName = GetNode <Label>("Body/Right/Job/Name"); actionDescription = GetNode <Label>("Body/Right/Job/Description"); GetNode <Button>("Body/Left/Button").Connect("pressed", this, nameof(CharacterPressed)); popup = (PopupMenu)jobSelector.Call("get_popup"); popup.Connect("id_pressed", this, nameof(on_ChangeAction)); linked = true; }
public CustomDropDown() { Popup = GetPopup(); items = new List <Item>(); tween = new Tween(); AddChild(tween); cachedPopupVSeparation = Popup.GetConstant("vseparation"); var checkSize = Popup.GetIcon("checked").GetSize(); // Set the custom icon size iconSize = new Vector2(checkSize.x - 2, checkSize.y - 2); Popup.RectClipContent = true; Connect("about_to_show", this, nameof(OnPopupAboutToShow)); Popup.Connect("draw", this, nameof(RedrawPopup)); }
public override void EnablePlugin() { base.EnablePlugin(); if (Instance != null) { throw new InvalidOperationException(); } Instance = this; var editorInterface = GetEditorInterface(); var editorBaseControl = editorInterface.GetBaseControl(); editorSettings = editorInterface.GetEditorSettings(); errorDialog = new AcceptDialog(); editorBaseControl.AddChild(errorDialog); BottomPanel = new BottomPanel(); bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR()); AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" }); menuPopup = new PopupMenu(); menuPopup.Hide(); menuPopup.SetAsToplevel(true); AddToolSubmenuItem("Mono", menuPopup); // TODO: Remove or edit this info dialog once Mono support is no longer in alpha { menuPopup.AddItem("About C# support".TTR(), (int)MenuOptions.AboutCSharp); aboutDialog = new AcceptDialog(); editorBaseControl.AddChild(aboutDialog); aboutDialog.WindowTitle = "Important: C# support is not feature-complete"; // We don't use DialogText as the default AcceptDialog Label doesn't play well with the TextureRect and CheckBox // we'll add. Instead we add containers and a new autowrapped Label inside. // Main VBoxContainer (icon + label on top, checkbox at bottom) var aboutVBox = new VBoxContainer(); aboutDialog.AddChild(aboutVBox); // HBoxContainer for icon + label var aboutHBox = new HBoxContainer(); aboutVBox.AddChild(aboutHBox); var aboutIcon = new TextureRect(); aboutIcon.Texture = aboutIcon.GetIcon("NodeWarning", "EditorIcons"); aboutHBox.AddChild(aboutIcon); var aboutLabel = new Label(); aboutHBox.AddChild(aboutLabel); aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale; aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill; aboutLabel.Autowrap = true; aboutLabel.Text = "C# support in Godot Engine is in late alpha stage and, while already usable, " + "it is not meant for use in production.\n\n" + "Projects can be exported to Linux, macOS, Windows and Android, but not yet to iOS, HTML5 or UWP. " + "Bugs and usability issues will be addressed gradually over future releases, " + "potentially including compatibility breaking changes as new features are implemented for a better overall C# experience.\n\n" + "If you experience issues with this Mono build, please report them on Godot's issue tracker with details about your system, MSBuild version, IDE, etc.:\n\n" + " https://github.com/godotengine/godot/issues\n\n" + "Your critical feedback at this stage will play a great role in shaping the C# support in future releases, so thank you!"; EditorDef("mono/editor/show_info_on_start", true); // CheckBox in main container aboutDialogCheckBox = new CheckBox { Text = "Show this warning when starting the editor" }; aboutDialogCheckBox.Connect("toggled", this, nameof(_ToggleAboutDialogOnStart)); aboutVBox.AddChild(aboutDialogCheckBox); } if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath)) { // Make sure the existing project has Api assembly references configured correctly CsProjOperations.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath); } else { bottomPanelBtn.Hide(); menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln); } menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed)); var buildButton = new ToolButton { Text = "Build", HintTooltip = "Build solution", FocusMode = Control.FocusModeEnum.None }; buildButton.Connect("pressed", this, nameof(_BuildSolutionPressed)); AddControlToContainer(CustomControlContainer.Toolbar, buildButton); // External editor settings EditorDef("mono/editor/external_editor", ExternalEditorId.None); string settingsHintStr = "Disabled"; if (OS.IsWindows) { settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } else if (OS.IsOSX) { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } else if (OS.IsUnixLike()) { settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary { ["type"] = Variant.Type.Int, ["name"] = "mono/editor/external_editor", ["hint"] = PropertyHint.Enum, ["hint_string"] = settingsHintStr }); // Export plugin var exportPlugin = new ExportPlugin(); AddExportPlugin(exportPlugin); exportPlugin.RegisterExportSettings(); exportPluginWeak = WeakRef(exportPlugin); BuildManager.Initialize(); RiderPathManager.Initialize(); GodotIdeManager = new GodotIdeManager(); AddChild(GodotIdeManager); }
public override void _Ready() { PopupMenu fileOptions = GetPopup(); fileOptions.Connect("id_pressed", this, "IdPressed"); }
public override void EnablePlugin() { base.EnablePlugin(); if (Instance != null) { throw new InvalidOperationException(); } Instance = this; var editorInterface = GetEditorInterface(); var editorBaseControl = editorInterface.GetBaseControl(); _editorSettings = editorInterface.GetEditorSettings(); _errorDialog = new AcceptDialog(); editorBaseControl.AddChild(_errorDialog); MSBuildPanel = new MSBuildPanel(); _bottomPanelBtn = AddControlToBottomPanel(MSBuildPanel, "MSBuild".TTR()); AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" }); _menuPopup = new PopupMenu(); _menuPopup.Hide(); _menuPopup.SetAsToplevel(true); AddToolSubmenuItem("C#", _menuPopup); var buildSolutionShortcut = (ShortCut)EditorShortcut("mono/build_solution"); _toolBarButton = new ToolButton { Text = "Build", HintTooltip = "Build Solution".TTR(), FocusMode = Control.FocusModeEnum.None, Shortcut = buildSolutionShortcut, ShortcutInTooltip = true }; _toolBarButton.Connect("pressed", this, nameof(BuildSolutionPressed)); AddControlToContainer(CustomControlContainer.Toolbar, _toolBarButton); if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath)) { ApplyNecessaryChangesToSolution(); } else { _bottomPanelBtn.Hide(); _toolBarButton.Hide(); _menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln); } _menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed)); // External editor settings EditorDef("mono/editor/external_editor", ExternalEditorId.None); string settingsHintStr = "Disabled"; if (OS.IsWindows) { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudio}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } else if (OS.IsOSX) { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } else if (OS.IsUnixLike) { settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; } _editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary { ["type"] = Variant.Type.Int, ["name"] = "mono/editor/external_editor", ["hint"] = PropertyHint.Enum, ["hint_string"] = settingsHintStr }); // Export plugin var exportPlugin = new ExportPlugin(); AddExportPlugin(exportPlugin); exportPlugin.RegisterExportSettings(); _exportPluginWeak = WeakRef(exportPlugin); BuildManager.Initialize(); RiderPathManager.Initialize(); GodotIdeManager = new GodotIdeManager(); AddChild(GodotIdeManager); }
public override void _Ready() { EditIcon = GD.Load <Texture>("res://res/icons/edit.png"); AddIcon = GD.Load <Texture>("res://res/icons/add.png"); RemoveIcon = GD.Load <Texture>("res://res/icons/remove.png"); ProjectEditor = GD.Load <PackedScene>("res://ProjectEditor.tscn"); DependencyEditor = GD.Load <PackedScene>("res://DependencyEditor.tscn"); UpdateKeyEditor = GD.Load <PackedScene>("res://UpdateKeyEditor.tscn"); fileMenu = GetNode <MenuButton>("MenuSeparator/MenuPanel/Menu/File"); var filePopup = fileMenu.GetPopup(); filePopup.Connect("index_pressed", this, nameof(Signal_FileMenuActivated)); filePopup.AddItem("New project..."); newModMenu = new PopupMenu() { Name = "NewMod" }; newModMenu.Connect("index_pressed", this, nameof(Signal_NewModMenuActivated)); foreach (var controllerId in ContentPackController.GetRegisteredControllerTypes()) { var controller = ContentPackController.GetControllerForMod(controllerId); newModMenu.AddItem(controller.ModName); } filePopup.AddChild(newModMenu); filePopup.AddSubmenuItem("New content pack...", "NewMod"); filePopup.SetItemDisabled(1, true); filePopup.AddSeparator(); filePopup.AddItem("Save"); var keyHelper = new InputEventKey() { Scancode = (uint)KeyList.S, Control = true, }; filePopup.SetItemAccelerator(3, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(3, true); filePopup.AddItem("Open"); keyHelper.Scancode = (uint)KeyList.O; filePopup.SetItemAccelerator(4, keyHelper.GetScancodeWithModifiers()); filePopup.AddSeparator(); filePopup.AddItem("Export"); keyHelper.Scancode = (uint)KeyList.E; filePopup.SetItemAccelerator(6, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(6, true); filePopup.AddItem("Import"); keyHelper.Scancode = (uint)KeyList.I; filePopup.SetItemAccelerator(7, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(7, true); ProjectTree = GetNode <Tree>("MenuSeparator/Splitter/Left/ProjectTree"); ProjectTree.Connect("button_pressed", this, nameof(Signal_TreeButtonPressed)); ProjectTree.Connect("item_activated", this, nameof(Signal_TreeCellActivated)); ProjectTree.Connect("item_edited", this, nameof(Signal_TreeItemEdited)); MainEditingArea = GetNode <Container>("MenuSeparator/Splitter/Main/PanelContainer"); var confirm = GetNode <ConfirmationDialog>("ConfirmNewProjectDialog"); confirm.Connect("confirmed", this, nameof(Signal_CreateNewProject_Pre)); var confirm2 = GetNode <ConfirmationDialog>("ConfirmOpenProjectDialog"); confirm2.Connect("confirmed", this, nameof(Signal_OpenProject_Pre)); var removal = GetNode <ConfirmationDialog>("PendingRemovalDialog"); removal.Connect("confirmed", this, nameof(Signal_PendingRemovalConfirm)); var createDir = GetNode <FileDialog>("NewProjectDirectoryDialog"); createDir.Connect("dir_selected", this, nameof(Signal_CreateNewProject_SelectedDirectory)); var open = GetNode <FileDialog>("OpenProjectDialog"); open.Connect("file_selected", this, nameof(Signal_OpenProject)); var import = GetNode <FileDialog>("ResourceImportDialog"); import.Connect("files_selected", this, nameof(Signal_ResourceImport_Multiple)); var export = GetNode <FileDialog>("ExportProjectDialog"); export.Connect("dir_selected", this, nameof(Signal_ExportProject)); var importPack = GetNode <FileDialog>("ImportPackDialog"); importPack.Connect("file_selected", this, nameof(Signal_ImportPack)); }