From b4c01fe2864023163467a6ee1a9842a48cd18e82 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Tue, 21 May 2019 01:14:55 -0400 Subject: [PATCH] Preliminary support for docking windows in UWT --- .../UniversalEditor.Engines.UWT/MainWindow.cs | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/CSharp/Engines/UWT/UniversalEditor.Engines.UWT/MainWindow.cs b/CSharp/Engines/UWT/UniversalEditor.Engines.UWT/MainWindow.cs index a036db58..c5011a15 100644 --- a/CSharp/Engines/UWT/UniversalEditor.Engines.UWT/MainWindow.cs +++ b/CSharp/Engines/UWT/UniversalEditor.Engines.UWT/MainWindow.cs @@ -5,6 +5,7 @@ using UniversalEditor.UserInterface; using UniversalWidgetToolkit; using UniversalWidgetToolkit.Controls; +using UniversalWidgetToolkit.Controls.Docking; using UniversalWidgetToolkit.Dialogs; using UniversalWidgetToolkit.Input.Keyboard; @@ -12,7 +13,7 @@ namespace UniversalEditor.Engines.UWT { public class MainWindow : Window, IHostApplicationWindow { - private TabContainer tbsDocumentTabs = null; + private DockingContainer tbsDocumentTabs = null; public MainWindow () { @@ -30,15 +31,35 @@ namespace UniversalEditor.Engines.UWT this.MenuBar.Items.Add (mi); } - tbsDocumentTabs = new TabContainer (); - tbsDocumentTabs.TabPages.Add (new TabPage ("Test Tab")); - this.Controls.Add (tbsDocumentTabs, new UniversalWidgetToolkit.Layouts.BoxLayout.Constraints (true, true, 0, UniversalWidgetToolkit.Layouts.BoxLayout.PackType.End)); + tbsDocumentTabs = new DockingContainer (); + + Container ctStartPage = new Container(); + + Label lblStartPage = new Label(); + lblStartPage.Text = "this is a start page"; + ctStartPage.Controls.Add(lblStartPage); + + InitDocTab("Start Page", ctStartPage); + + TextBox txt = new TextBox(); + txt.Multiline = true; + + InitDocTab("file1.txt", txt); + InitDocTab("Archive3.zip", null); + + this.Controls.Add(tbsDocumentTabs, new UniversalWidgetToolkit.Layouts.BoxLayout.Constraints(true, true, 0, UniversalWidgetToolkit.Layouts.BoxLayout.PackType.End)); this.Bounds = new UniversalWidgetToolkit.Drawing.Rectangle (0, 0, 600, 400); this.Text = "Universal Editor"; } + private void InitDocTab(string title, Control content) + { + DockingItem item = new DockingItem(title, content); + tbsDocumentTabs.Items.Add(item); + } + private void MainWindow_MenuBar_Item_Click(object sender, EventArgs e) { CommandMenuItem mi = (sender as CommandMenuItem); @@ -279,7 +300,7 @@ namespace UniversalEditor.Engines.UWT foreach (Document doc in documents) { TabPage tab = new TabPage (); tab.Text = doc.Title; - tbsDocumentTabs.TabPages.Add (tab); + // tbsDocumentTabs.TabPages.Add (tab); } } @@ -301,7 +322,16 @@ namespace UniversalEditor.Engines.UWT public void SaveFile () { - throw new NotImplementedException (); + IEditorImplementation currentEditor = GetCurrentEditor(); + if (currentEditor != null) + { + FileDialog fd = new FileDialog(); + fd.Mode = FileDialogMode.Save; + if (fd.ShowDialog() == DialogResult.OK) + { + + } + } } public void SaveFileAs () @@ -356,7 +386,7 @@ namespace UniversalEditor.Engines.UWT public IEditorImplementation GetCurrentEditor () { - throw new NotImplementedException (); + return null; } public bool ShowOptionsDialog ()