Changeset 3435 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 04/20/10 05:02:52 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3433 r3435 37 37 get { return (IItemCollection<IRun>)base.Content; } 38 38 set { base.Content = value; } 39 }40 41 public override bool ReadOnly {42 get {43 if ((Content != null) && Content.IsReadOnly) return true;44 else return base.ReadOnly;45 }46 set { base.ReadOnly = value; }47 39 } 48 40 … … 101 93 itemsListView.Enabled = true; 102 94 detailsGroupBox.Enabled = true; 103 removeButton.Enabled = !ReadOnly;95 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly; 104 96 viewHost.Enabled = true; 105 97 viewHost.ReadOnly = ReadOnly; … … 148 140 #region ListView Events 149 141 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 150 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && ! ReadOnly;142 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly; 151 143 if (itemsListView.SelectedItems.Count == 1) { 152 144 IRun item = (IRun)itemsListView.SelectedItems[0].Tag; … … 165 157 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { 166 158 if (e.KeyCode == Keys.Delete) { 167 if ((itemsListView.SelectedItems.Count > 0) && ! ReadOnly) {159 if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) { 168 160 foreach (ListViewItem item in itemsListView.SelectedItems) 169 161 Content.Remove((IRun)item.Tag); … … 189 181 data.SetData("Type", item.GetType()); 190 182 data.SetData("Value", item); 191 if ( ReadOnly) {183 if (Content.IsReadOnly || ReadOnly) { 192 184 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 193 185 } else { … … 200 192 protected virtual void itemsListView_DragEnterOver(object sender, DragEventArgs e) { 201 193 e.Effect = DragDropEffects.None; 202 if (ReadOnly) return;203 194 Type type = e.Data.GetData("Type") as Type; 204 if ( (!ReadOnly)&& (type != null) && (typeof(IRun).IsAssignableFrom(type))) {195 if (!Content.IsReadOnly && !ReadOnly && (type != null) && (typeof(IRun).IsAssignableFrom(type))) { 205 196 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 206 197 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
Note: See TracChangeset
for help on using the changeset viewer.