Exemple #1
0
        // ...

        private void ExpandNode(TreeDataNode node)
        {
            if (node == null || node.IsExpanded)
            {
                return;
            }

            Console.WriteLine("Expand Node: " + node.Data.NodeDisplay);

            node.IsExpanded = true;
            node.Nodes.Clear();

            DataNode backNode = node.Data;

            if (!backNode.IsExpanded)
            {
                backNode.Expand();
            }

            foreach (DataNode child in backNode.Nodes)
            {
                if (child != null)
                {
                    node.Nodes.Add(new TreeDataNode(child));
                }
            }
        }
Exemple #2
0
            public override void ItemDidExpand(NSNotification notification)
            {
                TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;

                if (node != null)
                {
                    Console.WriteLine("Finished Expanding: " + node.Data.NodeDisplay);
                }
            }
Exemple #3
0
            public override void ItemWillExpand(NSNotification notification)
            {
                TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;

                if (node != null)
                {
                    Console.WriteLine("Preparing to expand: " + node.Data.NodeDisplay);
                    _main.ExpandNode(node);
                }
            }
Exemple #4
0
        public override int GetChildrenCount(NSOutlineView outlineView, NSObject item)
        {
            if (item is TreeDataNode)
            {
                TreeDataNode nodeItem = item as TreeDataNode;
                return(nodeItem.Nodes.Count);
            }

            return(_nodes.Count);
        }
Exemple #5
0
        public override bool ItemExpandable(NSOutlineView outlineView, NSObject item)
        {
            TreeDataNode nodeItem = item as TreeDataNode;

            if (nodeItem != null)
            {
                return(nodeItem.HasChildren);
            }

            return(false);
        }
Exemple #6
0
        public override NSObject GetChild(NSOutlineView outlineView, int childIndex, NSObject ofItem)
        {
            TreeDataNode nodeItem = ofItem as TreeDataNode;

            if (nodeItem != null)
            {
                return(nodeItem.Nodes [childIndex]);
            }

            return(Nodes[childIndex]);
        }
Exemple #7
0
        public override NSObject GetObjectValue(NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem)
        {
            TreeDataNode nodeItem = byItem as TreeDataNode;

            if (nodeItem == null)
            {
                return(null);
            }

            return((NSString)nodeItem.CombinedName);
        }
Exemple #8
0
            public override void ItemWillCollapse(NSNotification notification)
            {
                TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;

                if (node != null)
                {
                    if (node.Data.NodeDisplay == "saves")                     // The root node
                    {
                        Console.WriteLine("Uh-oh...");
                    }
                    Console.WriteLine("Preparing to collapse: " + node.Data.NodeDisplay);
                }
            }
Exemple #9
0
		// ...
		
		private void ExpandNode (TreeDataNode node)
		{
			if (node == null || node.IsExpanded)
				return;
			
			Console.WriteLine ("Expand Node: " + node.Data.NodeDisplay);
			
			node.IsExpanded = true;
			node.Nodes.Clear ();
			
			DataNode backNode = node.Data;
			if (!backNode.IsExpanded) {
				backNode.Expand ();
			}
			
			foreach (DataNode child in backNode.Nodes) {
				if (child != null) {
					node.Nodes.Add (new TreeDataNode (child));
				}
			}
		}