public bool MoveToChild(string name, Type dataType) { NodePosition pos = CurrentPosition; if (!MoveToFirstChild()) { return(false); } do { if ((name == null || NodeName == name) && (dataType == null || (DataItem != null && dataType.IsInstanceOfType(DataItem)))) { return(true); } } while (MoveNext()); MoveToPosition(pos); return(false); }
internal static void GetNodeInfo(ExtensibleTreeView tree, ITreeBuilder tb, NodeBuilder[] chain, object dataObject, out string text, out Gdk.Pixbuf icon, out Gdk.Pixbuf closedIcon) { icon = null; closedIcon = null; text = string.Empty; NodePosition pos = tb.CurrentPosition; foreach (NodeBuilder builder in chain) { try { builder.BuildNode(tb, dataObject, ref text, ref icon, ref closedIcon); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } tb.MoveToPosition(pos); } if (closedIcon == null) { closedIcon = icon; } if (tree.CopyObjects != null && ((IList)tree.CopyObjects).Contains(dataObject) && tree.CurrentTransferOperation == DragOperation.Move) { Gdk.Pixbuf gicon = tree.BuilderContext.GetComposedIcon(icon, "fade"); if (gicon == null) { gicon = ImageService.MakeTransparent(icon, 0.5); tree.BuilderContext.CacheComposedIcon(icon, "fade", gicon); } icon = gicon; gicon = tree.BuilderContext.GetComposedIcon(closedIcon, "fade"); if (gicon == null) { gicon = ImageService.MakeTransparent(closedIcon, 0.5); tree.BuilderContext.CacheComposedIcon(closedIcon, "fade", gicon); } closedIcon = gicon; } }
public void ExpandToNode() { if (node != null) { NodePosition pos = CurrentPosition; try { if (!MoveToParent()) { return; } ExpandToNode(); } finally { MoveToPosition(pos); Expanded = true; } } else { navigator.ExpandToNode(); } }
public bool MoveNext() { NodePosition oldPos = CurrentPosition; if (node != null && node.Parent != null) { int i = node.Parent.Children.IndexOf(node); if (i != -1 && i < node.Parent.Children.Count - 1) { node = node.Parent.Children [i + 1]; return(true); } // Position the navigator at the first child of the parent if (!node.Parent.HasIter) { return(false); } node = node.Parent; InitNavigator(); if (!navigator.MoveToFirstChild()) { MoveToPosition(oldPos); return(false); } if (CheckNode()) { return(true); } } InitNavigator(); while (navigator.MoveNext()) { if (CheckNode()) { return(true); } } MoveToPosition(oldPos); return(false); }
TreeNode CreateNode(object dataObject) { if (dataObject == null) { throw new ArgumentNullException("dataObject"); } NodeBuilder[] chain = tree.GetBuilderChain(dataObject.GetType()); if (chain == null) { return(null); } NodeAttributes ats; NodePosition pos = CurrentPosition; try { ats = TreeBuilder.GetAttributes(this, chain, dataObject); if ((ats & NodeAttributes.Hidden) != 0) { return(null); } } finally { MoveToPosition(pos); } TreeNode n = new TreeNode(); n.DataItem = dataObject; n.BuilderChain = chain; n.Filled = false; UpdateNode(n, chain, ats, dataObject); n.Filled = !TreeBuilder.HasChildNodes(this, chain, dataObject); tstore.RegisterNode(n); return(n); }
public object GetParentDataItem(Type type, bool includeCurrent) { if (includeCurrent && type.IsInstanceOfType(DataItem)) { return(DataItem); } NodePosition pos = CurrentPosition; try { while (MoveToParent()) { if (type.IsInstanceOfType(DataItem)) { return(DataItem); } } return(null); } finally { MoveToPosition(pos); } }
internal static NodeInfo GetNodeInfo(NodeInfo nodeInfo, ExtensibleTreeView tree, ITreeBuilder tb, NodeBuilder[] chain, object dataObject) { NodePosition pos = tb.CurrentPosition; foreach (NodeBuilder builder in chain) { try { builder.BuildNode(tb, dataObject, nodeInfo); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } tb.MoveToPosition(pos); } if (nodeInfo.ClosedIcon == null) { nodeInfo.ClosedIcon = nodeInfo.Icon; } if (tree.CopyObjects != null && ((IList)tree.CopyObjects).Contains(dataObject) && tree.CurrentTransferOperation == DragOperation.Move) { var gicon = tree.BuilderContext.GetComposedIcon(nodeInfo.Icon, "fade"); if (gicon == null) { gicon = nodeInfo.Icon.WithAlpha(0.5); tree.BuilderContext.CacheComposedIcon(nodeInfo.Icon, "fade", gicon); } nodeInfo.Icon = gicon; gicon = tree.BuilderContext.GetComposedIcon(nodeInfo.ClosedIcon, "fade"); if (gicon == null) { gicon = nodeInfo.ClosedIcon.WithAlpha(0.5); tree.BuilderContext.CacheComposedIcon(nodeInfo.ClosedIcon, "fade", gicon); } nodeInfo.ClosedIcon = gicon; } return(nodeInfo); }
void FillNode() { node.Filled = true; NodePosition pos = CurrentPosition; foreach (NodeBuilder builder in node.BuilderChain) { try { builder.PrepareChildNodes(node.DataItem); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } MoveToPosition(pos); } foreach (NodeBuilder builder in node.BuilderChain) { try { builder.BuildChildNodes(this, node.DataItem); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } MoveToPosition(pos); } }
public bool MoveToPosition (NodePosition position) { if (position._node != null) { node = (TreeNode) position._node; return !node.Deleted; } else { node = null; return navigator.MoveToPosition (position) && CheckNode (); } }
public bool MoveToPosition(NodePosition position) { MoveToIter((Gtk.TreeIter)position._iter); return(true); }
public bool MoveToPosition(NodePosition position) { MoveToIter ((Gtk.TreeIter) position._iter); return true; }