예제 #1
0
        private TabPage CreateTab(string name, ViewsFilter filter)
        {
            ResourceListView2 view = new ResourceListView2();

            TabPage page = new TabPage();

            page.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            page.Controls.Add(view);
            page.Location = new System.Drawing.Point(4, 22);
            page.Name     = "tab" + name;
            page.Size     = new System.Drawing.Size(232, 258);
            page.TabIndex = 2;
            page.Text     = name;
            page.Tag      = view;

            view.AllowDrop       = true;
            view.Anchor          = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            view.InPlaceEdit     = false;
            view.ShowContextMenu = false;
            view.Location        = new System.Drawing.Point(0, 0);
            view.Name            = name;
            view.Size            = new System.Drawing.Size(230, 258);
            view.TabIndex        = 10;
            view.OpenProperty    = Core.Props.Open;

            view.AddTreeStructureColumn();
            view.AddIconColumn();
            RichTextColumn nameColumn = new RichTextColumn();

            nameColumn.SizeToContent = true;
            nameColumn.AddNodeDecorator(_decorator);
            view.Columns.Add(nameColumn);

            view.DoubleClick += new HandledEventHandler(this.OnDoubleClicked);
            view.JetListView.SelectionStateChanged += new JetBrains.JetListViewLibrary.StateChangeEventHandler(SelectionStateChanged);
            view.RootResource = Core.ResourceTreeManager.ResourceTreeRoot;
            // TODO: why ResourceListView, not ResourceTreeViewBase?

            if (filter != null)
            {
                view.Filters.Add(filter);
                view.Tag = filter;
            }
            IResource root = Core.ResourceTreeManager.ResourceTreeRoot;

            view.DataProvider = new ResourceTreeDataProvider(root, Core.Props.Parent);

            return(page);
        }
예제 #2
0
        public ResourceListView2TestForm(IResourceDataProvider provider, bool isTree)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _resourceListView             = new ResourceListView2();
            _resourceListView.Dock        = DockStyle.Fill;
            _resourceListView.AllowDrop   = true;
            _resourceListView.InPlaceEdit = true;
            if (isTree)
            {
                _resourceListView.AddTreeStructureColumn();
                _resourceListView.HideSelection = true;
            }
            else
            {
                //_resourceListView.AddCheckBoxColumn();
                _resourceListView.HeaderStyle        = ColumnHeaderStyle.Clickable;
                _resourceListView.AllowColumnReorder = true;
            }
            _resourceListView.AddIconColumn();
            if (isTree)
            {
                RichTextColumn rtCol = new RichTextColumn();
                rtCol.AddNodeDecorator(new UnreadNodeDecorator());
                rtCol.SizeToContent = true;
                _resourceListView.Columns.Add(rtCol);
            }
            else
            {
                /*
                 * DisplayColumnManager dcm = (DisplayColumnManager) Core.DisplayColumnManager;
                 * ColumnDescriptor[] columns = dcm.GetDefaultColumns( Core.ResourceBrowser.VisibleResources );
                 * foreach( ColumnDescriptor colDesc in columns )
                 * {
                 *  int[] propIds = dcm.PropNamesToIDs( colDesc.PropNames, true );
                 *  bool isCustom = false;
                 *  for( int i=0; i<propIds.Length; i++ )
                 *  {
                 *      if ( dcm.GetCustomColumn( propIds [i] ) != null )
                 *      {
                 *          isCustom = true;
                 *          break;
                 *      }
                 *  }
                 *
                 *  if ( isCustom )
                 *  {
                 *      AddCustomColumn( dcm, propIds );
                 *  }
                 *  else
                 *  {
                 *      ResourceListView2Column column = _resourceListView.AddColumn( propIds [0] );
                 *      column.Width = colDesc.Width;
                 *  }
                 * }
                 */
                _resourceListView.FullRowSelect = true;
            }


            /*
             * int propId = Core.ResourceStore.GetPropId( "Annotation" );
             * ICustomColumn col = (Core.DisplayColumnManager as DisplayColumnManager).GetCustomColumn( propId );
             * _resourceListView.AddCustomColumn( col );
             */

            _resourceListView.DataProvider = provider;
            Controls.Add(_resourceListView);
            Controls.SetChildIndex(_resourceListView, 0);

            _nameFilter = new ResourceNameJetFilter("");
        }