mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Add proper mdi container method which checks duped names
This commit is contained in:
parent
fad58c99e5
commit
65b34e1e89
9 changed files with 27 additions and 4 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -65,10 +65,9 @@ namespace Switch_Toolbox.Library
|
|||
}
|
||||
public void CreateMdiWindow(STForm form, bool Show = true)
|
||||
{
|
||||
form.MdiParent = Application.OpenForms[0];
|
||||
var mainform = Application.OpenForms[0];
|
||||
|
||||
if (Show)
|
||||
form.Show();
|
||||
((IMdiContainer)mainform).AddChildContainer(form);
|
||||
}
|
||||
public ObjectEditor GetObjectEditor()
|
||||
{
|
||||
|
|
14
Switch_Toolbox_Library/Interfaces/IMdiContainer.cs
Normal file
14
Switch_Toolbox_Library/Interfaces/IMdiContainer.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Switch_Toolbox.Library
|
||||
{
|
||||
public interface IMdiContainer
|
||||
{
|
||||
void AddChildContainer(Form form);
|
||||
}
|
||||
}
|
|
@ -498,6 +498,7 @@
|
|||
<Compile Include="Helpers\TextureHelper.cs" />
|
||||
<Compile Include="Interfaces\IEditor.cs" />
|
||||
<Compile Include="Interfaces\IFIleEditor.cs" />
|
||||
<Compile Include="Interfaces\IMdiContainer.cs" />
|
||||
<Compile Include="Interfaces\IMenuExtension.cs" />
|
||||
<Compile Include="Interfaces\ITexture.cs" />
|
||||
<Compile Include="Interfaces\IViewportContainer.cs" />
|
||||
|
|
|
@ -18,7 +18,7 @@ using OpenTK.Graphics.OpenGL;
|
|||
|
||||
namespace Toolbox
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
public partial class MainForm : Form, IMdiContainer
|
||||
{
|
||||
private static MainForm _instance;
|
||||
public static MainForm Instance { get { return _instance == null ? _instance = new MainForm() : _instance; } }
|
||||
|
@ -26,8 +26,17 @@ namespace Toolbox
|
|||
IFileFormat[] SupportedFormats;
|
||||
IFileMenuExtension[] FileMenuExtensions;
|
||||
|
||||
public void AddChildContainer(Form form)
|
||||
{
|
||||
TabDupeIndex = 0;
|
||||
form.Text = CheckTabDupes(form.Text);
|
||||
form.MdiParent = this;
|
||||
form.Show();
|
||||
}
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
|
||||
FormThemes.ActivePreset = FormThemes.Preset.Dark;
|
||||
|
||||
Runtime.MainForm = this;
|
||||
|
|
Loading…
Reference in a new issue