public string GetToolTip(TreeNodeAdv node, NodeControl nodeControl) { var item = node.Tag as BaseItem; if (item != null) return item.Description; return null; }
public string GetToolTip(TreeNodeAdv node, NodeControl nodeControl) { if (node.Tag is RootItem) return null; else return "Second click to rename node"; }
internal bool HideEditor(bool applyChanges) { if (CurrentEditor != null) { if (applyChanges) { if (!ApplyChanges()) return false; } //Check once more if editor was closed in ApplyChanges if (CurrentEditor != null) { CurrentEditor.Validating -= EditorValidating; CurrentEditorOwner.DoDisposeEditor(CurrentEditor); CurrentEditor.Parent = null; CurrentEditor.Dispose(); CurrentEditor = null; CurrentEditorOwner = null; _editingNode = null; } } return true; }
public override void Draw(TreeNodeAdv node, DrawContext context) { Graphics g = context.Graphics; Rectangle targetRect = new Rectangle( context.Bounds.X + this.LeftMargin, context.Bounds.Y, context.Bounds.Width - this.LeftMargin, context.Bounds.Height); // Retrieve item information PackageItem item = node.Tag as PackageItem; Image typeIcon = null; if (item != null) { switch (item.Type) { case PackageItem.PackageType.Core: typeIcon = PackageManagerFrontendResCache.IconCore; break; case PackageItem.PackageType.Editor: typeIcon = PackageManagerFrontendResCache.IconEditor; break; case PackageItem.PackageType.Sample: typeIcon = PackageManagerFrontendResCache.IconSample; break; } } if (typeIcon == null) return; // Draw icon centered Point iconPos = new Point( targetRect.X + targetRect.Width / 2 - typeIcon.Width / 2, targetRect.Y + targetRect.Height / 2 - typeIcon.Height / 2); g.DrawImageUnscaled(typeIcon, iconPos.X, iconPos.Y); }
public void Perf_test() { var treeNodeAdv = new TreeNodeAdv(new ThreeStateNode("node")); var newCheckBox = new NodeCheckBox(); var oldCheckBox = new Aga.Controls.Tree.NodeControls.NodeCheckBox { DataPropertyName = "CheckState" }; const int reps = 1000000; var oldTime = Time(() => { for (int i = 0; i < reps; i++) oldCheckBox.GetValue(treeNodeAdv); }); Console.WriteLine("Base node check box: {0}", oldTime); var newTime = Time(() => { for (int i = 0; i < reps; i++) newCheckBox.GetValue(treeNodeAdv); }); Console.WriteLine("New node check box: {0}", newTime); Assert.GreaterThan(oldTime, newTime); }
protected override Control CreateEditor(TreeNodeAdv node) { var comboBox = new ComboBox(); if (DropDownItems != null) { comboBox.Items.AddRange(DropDownItems.ToArray()); } var value = GetValue(node); var property = (ValueId) value; var index = 0; // TODO if(property != null) { foreach (var item in comboBox.Items) { if(item.Equals(value)) { comboBox.SelectedIndex = index; break; } index++; } } comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.DropDownClosed += EditorDropDownClosed; SetEditControlProperties(comboBox, node); return comboBox; }
public override void SetValue(TreeNodeAdv node, object value) { ISetText content = (ISetText)((TreeViewVarNode)node).Content; if (content.CanSetText) { content.SetText(value.ToString()); } }
protected override void SetCheckState(TreeNodeAdv node, CheckState value) { if (node.Tag is FileNode) return; base.SetCheckState(node, value); }
protected virtual void AddUserWatchFromNode(TreeNodeAdv node) { string varName = ""; while (node != node.Tree.Root) { WatchNode watchNode = node != null ? node.Tag as WatchNode : null; node = node.Parent; if (watchNode == null) continue; if (watchNode.Variable.StartsWith("[[")) continue; if (varName.Length > 0 && varName[0] != '[') { varName = "." + varName; } int position = watchNode.Variable.LastIndexOf('['); if (position >= 0 && node != node.Tree.Root) { varName = watchNode.Variable.Substring(position, watchNode.Variable.Length - position) + varName; } else { varName = watchNode.Variable + varName; } } if (varName.Length > 0) { UnrealDebuggerIDE.Commands.AddWatch(varName); } }
public string GetToolTip(TreeNodeAdv node) { if (node.Tag is RootItem) return null; else return "Double click to rename node"; }
public void DrawNode(TreeNodeAdv node, DrawContext context) { foreach (NodeControlInfo item in GetNodeControls(node)) { if (item.Bounds.X >= OffsetX && item.Bounds.X - OffsetX < this.Bounds.Width)// skip invisible nodes { if (!DragMode) { if (ColumnSelectionMode == ColumnSelectionMode.All) { if (node.IsSelected && Focused) context.DrawSelection = DrawSelectionMode.Active; else if (node.IsSelected && !Focused && !HideSelection) context.DrawSelection = DrawSelectionMode.Inactive; } else { bool selectedColumn = ((item.Control != null) && (item.Control.ParentColumn != null) && (this.SelectedColumnIndex == item.Control.ParentColumn.Index)); if (node.IsSelected && Focused && selectedColumn) context.DrawSelection = DrawSelectionMode.Active; else if (node.IsSelected && !Focused && !HideSelection && selectedColumn) context.DrawSelection = DrawSelectionMode.Inactive; else context.DrawSelection = DrawSelectionMode.None; } } context.Bounds = item.Bounds; context.Graphics.SetClip(context.Bounds); item.Control.Draw(node, context); context.Graphics.ResetClip(); } } }
public override string GetToolTip(TreeNodeAdv node) { AssemblyGroup grp = ((AssemblyGroupTreeItem)node.Tag).Group; string tip = "Assembly " + grp.Name; if (grp.HasErrors) { tip += " failed to load. Check log messages for detailed error information."; } else if (ChangeTypeUtil.HasBreaking(grp.Change)) { tip += " has breaking changes."; } else if (ChangeTypeUtil.HasNonBreaking(grp.Change)) { tip += " has non-breaking changes."; } else { tip += " has no changes."; } return tip; }
public AdvNodeAccessibleObject(TreeNodeAdv advNode, AdvNodeAccessibleObject parent, TreeViewAdvAccessibleObject owner) : base() { node = advNode; this.parent = parent; this.owner = owner; }
public string GetToolTip(TreeNodeAdv node, NodeControl nodeControl) { var item = node.Tag as FieldItem; if (item == null) return null; var interp = item.Interpretation(); if (interp == item.Description) return null; return interp; }
public TreeViewRowDrawEventArgs(Graphics graphics, Rectangle clipRectangle, TreeNodeAdv node, DrawContext context, int row, Rectangle rowRect) : base(graphics, clipRectangle) { _node = node; _context = context; _row = row; _rowRect = rowRect; }
public override object GetValue(TreeNodeAdv node) { if (node is TreeViewVarNode) { return ((TreeViewVarNode)node).Content.Text; } else { // Happens during incremental search return base.GetValue(node); } }
public string GetToolTip(TreeNodeAdv node, Aga.Controls.Tree.NodeControls.NodeControl nodeControl) { var pNode = _tree.FindNode(node); if (pNode != null) return pNode.GetTooltipText(this); else return ""; }
/// <summary> /// Sets the check state of the node. /// </summary> /// <param name="node">The node.</param> /// <param name="value">The value.</param> protected override void SetCheckState(TreeNodeAdv node, CheckState value) { var threeStateNode = node.Tag as ThreeStateNode; if (threeStateNode == null) return; threeStateNode.CheckState = value; }
///<summary> /// Gets the value from the node. ///</summary> ///<param name="node">The node.</param> ///<returns>The value.</returns> public override object GetValue(TreeNodeAdv node) { var threeStateNode = node.Tag as ThreeStateNode; if (threeStateNode == null) return null; return threeStateNode.CheckState; }
public void DoDragDropSelectedNodes(DragDropEffects allowedEffects) { if (SelectedNodes.Count > 0) { TreeNodeAdv[] nodes = new TreeNodeAdv[SelectedNodes.Count]; SelectedNodes.CopyTo(nodes, 0); DoDragDrop(nodes, allowedEffects); } }
internal static void OnDragDrop(ISiteExplorer sender, DragEventArgs e, TreeNodeAdv droppedNode) { //If drop node specified, extract relevant folder, otherwise default to root (Library://) string folderId = StringConstants.RootIdentifier; IServerConnection conn = null; var mgr = ServiceRegistry.GetService<ServerConnectionManager>(); if (droppedNode != null) { var ri = droppedNode.Tag as RepositoryItem; if (ri != null) { if (ri.IsFolder) folderId = ri.ResourceId; else folderId = ri.Parent != null ? ri.Parent.ResourceId : StringConstants.RootIdentifier; } conn = mgr.GetConnection(ri.ConnectionName); } else { return; } Array a = e.Data.GetData(DataFormats.FileDrop) as Array; bool refresh = false; if (a != null && a.Length > 0) { DragDropHandlerService handlerSvc = ServiceRegistry.GetService<DragDropHandlerService>(); for (int i = 0; i < a.Length; i++) { string file = a.GetValue(i).ToString(); IList<IDragDropHandler> handlers = handlerSvc.GetHandlersForFile(file); if (handlers.Count == 0) continue; if (handlers.Count == 1) { using (new WaitCursor(Workbench.Instance)) { if (handlers[0].HandleDrop(conn, file, folderId)) refresh = true; } } if (handlers.Count > 1) { //Resolve which handler to use } } } if (refresh) sender.RefreshModel(conn.DisplayName, folderId); }
public string GetToolTip(TreeNodeAdv node, Aga.Controls.Tree.NodeControls.NodeControl nodeControl) { var pNode = _tree.FindNode(node); // Use the process node's tooltip mechanism to allow caching. if (pNode != null) return pNode.GetTooltipText(this); else return ""; }
public void DrawNode(TreeNodeAdv node, DrawContext context) { foreach (NodeControlInfo item in GetNodeControls(node)) { context.Bounds = item.Bounds; context.Graphics.SetClip(context.Bounds); item.Control.Draw(node, context); context.Graphics.ResetClip(); } }
public override void Draw(TreeNodeAdv node, DrawContext context) { Graphics g = context.Graphics; Rectangle targetRect = new Rectangle( context.Bounds.X + this.LeftMargin, context.Bounds.Y, context.Bounds.Width - this.LeftMargin, context.Bounds.Height); // Retrieve item information PackageItem item = node.Tag as PackageItem; if (item == null) return; string headline = null; string summary = null; if (item != null) { headline = item.Title; if (item.ItemPackageInfo != null) { summary = item.ItemPackageInfo.Summary; } } // Calculate drawing layout and data StringFormat headlineFormat = new StringFormat { Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoWrap }; StringFormat summaryFormat = new StringFormat { Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.LineLimit }; Rectangle headlineRect; Rectangle summaryRect; { SizeF headlineSize; SizeF summarySize; // Base info { headlineSize = g.MeasureString(headline, context.Font, targetRect.Width, headlineFormat); headlineRect = new Rectangle(targetRect.X, targetRect.Y, targetRect.Width, (int)headlineSize.Height + 2); summaryRect = new Rectangle(targetRect.X, targetRect.Y + headlineRect.Height, targetRect.Width, targetRect.Height - headlineRect.Height); summarySize = g.MeasureString(summary, context.Font, summaryRect.Size, summaryFormat); } // Alignment info { Size totelContentSize = new Size(Math.Max(headlineRect.Width, summaryRect.Width), headlineRect.Height + (int)summarySize.Height); Point alignAdjust = new Point(0, Math.Max((targetRect.Height - totelContentSize.Height) / 2, 0)); headlineRect.X += alignAdjust.X; headlineRect.Y += alignAdjust.Y; summaryRect.X += alignAdjust.X; summaryRect.Y += alignAdjust.Y; } } Color textColor = this.Parent.ForeColor; g.DrawString(headline, context.Font, new SolidBrush(Color.FromArgb(context.Enabled ? 255 : 128, textColor)), headlineRect, headlineFormat); g.DrawString(summary, context.Font, new SolidBrush(Color.FromArgb(context.Enabled ? 128 : 64, textColor)), summaryRect, summaryFormat); }
protected virtual ContextMenuStrip SelectContextMenuForNode(TreeNodeAdv node) { if (node != null) { return this.contextMenuStripWatch; } else { return null; } }
public bool PasteClip(TreeNodeAdv selectedNode, System.Windows.Forms.ImageList imagelist) { if(string.IsNullOrEmpty(tree.rootkey)) { return false; } Node parentNode = selectedNode.Tag as Node; DrawChildNode(parentNode, tree.GetDataByUniqueKey(tree.rootkey), imagelist); return true; }
private void SelectAllFromStart(TreeNodeAdv node) { Tree.ClearSelectionInternal(); int a = node.Row; int b = Tree.SelectionStart.Row; for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++) { if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent) Tree.RowMap[i].IsSelected = true; } }
public string GetToolTip(TreeNodeAdv node, Aga.Controls.Tree.NodeControls.NodeControl nodeControl) { NodeBase dataNode = node.Tag as NodeBase; GameObjectNode objNode = dataNode as GameObjectNode; if (dataNode.LinkState == NodeBase.PrefabLinkState.None) return null; if (objNode == null) return null; if (objNode.Obj.PrefabLink == null) return null; return String.Format(PluginRes.EditorBaseRes.SceneView_PrefabLink, objNode.Obj.PrefabLink.Prefab.Path); }
private bool CheckNodeParent(TreeNodeAdv parent, TreeNodeAdv node) { while (parent != null) { if (node == parent) return false; else parent = parent.Parent; } return true; }
public string GetToolTip(TreeNodeAdv node, NodeControl nodeControl) { GrtTreeNode grtNode = node.Tag as GrtTreeNode; if (null != grtNode) { string tooltip; Model.get_field(grtNode.NodeId, TooltipColumn, out tooltip); return tooltip; } return ""; }
private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect) { TreeNodeAdv node = _rowMap[row]; context.DrawSelection = DrawSelectionMode.None; context.CurrentEditorOwner = _currentEditorOwner; if (DragMode) { if ((_dropPosition.Node == node) && _dropPosition.Position == NodePosition.Inside) { context.DrawSelection = DrawSelectionMode.Active; } } else { if (node.IsSelected && Focused) { context.DrawSelection = DrawSelectionMode.Active; } else if (node.IsSelected && !Focused && !HideSelection) { context.DrawSelection = DrawSelectionMode.Inactive; } } context.DrawFocus = Focused && CurrentNode == node; if (FullRowSelect) { context.DrawFocus = false; if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive) { Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, ClientRectangle.Width, rowRect.Height); if (context.DrawSelection == DrawSelectionMode.Active) { e.Graphics.FillRectangle(SystemBrushes.Highlight, focusRect); context.DrawSelection = DrawSelectionMode.FullRowSelect; } else { e.Graphics.FillRectangle(SystemBrushes.InactiveBorder, focusRect); context.DrawSelection = DrawSelectionMode.None; } } } if (GridLines) { int x = 0; foreach (TreeColumn c in Columns) { if (c.IsVisible) { Rectangle rect = new Rectangle(x, rowRect.Y, c.Width, rowRect.Height); e.Graphics.DrawRectangle(SystemPens.InactiveBorder, rect); x += c.Width; } } if (x < ClientRectangle.Width) { Rectangle rect = new Rectangle(x, rowRect.Y, ClientRectangle.Width - x, rowRect.Height); e.Graphics.DrawRectangle(SystemPens.InactiveBorder, rect); } } if (ShowLines) { DrawLines(e.Graphics, node, rowRect); } DrawNode(node, context); }
private void RemoveExpandingNode(TreeNodeAdv node) { node.IsExpandingNow = false; _expandingNodes.Remove(node); }
public virtual void EndSearch() { _currentNode = null; _searchString = ""; }
private void AddExpandingNode(TreeNodeAdv node) { node.IsExpandingNow = true; _expandingNodes.Add(node); ExpandingIcon.Start(); }
protected virtual void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect) { TreeNodeAdv node = RowMap[row]; context.DrawSelection = DrawSelectionMode.None; context.CurrentEditorOwner = _currentEditorOwner; if (DragMode) { if ((_dropPosition.Node == node) && _dropPosition.Position == NodePosition.Inside && HighlightDropPosition) { context.DrawSelection = DrawSelectionMode.Active; } } else { if (node.IsSelected && Focused) { context.DrawSelection = DrawSelectionMode.Active; } else if (node.IsSelected && !Focused && !HideSelection) { context.DrawSelection = DrawSelectionMode.Inactive; } } context.DrawFocus = Focused && CurrentNode == node; // custom draw by mikel Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, DisplayRectangle.Width, rowRect.Height); context.Bounds = focusRect; OnBeforeNodeDrawing(node, context); if (FullRowSelect) { context.DrawFocus = false; if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive) { // Handle high contrast mode separately. if (SystemInformation.HighContrast) { // ml: use the highlight color of the system scheme in high contrast mode. using (SolidBrush brush = new SolidBrush(SystemColors.Highlight)) e.Graphics.FillRectangle(brush, focusRect); } else { RectangleF bounds = focusRect; bounds.X += 1.5f; bounds.Y -= 0.5f; bounds.Width -= 2; bounds.Height--; float cornerSize = 5; GraphicsPath fillPath = new GraphicsPath(); if (isWin8OrAbove) { fillPath.AddRectangle(bounds); } else { fillPath.AddArc(bounds.Left, bounds.Top, cornerSize, cornerSize, 180, 90); fillPath.AddArc(bounds.Right - cornerSize, bounds.Top, cornerSize, cornerSize, -90, 90); fillPath.AddArc(bounds.Right - cornerSize, bounds.Bottom - cornerSize, cornerSize, cornerSize, 0, 90); fillPath.AddArc(bounds.Left, bounds.Bottom - cornerSize, cornerSize, cornerSize, 90, 90); fillPath.CloseAllFigures(); } GraphicsPath outlinePath = new GraphicsPath(); bounds.X -= 0.5f; bounds.Y += 0.5f; if (isWin8OrAbove) { outlinePath.AddRectangle(bounds); } else { outlinePath.AddArc(bounds.Left, bounds.Top, cornerSize, cornerSize, 180, 90); outlinePath.AddArc(bounds.Right - cornerSize, bounds.Top, cornerSize, cornerSize, -90, 90); outlinePath.AddArc(bounds.Right - cornerSize, bounds.Bottom - cornerSize, cornerSize, cornerSize, 0, 90); outlinePath.AddArc(bounds.Left, bounds.Bottom - cornerSize, cornerSize, cornerSize, 90, 90); outlinePath.CloseAllFigures(); } if (context.DrawSelection == DrawSelectionMode.Active) { if (isWin8OrAbove) { using (SolidBrush brush = new SolidBrush(Color.FromArgb(0xFF, 0xD1, 0xE8, 0xFF))) e.Graphics.FillPath(brush, fillPath); using (Pen pen = new Pen(Color.FromArgb(255, 0x6E, 0xC0, 0xE7))) e.Graphics.DrawPath(pen, outlinePath); } else { using (LinearGradientBrush gradientBrush = new LinearGradientBrush( new PointF(0, bounds.Top), new PointF(0, bounds.Bottom), Color.FromArgb(255, 0xF1, 0xF7, 0xFE), Color.FromArgb(255, 0xCF, 0xE4, 0xFE))) e.Graphics.FillPath(gradientBrush, fillPath); using (Pen pen = new Pen(Color.FromArgb(255, 0x83, 0xAC, 0xDD))) e.Graphics.DrawPath(pen, outlinePath); } context.DrawSelection = DrawSelectionMode.FullRowSelect; } else { if (isWin8OrAbove) { using (SolidBrush brush = new SolidBrush(Color.FromArgb(0xFF, 0xF7, 0xF7, 0xF7))) e.Graphics.FillPath(brush, fillPath); using (Pen pen = new Pen(Color.FromArgb(0xFF, 0xDE, 0xDE, 0xDE))) e.Graphics.DrawPath(pen, outlinePath); } else { using (LinearGradientBrush gradientBrush = new LinearGradientBrush( new PointF(0, bounds.Top), new PointF(0, bounds.Bottom), Color.FromArgb(255, 0xF8, 0xF8, 0xF8), Color.FromArgb(255, 0xE5, 0xE5, 0xE5))) e.Graphics.FillPath(gradientBrush, fillPath); using (Pen pen = new Pen(Color.FromArgb(255, 0xD9, 0xD9, 0xD9))) e.Graphics.DrawPath(pen, outlinePath); } context.DrawSelection = DrawSelectionMode.None; } } } } // by mikez, mikel if ((GridLineStyle & GridLineStyle.Horizontal) == GridLineStyle.Horizontal) { e.Graphics.DrawLine(_gridPen, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom); } if (ShowLines) { DrawLines(e.Graphics, node, rowRect); } DrawNode(node, context); // ml: added for overlay images. OnAfterNodeDrawing(node, context); }
private void _model_StructureChanged(object sender, TreePathEventArgs e) { if (e.Path == null) { throw new ArgumentNullException(); } TreeNodeAdv node = FindNode(e.Path); if (node != null) { if (node != Root) { node.IsLeaf = Model.IsLeaf(GetPath(node)); } object[] currentPath = GetRelativePath(node, _currentNode); object[] selectionStartPath = GetRelativePath(node, _selectionStart); List <object[]> selectionPaths = new List <object[]>(); List <TreeNodeAdv> preservedSelection = new List <TreeNodeAdv>(); foreach (var selectionNode in Selection) { object[] selectionPath = GetRelativePath(node, selectionNode); if (selectionPath != null) { selectionPaths.Add(selectionPath); } else //preserve selection because this selectionNode is not a child of node { preservedSelection.Add(selectionNode); } } var list = new Dictionary <object, object>(); SaveExpandedNodes(node, list); ReadChilds(node); bool suspendSelectionEventBefore = SuspendSelectionEvent; bool suspendUpdateBefore = _suspendUpdate; bool fireSelectionBefore = _fireSelectionEvent; SuspendSelectionEvent = true; _suspendUpdate = true; RestoreExpandedNodes(node, list); //Restore Selection: _selection.Clear(); //restore preserved selection. _selection.AddRange(preservedSelection); //restore selection for child nodes. foreach (var selectionPath in selectionPaths) { TreeNodeAdv selectionNode = FindChildNode(node, selectionPath, 0, false); if (selectionNode != null) { selectionNode.SetSelectedInternal(true); _selection.Add(selectionNode); } else { fireSelectionBefore = true; // selection changed. } } if (currentPath != null) { _currentNode = FindChildNode(node, currentPath, 0, false); } if (selectionStartPath != null) { _selectionStart = FindChildNode(node, selectionStartPath, 0, false); } _fireSelectionEvent = fireSelectionBefore; _suspendUpdate = suspendUpdateBefore; SuspendSelectionEvent = suspendSelectionEventBefore; UpdateSelection(); SmartFullUpdate(); } //else // throw new ArgumentException("Path not found"); }
private bool IsCategoryNode(TreeNodeAdv node) { return(node.Tag is Node && ((Node)node.Tag).IsCategoryNode); }
public NodeControlInfo(NodeControl control, Rectangle bounds, TreeNodeAdv node) { _control = control; _bounds = bounds; _node = node; }
internal Rectangle GetNodeBounds(TreeNodeAdv node) { return(GetNodeBounds(GetNodeControls(node))); }
internal IEnumerable <NodeControlInfo> GetNodeControls(TreeNodeAdv node, Rectangle rowRect) { if (node == null) { yield break; } int y = rowRect.Y; int x = (node.Level - 1) * _indent + LeftMargin; int width = 0; if (node.Row == 0 && ShiftFirstNode) { x -= _indent; } Rectangle rect = Rectangle.Empty; if (ShowPlusMinus) { width = _plusMinus.GetActualSize(node, _measureContext).Width; rect = new Rectangle(x, y, width, rowRect.Height); if (UseColumns && Columns.Count > 0 && Columns[0].Width < rect.Right) { rect.Width = Columns[0].Width - x; } yield return(new NodeControlInfo(_plusMinus, rect, node)); x += width; } if (!UseColumns) { foreach (NodeControl c in NodeControls) { Size s = c.GetActualSize(node, _measureContext); if (!s.IsEmpty) { width = s.Width; rect = new Rectangle(x, y, width, rowRect.Height); x += rect.Width; yield return(new NodeControlInfo(c, rect, node)); } } } else { int right = 0; foreach (TreeColumn col in Columns) { if (col.IsVisible && col.Width > 0) { right += col.Width; for (int i = 0; i < NodeControls.Count; i++) { NodeControl nc = NodeControls[i]; if (nc.ParentColumn == col) { Size s = nc.GetActualSize(node, _measureContext); if (!s.IsEmpty) { bool isLastControl = true; for (int k = i + 1; k < NodeControls.Count; k++) { if (NodeControls[k].ParentColumn == col) { isLastControl = false; break; } } width = right - x; if (!isLastControl) { width = s.Width; } int maxWidth = Math.Max(0, right - x); rect = new Rectangle(x, y, Math.Min(maxWidth, width), rowRect.Height); x += width; yield return(new NodeControlInfo(nc, rect, node)); } } } x = right; } } } }
internal void ReadChilds(TreeNodeAdv parentNode) { ReadChilds(parentNode, false); }
private void AddNewNode(TreeNodeAdv parent, object tag, int index) { TreeNodeAdv node = new TreeNodeAdv(this, tag); AddNode(parent, index, node); }
private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect) { TreeNodeAdv node = RowMap[row]; context.DrawSelection = DrawSelectionMode.None; context.CurrentEditorOwner = CurrentEditorOwner; if (DragMode) { if ((_dropPosition.Node == node) && _dropPosition.Position == NodePosition.Inside && HighlightDropPosition) { context.DrawSelection = DrawSelectionMode.Active; } } else { //if (!IsCategoryNode(node)) { if (node.IsSelected && Focused) { context.DrawSelection = DrawSelectionMode.Active; } else if (node.IsSelected && !Focused && !HideSelection) { context.DrawSelection = DrawSelectionMode.Inactive; } } } context.DrawFocus = Focused && CurrentNode == node; OnRowDraw(e, node, context, row, rowRect); if (FullRowSelect) { context.DrawFocus = false; if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive) { if (!IsCategoryNode(node)) { Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, ClientRectangle.Width, rowRect.Height); if (context.DrawSelection == DrawSelectionMode.Active || (context.DrawSelection == DrawSelectionMode.Inactive && !HideSelection)) { e.Graphics.FillRectangle(SystemBrushes.Highlight, focusRect); context.DrawSelection = DrawSelectionMode.FullRowSelect; } else { e.Graphics.FillRectangle(SystemBrushes.InactiveBorder, focusRect); context.DrawSelection = DrawSelectionMode.None; } } else { var focusRectWidth = ClientRectangle.Width - (_vScrollBar.Visible ? _vScrollBar.Width + 1 : 1); var offsetY = row == 0 ? rowRect.Y : rowRect.Y + rowRect.Height / 3; var focusRectHeight = row == 0 ? rowRect.Height : rowRect.Height * 2 / 3; var focusRect = new Rectangle(OffsetX, offsetY, focusRectWidth, focusRectHeight); if (context.DrawSelection == DrawSelectionMode.Active || (context.DrawSelection == DrawSelectionMode.Inactive && !HideSelection)) { DrawRoundedRectangle(e.Graphics, focusRect, 4, new Pen(SystemColors.Highlight)); context.DrawSelection = DrawSelectionMode.FullRowSelect; } else { DrawRoundedRectangle(e.Graphics, focusRect, 4, new Pen(SystemColors.InactiveBorder)); context.DrawSelection = DrawSelectionMode.None; } } } } if ((GridLineStyle & GridLineStyle.Horizontal) == GridLineStyle.Horizontal) { e.Graphics.DrawLine(SystemPens.InactiveBorder, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom); } if (ShowLines && !IsCategoryNode(node)) { DrawLines(e.Graphics, node, rowRect); } if (IsCategoryNode(node)) { DrawCategoryTitleUnderline(node.Tree, context, rowRect); } DrawNode(node, context); }
public TreeViewAdvCancelEventArgs(TreeNodeAdv node) : base(node) { }
private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect) { TreeNodeAdv node = RowMap[row]; if (node.IsHidden) { return; } context.DrawSelection = DrawSelectionMode.None; context.CurrentEditorOwner = CurrentEditorOwner; if (DragMode) { if ((_dropPosition.Node == node) && _dropPosition.Position == NodePosition.Inside && HighlightDropPosition) { context.DrawSelection = DrawSelectionMode.Active; } } else { if (node.IsSelected && (Focused || !InactiveSelection)) { context.DrawSelection = DrawSelectionMode.Active; } else if (node.IsSelected && !Focused && !HideSelection) { context.DrawSelection = DrawSelectionMode.Inactive; } } context.DrawFocus = Focused && CurrentNode == node; OnRowDraw(e, node, context, row, rowRect); if (FullRowSelect) { context.DrawFocus = false; if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive) { Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, ClientRectangle.Width, rowRect.Height); if (context.DrawSelection == DrawSelectionMode.Active) { e.Graphics.FillRectangle(new SolidBrush(_fullRowSelectActiveColor), focusRect); context.DrawSelection = DrawSelectionMode.FullRowSelect; } else { e.Graphics.FillRectangle(new SolidBrush(_fullRowSelectInactiveColor), focusRect); context.DrawSelection = DrawSelectionMode.None; } } } if ((GridLineStyle & GridLineStyle.Horizontal) == GridLineStyle.Horizontal) { e.Graphics.DrawLine(SystemPens.InactiveBorder, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom); } if (ShowLines) { DrawLines(e.Graphics, node, rowRect); } DrawNode(node, context); }
public string GenerateParameterUpdate(Aga.Controls.Tree.TreeNodeAdv table) { throw new NotImplementedException(); }
internal IEnumerable <NodeControlInfo> GetNodeControls(TreeNodeAdv node, Rectangle rowRect) { if (node == null) { yield break; } int y = rowRect.Y; int x = (node.Level - 1) * _indent + LeftMargin; int width; Rectangle rect; if (ShowPlusMinus) { width = _plusMinus.GetActualSize(node, _measureContext).Width; rect = new Rectangle(x, y, width, rowRect.Height); if (this.Columns.Count > 0 && this.Columns[0].Width < rect.Right) { rect.Width = this.Columns[0].Width - x; } yield return(new NodeControlInfo(_plusMinus, rect, node)); x += width; } int right = 0; foreach (TreeColumn col in this.Columns) { if (!col.IsVisible || col.Width <= 0) { continue; } right += col.Width; for (int i = 0; i < this.NodeControls.Count; i++) { NodeControl nc = this.NodeControls[i]; if (nc.ParentColumn != col) { continue; } Size s = nc.GetActualSize(node, _measureContext); if (s.IsEmpty) { continue; } bool isLastControl = true; for (int k = i + 1; k < this.NodeControls.Count; k++) { if (this.NodeControls[k].ParentColumn == col) { isLastControl = false; break; } } width = right - x; if (!isLastControl) { width = s.Width; } int maxWidth = Math.Max(0, right - x); rect = new Rectangle(x, y, Math.Min(maxWidth, width), rowRect.Height); x += width; yield return(new NodeControlInfo(nc, rect, node)); } x = right; } }
public TreeViewAdvEventArgs(TreeNodeAdv node) { _node = node; }