Changeset 4435 for trunk/sources/HeuristicLab.MainForm.WindowsForms
- Timestamp:
- 09/19/10 19:43:05 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ContentView.cs
r4068 r4435 67 67 } else { 68 68 if (value != locked) { 69 this.SuspendRepaint();70 69 locked = value; 71 70 OnLockedChanged(); 72 this.SetEnabledStateOfControls();71 SetEnabledStateOfControls(); 73 72 PropertyInfo prop = typeof(IContentView).GetProperty("Locked"); 74 73 PropagateStateChanges(this, typeof(IContentView), prop); 75 74 OnChanged(); 76 this.ResumeRepaint(true);77 75 } 78 76 } … … 111 109 /// </summary> 112 110 protected override void SetEnabledStateOfControls() { 111 base.SetEnabledStateOfControls(); 112 Enabled = Content != null; 113 113 } 114 114 } -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/View.cs
r4083 r4435 65 65 } else { 66 66 if (value != readOnly) { 67 this.SuspendRepaint();68 67 this.readOnly = value; 69 this.OnReadOnlyChanged();70 this.SetEnabledStateOfControls();68 OnReadOnlyChanged(); 69 SetEnabledStateOfControls(); 71 70 PropertyInfo prop = typeof(IView).GetProperty("ReadOnly"); 72 71 PropagateStateChanges(this, typeof(IView), prop); 73 this.ResumeRepaint(true);72 OnChanged(); 74 73 } 75 74 } 76 75 } 77 76 } 77 78 bool IView.Enabled { 79 get { return base.Enabled; } 80 set { 81 if (base.Enabled != value) { 82 this.SuspendRepaint(); 83 base.Enabled = value; 84 bool isTopLevelView = MainFormManager.MainForm.Views.Contains(this); 85 this.ResumeRepaint(isTopLevelView); 86 } 87 } 88 } 89 90 protected override void OnEnabledChanged(EventArgs e) { 91 base.OnEnabledChanged(e); 92 if (Enabled) SetEnabledStateOfControls(); 93 } 94 78 95 /// <summary> 79 96 /// This method is called if the ReadyOnly property of the View changes to update the controls of the view. … … 160 177 var thisValue = propertyInfo.GetValue(this, null); 161 178 controlPropertyInfo.SetValue(c, thisValue, null); 162 } else 163 PropagateStateChanges(c, type, propertyInfo); 179 } else PropagateStateChanges(c, type, propertyInfo); 164 180 } 165 181 } … … 226 242 } 227 243 228 public new bool Enabled {229 get { return base.Enabled; }230 set {231 SuspendRepaint();232 base.Enabled = value;233 ResumeRepaint(true);234 }235 }236 244 237 245 public void SuspendRepaint() { -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs
r4418 r4435 61 61 View view = activeView as View; 62 62 if (view != null) { 63 view.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; 64 view.Size = new System.Drawing.Size(this.Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height); 63 65 view.OnShown(new ViewShownEventArgs(view, false)); 64 66 Controls.Add(view); 65 67 } 66 68 } else viewType = null; 67 OnActiveViewChanged();68 69 } 69 70 } … … 84 85 OnViewTypeChanged(); 85 86 } 86 }87 }88 89 public new bool Enabled {90 get { return base.Enabled; }91 set {92 base.Enabled = value;93 this.viewsLabel.Enabled = value;94 87 } 95 88 } … … 136 129 IContentView view; 137 130 view = MainFormManager.CreateView(viewType); 131 view.Locked = this.Locked; 138 132 view.ReadOnly = this.ReadOnly; 139 view.Locked = this.Locked;140 133 ActiveView = view; //necessary to allow the views to change the status of the viewhost 141 134 view.Content = Content; … … 145 138 } 146 139 147 private void OnActiveViewChanged() {148 this.SuspendRepaint();149 if (activeView != null) {150 this.ActiveView.ReadOnly = this.ReadOnly;151 this.ActiveView.Locked = this.Locked;152 this.ActiveViewControl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;153 this.ActiveViewControl.Size = new System.Drawing.Size(this.Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height);154 }155 this.ResumeRepaint(true);156 }157 158 140 private void RegisterActiveViewEvents() { 159 activeView.Changed += new EventHandler(activeView_Changed);160 141 activeView.CaptionChanged += new EventHandler(activeView_CaptionChanged); 142 activeView.LockedChanged += new EventHandler(activeView_LockedChanged); 161 143 } 162 144 private void DeregisterActiveViewEvents() { 163 activeView.C hanged -= new EventHandler(activeView_Changed);164 activeView. CaptionChanged -= new EventHandler(activeView_CaptionChanged);145 activeView.CaptionChanged += new EventHandler(activeView_CaptionChanged); 146 activeView.LockedChanged += new EventHandler(activeView_LockedChanged); 165 147 } 166 148 private void activeView_CaptionChanged(object sender, EventArgs e) { 167 this.ActiveViewChanged(); 168 } 169 private void activeView_Changed(object sender, EventArgs e) { 170 this.ActiveViewChanged(); 171 } 172 private void ActiveViewChanged() { 173 if (ActiveView != null) { 174 this.Caption = this.ActiveView.Caption; 175 this.ReadOnly = this.ActiveView.ReadOnly; 176 this.Locked = this.ActiveView.Locked; 177 } 149 this.Caption = activeView.Caption; 150 } 151 private void activeView_LockedChanged(object sender, EventArgs e) { 152 this.Locked = activeView.Locked; 178 153 } 179 154
Note: See TracChangeset
for help on using the changeset viewer.