FreeTrainの進化系を目指す
toolWindowsManager の追加
| @@ -69,5 +69,7 @@ | ||
| 69 | 69 | Form[] MdiChildren{get;} |
| 70 | 70 | |
| 71 | 71 | void SetStatusText(string txt); |
| 72 | + | |
| 73 | + IToolWindowsManager ToolWindows { get; } | |
| 72 | 74 | } |
| 73 | 75 | } |
| @@ -0,0 +1,54 @@ | ||
| 1 | +using nft.framework.plugin; | |
| 2 | +using System; | |
| 3 | +using System.Collections.Generic; | |
| 4 | +using System.Text; | |
| 5 | + | |
| 6 | +namespace nft.ui.mainframe { | |
| 7 | + | |
| 8 | + public interface IToolWindowsManager { | |
| 9 | + void RegisterFactiory(string name, object factory); | |
| 10 | + | |
| 11 | + IToolWindow GetOrCreate(string name); | |
| 12 | + | |
| 13 | + event EventHandler<ToolWindowActivateEventArgs> ToolWindowActivate; | |
| 14 | + | |
| 15 | + IToolWindow ActiveTool { get; } | |
| 16 | + } | |
| 17 | + | |
| 18 | + public class ToolWindowActivateEventArgs : EventArgs { | |
| 19 | + readonly IToolWindowsManager source; | |
| 20 | + readonly String name; | |
| 21 | + | |
| 22 | + public ToolWindowActivateEventArgs(IToolWindowsManager manager, string activatedName) { | |
| 23 | + this.source = manager; | |
| 24 | + this.name = activatedName; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public IToolWindowsManager Soruce { | |
| 28 | + get { return source; } | |
| 29 | + } | |
| 30 | + | |
| 31 | + public string ActivatedWindowName { | |
| 32 | + get { return name; } | |
| 33 | + } | |
| 34 | + | |
| 35 | + } | |
| 36 | + | |
| 37 | + | |
| 38 | + public class DefaultToolWindowsManager: IToolWindowsManager { | |
| 39 | + | |
| 40 | + public void RegisterFactiory(string name, object factory) { | |
| 41 | + throw new NotImplementedException(); | |
| 42 | + } | |
| 43 | + | |
| 44 | + public IToolWindow GetOrCreate(string name) { | |
| 45 | + throw new NotImplementedException(); | |
| 46 | + } | |
| 47 | + | |
| 48 | + public event EventHandler<ToolWindowActivateEventArgs> ToolWindowActivate; | |
| 49 | + | |
| 50 | + public IToolWindow ActiveTool { | |
| 51 | + get { throw new NotImplementedException(); } | |
| 52 | + } | |
| 53 | + } | |
| 54 | +} |
| @@ -0,0 +1,21 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Drawing; | |
| 4 | +using System.Text; | |
| 5 | + | |
| 6 | +namespace nft.ui.mainframe { | |
| 7 | + public interface IToolWindow { | |
| 8 | + void Activate(); | |
| 9 | + bool IsActive(); | |
| 10 | + void TryClose(); | |
| 11 | + bool Visible { get; } | |
| 12 | + bool Docking { get; } | |
| 13 | + Size ClientAreaSize { get; } | |
| 14 | + Object UIObject { get; } | |
| 15 | + Object Controller { get; set; } // TODO define controller interface | |
| 16 | + } | |
| 17 | + | |
| 18 | + public class WinFormToolWindow { | |
| 19 | + | |
| 20 | + } | |
| 21 | +} |
| @@ -32,6 +32,7 @@ | ||
| 32 | 32 | private DockPanel panelCenter; |
| 33 | 33 | private ToolStripStatusLabel messageLabel; |
| 34 | 34 | private MenuStrip mainMenu; |
| 35 | + private IToolWindowsManager toolWindowsManager; | |
| 35 | 36 | |
| 36 | 37 | public event EventHandler<EventArgs> ActiveViewChanged; |
| 37 | 38 | public event EventHandler<EventArgs> ActiveSubformChanged; |
| @@ -45,6 +46,7 @@ | ||
| 45 | 46 | //IsMdiContainer = true; |
| 46 | 47 | dockManager = new DockingManagerEx(panelCenter); |
| 47 | 48 | stripManager = new ToolStripManager(toolStripPanel, mainMenu); |
| 49 | + toolWindowsManager = new DefaultToolWindowsManager(); | |
| 48 | 50 | KeyPreview = true; |
| 49 | 51 | PreviewKeyDown += new PreviewKeyDownEventHandler(MainFrame_PreviewKeyDown); |
| 50 | 52 | /* |