Changeset 2256 for trunk/sources/HeuristicLab.MainForm
- Timestamp:
- 08/07/09 16:31:55 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm/3.2
- Files:
-
- 1 deleted
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs
r2254 r2256 51 51 content.Activated += new EventHandler(DockFormActivated); 52 52 content.FormClosing += new FormClosingEventHandler(DockFormClosing); 53 foreach (IToolStripItem item in viewStateChangeToolStripItems)54 view.StateChanged += new EventHandler(item.View StateChanged);53 foreach (IToolStripItem item in ViewChangedToolStripItems) 54 view.StateChanged += new EventHandler(item.ViewChanged); 55 55 content.Show(dockPanel); 56 56 } … … 59 59 private void DockFormClosing(object sender, FormClosingEventArgs e) { 60 60 DockForm dockForm = (DockForm)sender; 61 openViews.Remove(dockForm.View);62 if ( openViews.Count == 0)61 views.Remove(dockForm.View); 62 if (views.Count == 0) 63 63 ActiveView = null; 64 64 dockForm.Activated -= new EventHandler(DockFormActivated); 65 65 dockForm.FormClosing -= new FormClosingEventHandler(DockFormClosing); 66 foreach (IToolStripItem item in viewStateChangeToolStripItems)67 dockForm.View.StateChanged -= new EventHandler(item.View StateChanged);66 foreach (IToolStripItem item in ViewChangedToolStripItems) 67 dockForm.View.StateChanged -= new EventHandler(item.ViewChanged); 68 68 } 69 69 -
trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLab.MainForm-3.2.csproj
r2253 r2256 108 108 <Compile Include="Interfaces\IMainForm.cs" /> 109 109 <Compile Include="Interfaces\IToolStripMenuItem.cs" /> 110 <Compile Include="Interfaces\IModel.cs" />111 110 <Compile Include="Interfaces\IToolStripButtonItem.cs" /> 112 111 <Compile Include="Interfaces\IToolStripItem.cs" /> -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IMainForm.cs
r2254 r2256 34 34 IView ActiveView { get; } 35 35 event EventHandler ActiveViewChanged; 36 IEnumerable<IView> OpenViews { get; }36 IEnumerable<IView> Views { get; } 37 37 38 38 Type UserInterfaceItemType { get; } 39 39 void ShowView(IView view); 40 void Close Form();40 void Close(); 41 41 } 42 42 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IToolStripItem.cs
r2254 r2256 39 39 40 40 bool ListenActiveViewChanged { get; } 41 bool ListenView StateChanged { get; }41 bool ListenViewChanged { get; } 42 42 void ActiveViewChanged(object sender, EventArgs e); 43 void View StateChanged(object sender, EventArgs e);43 void ViewChanged(object sender, EventArgs e); 44 44 } 45 45 } -
trunk/sources/HeuristicLab.MainForm/3.2/MainFormBase.cs
r2254 r2256 36 36 : base() { 37 37 InitializeComponent(); 38 openViews = new List<IView>();39 view StateChangeToolStripItems = new List<IToolStripItem>();38 views = new List<IView>(); 39 viewChangeToolStripItems = new List<IToolStripItem>(); 40 40 this.userInterfaceItemType = userInterfaceItemType; 41 41 CreateGUI(); … … 46 46 public string Title { 47 47 get { return this.Text; } 48 set { this.Text = value; } 48 set { 49 if (InvokeRequired) { 50 Action<string> action = delegate(string s) { this.Title = s; }; 51 Invoke(action, new object[] { value }); 52 } else 53 this.Text = value; 54 } 49 55 } 50 56 51 57 public string StatusStripText { 52 58 get { return this.statusStripLabel.Text; } 53 set { this.statusStripLabel.Text = value; } 59 set { 60 if (InvokeRequired) { 61 Action<string> action = delegate(string s) { this.statusStripLabel.Text = s; }; 62 Invoke(action, new object[] { value }); 63 } else 64 this.statusStripLabel.Text = value; 65 } 54 66 } 55 67 56 pr otectedType userInterfaceItemType;68 private Type userInterfaceItemType; 57 69 public Type UserInterfaceItemType { 58 70 get { return this.userInterfaceItemType; } 71 protected set { this.userInterfaceItemType = value; } 59 72 } 60 73 … … 70 83 } 71 84 72 protected List<IToolStripItem> viewStateChangeToolStripItems; 85 private List<IToolStripItem> viewChangeToolStripItems; 86 protected IEnumerable<IToolStripItem> ViewChangedToolStripItems { 87 get { return this.viewChangeToolStripItems; } 88 } 73 89 74 90 public event EventHandler ActiveViewChanged; 75 91 protected virtual void OnActiveViewChanged() { 76 if (ActiveViewChanged != null)77 ActiveViewChanged(this, new EventArgs());92 if (ActiveViewChanged != null) 93 ActiveViewChanged(this, new EventArgs()); 78 94 } 79 95 80 protected List<IView> openViews;81 public IEnumerable<IView> OpenViews {82 get { return openViews; }96 protected List<IView> views; 97 public IEnumerable<IView> Views { 98 get { return views; } 83 99 } 84 100 85 101 public virtual void ShowView(IView view) { 86 view.MainForm = this; 87 openViews.Add(view);102 view.MainForm = this; 103 views.Add(view); 88 104 ActiveView = view; 89 }90 91 public void CloseForm() {92 this.Close();93 105 } 94 106 #endregion … … 160 172 if (iToolStripItem.ListenActiveViewChanged) 161 173 this.ActiveViewChanged += new EventHandler(iToolStripItem.ActiveViewChanged); 162 if (iToolStripItem.ListenView StateChanged)163 this.view StateChangeToolStripItems.Add(iToolStripItem);174 if (iToolStripItem.ListenViewChanged) 175 this.viewChangeToolStripItems.Add(iToolStripItem); 164 176 toolStripItem.Click += new EventHandler(ToolStripItemClicked); 165 177 iToolStripItem.ToolStripItem = toolStripItem; -
trunk/sources/HeuristicLab.MainForm/3.2/MultipleDocumentMainForm.cs
r2255 r2256 24 24 form.FormClosing += new FormClosingEventHandler(MultipleDocumentFormClosing); 25 25 form.MdiParent = this; 26 foreach (IToolStripItem item in viewStateChangeToolStripItems)27 view.StateChanged += new EventHandler(item.View StateChanged);26 foreach (IToolStripItem item in ViewChangedToolStripItems) 27 view.StateChanged += new EventHandler(item.ViewChanged); 28 28 form.Show(); 29 29 } … … 37 37 private void MultipleDocumentFormClosing(object sender, FormClosingEventArgs e) { 38 38 MultipleDocumentForm form = (MultipleDocumentForm)sender; 39 openViews.Remove(form.View);40 if ( openViews.Count == 0)39 views.Remove(form.View); 40 if (views.Count == 0) 41 41 ActiveView = null; 42 42 form.Activated -= new EventHandler(MultipleDocumentFormActivated); 43 43 form.FormClosing -= new FormClosingEventHandler(MultipleDocumentFormClosing); 44 foreach (IToolStripItem item in viewStateChangeToolStripItems)45 form.View.StateChanged -= new EventHandler(item.View StateChanged);44 foreach (IToolStripItem item in ViewChangedToolStripItems) 45 form.View.StateChanged -= new EventHandler(item.ViewChanged); 46 46 } 47 47 } -
trunk/sources/HeuristicLab.MainForm/3.2/ToolStripButtonItemBase.cs
r2249 r2256 33 33 return ToolStripItemDisplayStyle.Image; 34 34 else 35 return ToolStripItemDisplayStyle. ImageAndText;35 return ToolStripItemDisplayStyle.Text; 36 36 } 37 37 } -
trunk/sources/HeuristicLab.MainForm/3.2/ToolStripItemBase.cs
r2254 r2256 51 51 } 52 52 53 p ublicstatic readonly char structureSeparator = '/';54 public char StructureSeparator {53 private static readonly char structureSeparator = '/'; 54 public virtual char StructureSeparator { 55 55 get { return ToolStripMenuItemBase.structureSeparator; } 56 56 } … … 59 59 get { return false; } 60 60 } 61 public virtual bool ListenView StateChanged {61 public virtual bool ListenViewChanged { 62 62 get { return false; } 63 63 } … … 66 66 } 67 67 68 public virtual void View StateChanged(object sender, EventArgs e) {68 public virtual void ViewChanged(object sender, EventArgs e) { 69 69 } 70 70 #endregion -
trunk/sources/HeuristicLab.MainForm/3.2/ToolStripMenuItemBase.cs
r2249 r2256 33 33 34 34 public override ToolStripItemDisplayStyle DisplayStyle { 35 get { return ToolStripItemDisplayStyle. ImageAndText; }35 get { return ToolStripItemDisplayStyle.Text; } 36 36 } 37 37 }
Note: See TracChangeset
for help on using the changeset viewer.