Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4069 for trunk


Ignore:
Timestamp:
07/22/10 02:26:37 (14 years ago)
Author:
swagner
Message:

Enabled hiding details in ItemListView (#1095)

Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs

    r3407 r4069  
    5555      this.components = new System.ComponentModel.Container();
    5656      this.splitContainer = new System.Windows.Forms.SplitContainer();
     57      this.showDetailsCheckBox = new System.Windows.Forms.CheckBox();
    5758      this.removeButton = new System.Windows.Forms.Button();
    5859      this.moveUpButton = new System.Windows.Forms.Button();
    5960      this.moveDownButton = new System.Windows.Forms.Button();
    6061      this.itemsListView = new System.Windows.Forms.ListView();
    61       this.listViewColumnHeader = new System.Windows.Forms.ColumnHeader();
     62      this.listViewColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    6263      this.imageList = new System.Windows.Forms.ImageList(this.components);
    6364      this.addButton = new System.Windows.Forms.Button();
     
    8283      // splitContainer.Panel1
    8384      //
     85      this.splitContainer.Panel1.Controls.Add(this.showDetailsCheckBox);
    8486      this.splitContainer.Panel1.Controls.Add(this.removeButton);
    8587      this.splitContainer.Panel1.Controls.Add(this.moveUpButton);
     
    9496      this.splitContainer.SplitterDistance = 200;
    9597      this.splitContainer.TabIndex = 0;
     98      //
     99      // showDetailsCheckBox
     100      //
     101      this.showDetailsCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
     102      this.showDetailsCheckBox.Checked = true;
     103      this.showDetailsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     104      this.showDetailsCheckBox.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Properties;
     105      this.showDetailsCheckBox.Location = new System.Drawing.Point(123, 3);
     106      this.showDetailsCheckBox.Name = "showDetailsCheckBox";
     107      this.showDetailsCheckBox.Size = new System.Drawing.Size(24, 24);
     108      this.showDetailsCheckBox.TabIndex = 5;
     109      this.toolTip.SetToolTip(this.showDetailsCheckBox, "Show/Hide Details");
     110      this.showDetailsCheckBox.UseVisualStyleBackColor = true;
     111      this.showDetailsCheckBox.CheckedChanged += new System.EventHandler(this.showDetailsCheckBox_CheckedChanged);
    96112      //
    97113      // removeButton
     
    149165      this.itemsListView.UseCompatibleStateImageBehavior = false;
    150166      this.itemsListView.View = System.Windows.Forms.View.Details;
     167      this.itemsListView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.itemsListView_ItemDrag);
    151168      this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemsListView_SelectedIndexChanged);
    152       this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick);
    153169      this.itemsListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragDrop);
    154170      this.itemsListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragEnterOver);
     171      this.itemsListView.DragOver += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragEnterOver);
     172      this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick);
    155173      this.itemsListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.itemsListView_KeyDown);
    156       this.itemsListView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.itemsListView_ItemDrag);
    157       this.itemsListView.DragOver += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragEnterOver);
    158174      //
    159175      // imageList
     
    192208                  | System.Windows.Forms.AnchorStyles.Left)
    193209                  | System.Windows.Forms.AnchorStyles.Right)));
     210      this.viewHost.Caption = "View";
    194211      this.viewHost.Content = null;
    195212      this.viewHost.Location = new System.Drawing.Point(6, 19);
    196213      this.viewHost.Name = "viewHost";
     214      this.viewHost.ReadOnly = false;
    197215      this.viewHost.Size = new System.Drawing.Size(271, 269);
    198216      this.viewHost.TabIndex = 0;
     217      this.viewHost.ViewType = null;
    199218      //
    200219      // itemsGroupBox
     
    238257    protected ImageList imageList;
    239258    protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     259    protected CheckBox showDetailsCheckBox;
    240260  }
    241261}
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r3904 r4069  
    197197      AdjustListViewColumnSizes();
    198198
    199       if (itemsListView.SelectedItems.Count == 1) {
    200         T item = (T)itemsListView.SelectedItems[0].Tag;
    201         detailsGroupBox.Enabled = true;
    202         viewHost.Content = item;
    203       } else {
    204         viewHost.Content = null;
    205         detailsGroupBox.Enabled = false;
     199      if (showDetailsCheckBox.Checked) {
     200        if (itemsListView.SelectedItems.Count == 1) {
     201          T item = (T)itemsListView.SelectedItems[0].Tag;
     202          detailsGroupBox.Enabled = true;
     203          viewHost.Content = item;
     204        } else {
     205          viewHost.Content = null;
     206          detailsGroupBox.Enabled = false;
     207        }
    206208      }
    207209    }
     
    301303    #endregion
    302304
     305    #region CheckBox Events
     306    private class DummyContent : HeuristicLab.Common.IContent { }
     307    protected void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
     308      if (showDetailsCheckBox.Checked) {
     309        splitContainer.Panel2Collapsed = false;
     310        detailsGroupBox.Enabled = itemsListView.SelectedItems.Count == 1;
     311        viewHost.Content = itemsListView.SelectedItems.Count == 1 ? (T)itemsListView.SelectedItems[0].Tag : null;
     312      } else {
     313        splitContainer.Panel2Collapsed = true;
     314        viewHost.Content = new DummyContent();
     315      }
     316    }
     317    #endregion
     318
    303319    #region Content Events
    304320    protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
Note: See TracChangeset for help on using the changeset viewer.