Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/10 04:24:19 (14 years ago)
Author:
swagner
Message:

Adapted ReadOnly property in item collection views (#973)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3432 r3433  
    3737      get { return (IItemCollection<IRun>)base.Content; }
    3838      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; }
    3947    }
    4048
     
    140148    #region ListView Events
    141149    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    142       removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly;
     150      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !ReadOnly;
    143151      if (itemsListView.SelectedItems.Count == 1) {
    144152        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
     
    157165    protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
    158166      if (e.KeyCode == Keys.Delete) {
    159         if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly) {
     167        if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) {
    160168          foreach (ListViewItem item in itemsListView.SelectedItems)
    161169            Content.Remove((IRun)item.Tag);
     
    181189        data.SetData("Type", item.GetType());
    182190        data.SetData("Value", item);
    183         if (Content.IsReadOnly || ReadOnly) {
     191        if (ReadOnly) {
    184192          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    185193        } else {
     
    194202      if (ReadOnly) return;
    195203      Type type = e.Data.GetData("Type") as Type;
    196       if ((!Content.IsReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) {
     204      if ((!ReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) {
    197205        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
    198206        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
Note: See TracChangeset for help on using the changeset viewer.