Changeset 2254 for trunk/sources/HeuristicLab.MainForm/3.2/MainFormBase.cs
- Timestamp:
- 08/07/09 11:27:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.2/MainFormBase.cs
r2250 r2254 37 37 InitializeComponent(); 38 38 openViews = new List<IView>(); 39 viewStateChangeToolStripItems = new List<IToolStripItem>(); 39 40 this.userInterfaceItemType = userInterfaceItemType; 40 41 CreateGUI(); 42 OnActiveViewChanged(); 41 43 } 42 44 … … 57 59 } 58 60 59 pr otectedIView activeView;61 private IView activeView; 60 62 public IView ActiveView { 61 63 get { return this.activeView; } 64 protected set { 65 if (this.activeView != value) { 66 this.activeView = value; 67 OnActiveViewChanged(); 68 } 69 } 70 } 71 72 protected List<IToolStripItem> viewStateChangeToolStripItems; 73 74 public event EventHandler ActiveViewChanged; 75 protected virtual void OnActiveViewChanged() { 76 if(ActiveViewChanged != null) 77 ActiveViewChanged(this,new EventArgs()); 62 78 } 63 79 … … 68 84 69 85 public virtual void ShowView(IView view) { 70 view.MainForm = this; 71 activeView = view; 86 view.MainForm = this; 72 87 openViews.Add(view); 88 ActiveView = view; 73 89 } 74 90 75 public void Close () {76 ((Form)this).Close();91 public void CloseForm() { 92 this.Close(); 77 93 } 78 94 #endregion … … 94 110 foreach (IToolStripButtonItem toolStripButtonItem in toolStripItems) { 95 111 AddToolStripButtonItem(toolStripButtonItem); 96 } 112 } 97 113 } 98 114 … … 117 133 118 134 SetToolStripItemProperties(item, buttonItem); 119 ToolStripDropDownItem parent = FindParent(buttonItem, toolStrip.Items);135 ToolStripDropDownItem parent = FindParent(buttonItem, toolStrip.Items); 120 136 if (parent == null) 121 137 toolStrip.Items.Add(item); … … 142 158 toolStripItem.Image = iToolStripItem.Image; 143 159 toolStripItem.DisplayStyle = iToolStripItem.DisplayStyle; 160 if (iToolStripItem.ListenActiveViewChanged) 161 this.ActiveViewChanged += new EventHandler(iToolStripItem.ActiveViewChanged); 162 if (iToolStripItem.ListenViewStateChanged) 163 this.viewStateChangeToolStripItems.Add(iToolStripItem); 144 164 toolStripItem.Click += new EventHandler(ToolStripItemClicked); 145 165 iToolStripItem.ToolStripItem = toolStripItem;
Note: See TracChangeset
for help on using the changeset viewer.