Ejemplo n.º 1
0
 public void AddChild(BaseTreeNode child, BaseTreeNode parent, Boolean refreshObject)
 {
     parent.Children.Add(child);
     child.Parent = parent;
     if (refreshObject)
     {
         ListView.RefreshObject(parent);
     }
 }
Ejemplo n.º 2
0
 private void RefreshNodes(ITab <UIntPtr> nodes)
 {
     for (int i = 0; i < nodes.Count; i++)
     {
         UIntPtr             handle    = nodes[(IntPtr)i];
         List <BaseTreeNode> treeNodes = NodeControl.HandleMap.GetTreeNodesByHandle(handle);
         foreach (BaseTreeNode treeNode in treeNodes)
         {
             if (treeNode == null)
             {
                 continue;
             }
             ListView.RefreshObject(treeNode);
         }
     }
 }
Ejemplo n.º 3
0
        public static void onCreateFolderAddSelection(Object sender, ClickEventArgs e)
        {
            NlmTreeListView            listView  = e.ListView;
            IEnumerable <BaseTreeNode> selection = listView.SelectedObjects.Cast <BaseTreeNode>();

            onCreateFolder(sender, e);

            FolderTreeNode folderTreeNode = listView.SelectedObject as FolderTreeNode;

            if (folderTreeNode != null)
            {
                IEnumerable <BaseTreeNode> layerFolderSelection = selection
                                                                  .Where(x => x is LayerTreeNode || x is FolderTreeNode)
                                                                  .Where(x => !folderTreeNode.IsAncestor(x));
                IEnumerable <BaseTreeNode> refreshNodes = layerFolderSelection
                                                          .Where(x => x.Parent != null)
                                                          .Select(x => x.Parent);

                listView.NodeControl.Parent.MoveTreeNodes(layerFolderSelection, folderTreeNode);
                listView.RefreshObjects(refreshNodes.ToList());
                listView.RefreshObject(folderTreeNode);
            }
        }
Ejemplo n.º 4
0
        public Boolean Click(OlvListViewHitTestInfo hti)
        {
            if (hti.ColumnIndex > 0)
            {
                if (hti.Column == ListView.NlmColumns.ColorColumn)
                {
                    // Should the check states be changed on the selection, or on an item outside of selection.
                    // If inside selection, suppress change in selection by returning true.
                    // If outside selection, change the single item and return false.
                    if (hti.Item.Selected)
                    {
                        NlmMaxColorPicker colorPicker = new NlmMaxColorPicker(hti, true, ListView);
                        colorPicker.ShowModeless();
                        return(true);
                    }
                    else
                    {
                        NlmMaxColorPicker colorPicker = new NlmMaxColorPicker(hti, false, ListView);
                        colorPicker.ShowModeless();
                        // Returning false annoyingly pushes the window to the back.
                        // TODO: Somehow make this dialog modal, or at least parented to 3ds Max, and sort out the focus issue.
                        return(true);
                    }
                }
                if (hti.Column == ListView.NlmColumns.CurrentColumn)
                {
                    BaseTreeNode treeNode = hti.RowObject as BaseTreeNode;
                    if (treeNode is LayerTreeNode)
                    {
                        ListView.BeginUpdate();
                        hti.Column.PutValue(treeNode, true);
                        ListView.EndUpdate();
                    }
                    return(hti.Item.Selected);
                }
                else
                {
                    Boolean    htiItemSelected = hti.Item.Selected;
                    INLMColumn column          = hti.Column as INLMColumn;

                    // Should the check states be changed on the selection, or on an item outside of selection.
                    // If inside selection, suppress change in selection by returning true.
                    // If outside selection, change the single item and return false.
                    if (htiItemSelected)
                    {
                        column.AspectEngine.ToggleCheckStates(hti.RowObject);
                        ListView.RefreshObjects(ListView.SelectedObjects);
                    }
                    else
                    {
                        column.AspectEngine.ToggleCheckState(hti.RowObject);
                        ListView.RefreshObject(hti.RowObject);
                    }

                    MaxUI.RedrawViewportsNow();
                    return(htiItemSelected);
                }
            }
            return(false);
            // Returning true means selection does not change, returning false means it does.
        }