Beispiel #1
0
        public NlmTreeListView()
        {
            DisabledHandles = new List <UIntPtr>();

            Margin = new Padding(0);
            Dock   = DockStyle.Fill;

            // Apply look from 3ds Max colour scheme and set ImageList.
            MaxLook.ApplyLook(this);
            NodeClassImageList.Apply(this);

            // Set properties.
            AllowDrop                = true;
            IsSimpleDragSource       = true;
            IsSimpleDropSink         = true;
            FullRowSelect            = true;
            UseAlternatingBackColors = true;
            RowHeight                = 20;
            UseCustomSelectionColors = true;
            HideSelection            = false;
            CellEditActivation       = ObjectListView.CellEditActivateMode.DoubleClick;
            UseFiltering             = true;
            BorderStyle              = BorderStyle.FixedSingle;
            View                               = View.Details;
            OwnerDrawnHeader                   = true;
            RevealAfterExpand                  = false; // After expanding, the expand node moves to the top of the listview. It's kinda jarring so turn it off.
            CanUseApplicationIdle              = false; // 3ds Max appears to completley suppress application idle events.
            DisabledItemStyle                  = new DisabledNodeStyle(this);
            SelectColumnsOnRightClick          = true;
            SelectColumnsOnRightClickBehaviour = ColumnSelectBehaviour.InlineMenu;
            ShowCommandMenuOnRightClick        = false;
            ShowFilterMenuOnRightClick         = false;

            // Instance feature expansion classes.
            TreeColumnRenderer   = new NlmTreeColumnRenderer();
            ColumnHeaderRenderer = new ColumnHeaderRenderer(this);
            NlmColumns           = new NlmColumnCollection(this);
            CellEditValidator    = new CellEditValidator(this);
            MouseLeftClick       = new MouseLeftClick(this);
            ModelFilter          = new NlmTreeNodeFilterEngine(this);
            NodeControl          = new NodeController(this);
            ContextMenu          = new NlmContextMenu(this);

            // Load saved state if it exists
            MaxIO.LoadNlmData(this);

            this.CellEditStarting += new CellEditEventHandler(onBeforeLabelEdit);
        }
Beispiel #2
0
        public NameColumn(NlmTreeListView listView)
        {
            Text           = "Name";
            IsEditable     = true;
            Searchable     = true;
            FillsFreeSpace = true;

            ImageGetter = delegate(Object rowObject)
            {
                LayerTreeNode layerTreeNode = rowObject as LayerTreeNode;
                if (layerTreeNode != null)
                {
                    if (layerTreeNode.IsInstanced)
                    {
                        return("LayerInstance");
                    }
                    else
                    {
                        return("Layer");
                    }
                }
                ObjectTreeNode objectTreeNode = rowObject as ObjectTreeNode;
                if (objectTreeNode != null)
                {
                    return(objectTreeNode.Class.ToString());
                }
                if (rowObject is FolderTreeNode)
                {
                    return("Folder");
                }
                return(null);
            };

            AspectEngine = new NameAspectEngine(listView, this);
            Renderer     = new NlmTreeColumnRenderer();
        }