当前位置: 首页>>代码示例>>C#>>正文


C# TreePosition类代码示例

本文整理汇总了C#中TreePosition的典型用法代码示例。如果您正苦于以下问题:C# TreePosition类的具体用法?C# TreePosition怎么用?C# TreePosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreePosition类属于命名空间,在下文中一共展示了TreePosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetParent

		public TreePosition GetParent (TreePosition pos)
		{
			var node = (TreeStoreNode) pos;
			if (node.Parent == null)
				return null;

			return node.Parent;
		}
开发者ID:m13253,项目名称:xwt,代码行数:8,代码来源:TreeStoreBackend.cs

示例2: GetIterPos

		IterPos GetIterPos (TreePosition pos)
		{
			IterPos tpos = (IterPos) pos;
			if (tpos != null && tpos.Version != version) {
				tpos.LastChildIndex = -1;
				tpos.ChildrenCount = -1;
			}
			return tpos;
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:9,代码来源:TreeStoreBackend.cs

示例3: GetChild

		public TreePosition GetChild (TreePosition pos, int index)
		{
			var node = (TreeStoreNode) pos;
			var list = GetListForNode (node);
			if (list.Count == 0 || index >= list.Count)
				return null;

			return list [index];
		}
开发者ID:m13253,项目名称:xwt,代码行数:9,代码来源:TreeStoreBackend.cs

示例4: AddChild

 public TreePosition AddChild(TreePosition pos)
 {
     IterPos tpos = (IterPos)pos;
     Gtk.TreeIter it;
     if (pos == null)
         it = Tree.AppendNode ();
     else
         it = Tree.AppendNode (tpos.Iter);
     return new IterPos (it);
 }
开发者ID:carlosalberto,项目名称:xwt,代码行数:10,代码来源:TreeStoreBackend.cs

示例5: AddChild

 public TreePosition AddChild(TreePosition pos)
 {
     version++;
     IterPos tpos = GetIterPos (pos);
     Gtk.TreeIter it;
     if (pos == null)
         it = Tree.AppendNode ();
     else
         it = Tree.AppendNode (tpos.Iter);
     return new IterPos (version, it);
 }
开发者ID:garuma,项目名称:xwt,代码行数:11,代码来源:TreeStoreBackend.cs

示例6: IterFromNode

        Gtk.TreeIter IterFromNode (TreePosition node)
		{
			GCHandle gch;
			if (!handleHash.TryGetValue (node, out gch)) {
				gch = GCHandle.Alloc (node);
				handleHash [node] = gch;
				nodeHash [gch] = node;
			}
			Gtk.TreeIter result = Gtk.TreeIter.Zero;
			result.UserData = (IntPtr)gch;
			return result;
		}
开发者ID:m13253,项目名称:xwt,代码行数:12,代码来源:CustomTreeModel.cs

示例7: AddChild

        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos (pos);
            Gtk.TreeIter it;
            if (pos == null)
                it = Tree.AppendNode ();
            else
                it = Tree.AppendNode (tpos.Iter);

            var node = new IterPos (version, it);
            if (NodeInserted != null)
                NodeInserted (this, new TreeNodeEventArgs (node));
            return node;
        }
开发者ID:antmicro,项目名称:xwt,代码行数:15,代码来源:TreeStoreBackend.cs

示例8: SaveChildren

		void SaveChildren (List<NodeInfo> info, TreePosition it)
		{
			int num = tree.DataSource.GetChildrenCount (it);
			for (int n=0; n<num; n++) {
				var child = tree.DataSource.GetChild (it, n);
				object id = tree.DataSource.GetValue (child, idColumn);
				NodeInfo ni = new NodeInfo ();
				ni.Id = id;
				ni.Expanded = tree.IsRowExpanded (child);
				ni.Selected = tree.IsRowSelected (child);
				info.Add (ni);
				if (tree.DataSource.GetChildrenCount (child) > 0) {
					ni.ChildInfo = new List<NodeInfo> ();
					SaveChildren (ni.ChildInfo, child);
				}
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:17,代码来源:TreeViewStatus.cs

示例9: Load

		void Load (List<NodeInfo> info, TreePosition it)
		{
			bool oneSelected = false;
			var infoCopy = new List<NodeInfo> (info);
			Dictionary<NodeInfo,TreePosition> nodes = new Dictionary<NodeInfo, TreePosition> ();
			
			int num = tree.DataSource.GetChildrenCount (it);
			for (int n=0; n<num; n++) {
				var child = tree.DataSource.GetChild (it, n);
				object id = tree.DataSource.GetValue (child, idColumn);
				NodeInfo ni = ExtractNodeInfo (info, id);
				if (ni != null) {
					nodes [ni] = child;
					if (ni.Expanded)
						tree.ExpandRow (child, false);
					else
						tree.CollapseRow (child);
					
					if (ni.Selected) {
						oneSelected = true;
						tree.SelectRow (child);
					}
					else
						tree.UnselectRow (child);
					
					if (ni.ChildInfo != null)
						Load (ni.ChildInfo, child);
				}
			}
			
			// If this tree level had a selected node and this node has been deleted, then
			// try to select and adjacent node
			if (!oneSelected) {
				// 'info' contains the nodes that have not been inserted
				if (info.Any (n => n.Selected)) {
					NodeInfo an = FindAdjacentNode (infoCopy, nodes, info[0]);
					if (an != null) {
						it = nodes [an];
						tree.SelectRow (it);
					}
				}
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:43,代码来源:TreeViewStatus.cs

示例10: GetChildrenCount

        public int GetChildrenCount(TreePosition pos)
        {
            if (pos == null)
                return Tree.IterNChildren ();

            IterPos tpos = GetIterPos (pos);

            if (tpos.ChildrenCount != -1)
                return tpos.ChildrenCount;

            return tpos.ChildrenCount = Tree.IterNChildren (tpos.Iter);
        }
开发者ID:antmicro,项目名称:xwt,代码行数:12,代码来源:TreeStoreBackend.cs

示例11: SetValue

 public void SetValue(TreePosition pos, int column, object value)
 {
     IterPos tpos = GetIterPos (pos);
     SetValue (tpos.Iter, column, value);
     if (NodeChanged != null)
         NodeChanged (this, new TreeNodeEventArgs (pos));
 }
开发者ID:antmicro,项目名称:xwt,代码行数:7,代码来源:TreeStoreBackend.cs

示例12: CollapseRow

 public void CollapseRow(TreePosition pos)
 {
     Widget.CollapseRow (Widget.Model.GetPath (((IterPos)pos).Iter));
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:4,代码来源:TreeViewBackend.cs

示例13: ScrollToRow

 public void ScrollToRow(TreePosition pos)
 {
     Widget.ScrollToCell (Widget.Model.GetPath (((IterPos)pos).Iter), Widget.Columns[0], false, 0, 0);
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:4,代码来源:TreeViewBackend.cs

示例14: IsRowExpanded

 public bool IsRowExpanded(TreePosition pos)
 {
     return Widget.GetRowExpanded (Widget.Model.GetPath (((IterPos)pos).Iter));
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:4,代码来源:TreeViewBackend.cs

示例15: ExpandToRow

 public void ExpandToRow(TreePosition pos)
 {
     Widget.ExpandToPath (Widget.Model.GetPath (((IterPos)pos).Iter));
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:4,代码来源:TreeViewBackend.cs


注:本文中的TreePosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。