/// <summary> /// Set control display options /// </summary> protected sealed override Control SetTreeControlDisplayOptions(VirtualTreeControl treeControl) { treeControl.HasRootLines = false; treeControl.HasLines = false; treeControl.ImageList = ResourceStrings.SurveyTreeImageList; return(null); }
private void DiagramsList_SelectionChanged(object sender, EventArgs e) { bool upEnabled = false; bool downEnabled = false; VirtualTreeControl treeControl = DiagramsList; int lastItem = treeControl.Tree.VisibleItemCount - 1; if (treeControl.SelectedItemCount != 0) { upEnabled = true; downEnabled = true; ColumnItemEnumerator selectionIter = treeControl.CreateSelectedItemEnumerator(); while (selectionIter.MoveNext()) { int row = selectionIter.RowInTree; if (row == 0) { upEnabled = false; } if (row == lastItem) { downEnabled = false; } } } UpButton.Enabled = upEnabled; DownButton.Enabled = downEnabled; }
/// <summary> /// Default constructor /// </summary> public CustomReferenceModeEditor(IServiceProvider serviceProvider) { VirtualTreeControl tree = this.myTree = new CustomVirtualTreeControl(serviceProvider); this.SuspendLayout(); // // myTree // tree.Dock = DockStyle.Fill; tree.HasGridLines = true; tree.HasLines = false; tree.HasRootLines = false; tree.IsDragSource = false; tree.LabelEditSupport = VirtualTreeLabelEditActivationStyles.Explicit | VirtualTreeLabelEditActivationStyles.Delayed | VirtualTreeLabelEditActivationStyles.ImmediateSelection; tree.MultiColumnHighlight = true; tree.Name = "myTree"; tree.TabIndex = 0; // // CustomReferenceModeEditor // this.Controls.Add(tree); this.Name = "CustomReferenceModeEditor"; this.Size = new System.Drawing.Size(313, 329); this.ResumeLayout(false); tree.SetColumnHeaders(new VirtualTreeColumnHeader[]{ new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorNameColumn), new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorKindColumn), new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorFormatStringColumn)} , true); MultiColumnTree treeData = new StandardMultiColumnTree(3); ((ITree)treeData).Root = myHeaders = new ReferenceModeHeaderBranch(); tree.MultiColumnTree = (IMultiColumnTree)treeData; }
private static void CreateRootTree(IList<MemberInfo> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { parameterTreeView.MultiColumnTree = new MultiColumnTree(3); ITree tree = (ITree)parameterTreeView.MultiColumnTree; OperationParameterTree operationParameterTree = new OperationParameterTree(3, tree, parameterTreeView, parameters, readOnly, null); tree.Root = operationParameterTree; }
private static void CreateRootTree(IList <MemberInfo> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { parameterTreeView.MultiColumnTree = new MultiColumnTree(3); ITree tree = (ITree)parameterTreeView.MultiColumnTree; OperationParameterTree operationParameterTree = new OperationParameterTree(3, tree, parameterTreeView, parameters, readOnly, null); tree.Root = operationParameterTree; }
/// <summary> /// Select a value in the provided tree control. If overriden, /// this method should expand the control.Tree to the appropriate /// state and set the CurrentColumn and CurrentIndex properties on the control. /// The default behavior defers to VirtualTreeControl.SelectObject. /// Failing to initialize the selection can result in modifications /// made to the check state of a control to be ignored. See <see cref="AlwaysTranslateToValue"/> /// for additional information. /// </summary> /// <param name="value">The initial value</param> /// <param name="control">The dropped down tree control</param> protected virtual void SelectInitialValue(object value, VirtualTreeControl control) { IBranch branch = control.Tree.Root; if (0 != (branch.Features & BranchFeatures.PositionTracking)) { control.SelectObject(null, value, (int)ObjectStyle.TrackingObject, 0); } }
/// <summary> /// Selects an initial single value /// </summary> protected override void SelectInitialValue(object value, VirtualTreeControl control) { int index = ((RingTypeBranch)control.Tree.Root).GetIndexOfSingleValue((RingConstraintType)value); if (index != -1) { control.CurrentIndex = index; } }
public OperationParameterTree(int columnCount, ITree virtualTree, VirtualTreeControl virtualTreeControl, IList <MemberInfo> parameters, bool readOnly, OperationParameterTree parent) { m_ColumnCount = columnCount; m_VirtualTree = virtualTree; m_VirtualTreeControl = virtualTreeControl; m_Parameters = parameters; m_ReadOnly = readOnly; m_Parent = parent; m_Children = new OperationParameterTree[parameters.Count]; }
public OperationParameterTree(int columnCount, ITree virtualTree, VirtualTreeControl virtualTreeControl, IList<MemberInfo> parameters, bool readOnly, OperationParameterTree parent) { m_ColumnCount = columnCount; m_VirtualTree = virtualTree; m_VirtualTreeControl = virtualTreeControl; m_Parameters = parameters; m_ReadOnly = readOnly; m_Parent = parent; m_Children = new OperationParameterTree[parameters.Count]; }
private static void ExpandTree(IList<MemberInfo> parameters, VirtualTreeControl parameterTreeView) { for (int i = 0; i < parameters.Count; i++) { int row = parameters.Count - i - 1; if (parameterTreeView.Tree.IsExpandable(row, 0)) { parameterTreeView.Tree.ToggleExpansion(row, 0); } } }
private static void ExpandTree(IList <MemberInfo> parameters, VirtualTreeControl parameterTreeView) { for (int i = 0; i < parameters.Count; i++) { int row = parameters.Count - i - 1; if (parameterTreeView.Tree.IsExpandable(row, 0)) { parameterTreeView.Tree.ToggleExpansion(row, 0); } } }
public Branch(DebugOutputManager manager, VirtualTreeControl parent) { _manager = manager; _manager.OutputReceived += delegate { parent.Invoke(new Action(delegate { BranchModified(BranchModificationEventArgs.InsertItems(this, VisibleItemCount - 2, 1)); })); }; }
private void DiagramOrderDialog_Load(object sender, EventArgs e) { if (LastFormSize != Size.Empty) { Size = LastFormSize; } ITree tree = new VirtualTree(); tree.Root = new DiagramBranch(this); VirtualTreeControl treeControl = DiagramsList; treeControl.Tree = tree; int selectIndex; if (-1 != (selectIndex = myInitialSelectionIndex)) { treeControl.CurrentIndex = selectIndex; } treeControl.Select(); }
/// <summary> /// Select the kind column, activate the edit control, and /// open the dropdown. Implemented as a delayed event so we /// can call it indirectly from CommitLabelEdit. /// </summary> /// <param name="sender">VirtualTreeControl</param> /// <param name="e">EventArgs</param> private static void DelayActivateKindDropdown(object sender, EventArgs e) { VirtualTreeControl control = (VirtualTreeControl)sender; Debug.Assert(!control.InLabelEdit); // Fires after a CommitLabelEdit, the control will be closed // We only care on the first call control.LabelEditControlChanged -= new EventHandler(DelayActivateKindDropdown); // Select the correct column, launch the label edit control, then // activate it by opening the dropdown control.CurrentColumn = (int)Columns.ReferenceModeKind; control.BeginLabelEdit(); if (control.InLabelEdit) { TypeEditorHost hostControl = control.LabelEditControl as TypeEditorHost; if (hostControl != null) { hostControl.OpenDropDown(); } } }
/// <summary> /// Initializes a new instance of <see cref="SurveyTreeContainer"/>. /// </summary> public SurveyTreeContainer() { this.myTreeControl = new StandardVirtualTreeControl(); this.SuspendLayout(); // // myTreeControl // this.myTreeControl.AllowDrop = true; this.myTreeControl.Dock = DockStyle.Fill; this.myTreeControl.LabelEditSupport = VirtualTreeLabelEditActivationStyles.Delayed | VirtualTreeLabelEditActivationStyles.Explicit | VirtualTreeLabelEditActivationStyles.ImmediateMouse | VirtualTreeLabelEditActivationStyles.ImmediateSelection; this.myTreeControl.Name = "myTreeControl"; this.myTreeControl.TabIndex = 0; #if VISUALSTUDIO_9_0 // MSBUG: Hack workaround crashing bug in VirtualTreeControl.OnToggleExpansion this.myTreeControl.ColumnPermutation = new ColumnPermutation(1, new int[] { 0 }, false); #endif // // SurveyTreeControl // this.Controls.Add(this.myTreeControl); this.Name = "SurveyTreeContainer"; this.ResumeLayout(false); }
internal static string GetAccessibleObjectName(VirtualTreeControl parent) { var treeControl = parent; if (treeControl != null) { var headers = treeControl.GetColumnHeaders(); // Fix for 332947 - Exception thrown when trying to in-place edit a resource name with JAWS running // v-matbir 7/28/04 if (headers != null) { var currentColumn = treeControl.CurrentColumn; Debug.Assert(currentColumn >= 0 && currentColumn < headers.Length, "column index out of range"); if (currentColumn >= 0 && currentColumn < headers.Length) { return(headers[currentColumn].Text); } } } return(string.Empty); }
/// <summary> /// Initializes a new instance of <see cref="SurveyTreeContainer"/>. /// </summary> public SurveyTreeContainer() { this.myTreeControl = new StandardVirtualTreeControl(); this.SuspendLayout(); // // myTreeControl // this.myTreeControl.AllowDrop = true; this.myTreeControl.Dock = DockStyle.Fill; this.myTreeControl.LabelEditSupport = VirtualTreeLabelEditActivationStyles.Delayed | VirtualTreeLabelEditActivationStyles.Explicit | VirtualTreeLabelEditActivationStyles.ImmediateMouse | VirtualTreeLabelEditActivationStyles.ImmediateSelection; this.myTreeControl.Name = "myTreeControl"; this.myTreeControl.TabIndex = 0; #if VISUALSTUDIO_9_0 // MSBUG: Hack workaround crashing bug in VirtualTreeControl.OnToggleExpansion this.myTreeControl.ColumnPermutation = new ColumnPermutation(1, new int[]{0}, false); #endif // // SurveyTreeControl // this.Controls.Add(this.myTreeControl); this.Name = "SurveyTreeContainer"; this.ResumeLayout(false); }
/// <summary> /// Default constructor /// </summary> public CustomReferenceModeEditor(IServiceProvider serviceProvider) { VirtualTreeControl tree = this.myTree = new CustomVirtualTreeControl(serviceProvider); this.SuspendLayout(); // // myTree // tree.Dock = DockStyle.Fill; tree.HasGridLines = true; tree.HasLines = false; tree.HasRootLines = false; tree.IsDragSource = false; tree.LabelEditSupport = VirtualTreeLabelEditActivationStyles.Explicit | VirtualTreeLabelEditActivationStyles.Delayed | VirtualTreeLabelEditActivationStyles.ImmediateSelection; tree.MultiColumnHighlight = true; tree.Name = "myTree"; tree.TabIndex = 0; // // CustomReferenceModeEditor // this.Controls.Add(tree); this.Name = "CustomReferenceModeEditor"; this.Size = new System.Drawing.Size(313, 329); this.ResumeLayout(false); tree.SetColumnHeaders(new VirtualTreeColumnHeader[] { new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorNameColumn), new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorKindColumn), new VirtualTreeColumnHeader(ResourceStrings.ModelReferenceModeEditorFormatStringColumn) } , true); MultiColumnTree treeData = new StandardMultiColumnTree(3); ((ITree)treeData).Root = myHeaders = new ReferenceModeHeaderBranch(); tree.MultiColumnTree = (IMultiColumnTree)treeData; }
LabelEditResult IBranch.CommitLabelEdit(int row, int column, string newText) { newText = newText.Trim(); IORMToolServices toolServices = (IORMToolServices)myStore; toolServices.AutomatedElementFilter += FilterAllElements; try { if (row < myCustomReferenceModesList.Count) { switch ((Columns)column) { case Columns.Name: string changeNameTransaction = ResourceStrings.ModelReferenceModeEditorChangeNameTransaction; using (Transaction t = myStore.TransactionManager.BeginTransaction(changeNameTransaction)) { if (newText.Length != 0) { myCustomReferenceModesList[row].Name = newText; } else { myCustomReferenceModesList[row].Delete(); } if (t.HasPendingChanges) { t.Commit(); } } break; case Columns.FormatString: using (Transaction t = myStore.TransactionManager.BeginTransaction(ResourceStrings.ModelReferenceModeEditorChangeFormatStringTransaction)) { myCustomReferenceModesList[row].CustomFormatString = UglyFormatString(newText); if (t.HasPendingChanges) { t.Commit(); } } break; case Columns.ReferenceModeKind: break; } } else { bool success = false; using (Transaction t = myStore.TransactionManager.BeginTransaction(ResourceStrings.ModelReferenceModeEditorAddCustomReferenceModeTransaction)) { new CustomReferenceMode(this.myStore, new PropertyAssignment(CustomReferenceMode.NameDomainPropertyId, newText)).Model = this.myModel; // Note that the Kind is automatically set to General on Commit if (t.HasPendingChanges) { try { myIDidIt = true; t.Commit(); success = true; } finally { myIDidIt = false; } } } if (success) { // We want to activate the kind dropdown for the new row. // However, if we begin a label edit now before the current // one is finished, then the control gets really confused, so // we wait until the control is officially done--it will tell us // via an event--so we can open the new dropdown. VirtualTreeControl control = ORMDesignerPackage.ReferenceModeEditorWindow.TreeControl; control.LabelEditControlChanged += new EventHandler(DelayActivateKindDropdown); } } } finally { toolServices.AutomatedElementFilter -= FilterAllElements; } return(LabelEditResult.AcceptEdit); }
private static void PopulateTree(IList<MemberInfo> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { CreateRootTree(parameters, parameterTreeView, readOnly); ExpandTree(parameters, parameterTreeView); }
private static void PopulateTree(IList <MemberInfo> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { CreateRootTree(parameters, parameterTreeView, readOnly); ExpandTree(parameters, parameterTreeView); }
private static void PopulateTree(IEnumerable<Parameter> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { PopulateTree(parameters.Cast<Member>().ToList(), parameterTreeView, readOnly); }
private static void PopulateTree(IEnumerable<Member> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { PopulateTree(parameters.Select(x => new MemberInfo { Member = x }).ToList(), parameterTreeView, readOnly); }
/// <summary> /// Turn off the line display in the tree control /// </summary> protected override Control SetTreeControlDisplayOptions(VirtualTreeControl treeControl) { treeControl.HasLines = false; treeControl.HasRootButtons = false; return(null); }
private static void PopulateTree(IEnumerable <Parameter> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { PopulateTree(parameters.Cast <Member>().ToList(), parameterTreeView, readOnly); }
private static void PopulateTree(IEnumerable <Member> parameters, VirtualTreeControl parameterTreeView, bool readOnly) { PopulateTree(parameters.Select(x => new MemberInfo { Member = x }).ToList(), parameterTreeView, readOnly); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.inputControl = new Microsoft.VisualStudio.VirtualTreeGrid.VirtualTreeControl(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); this.btnInvoke = new System.Windows.Forms.Button(); this.outputControl = new Microsoft.VisualStudio.VirtualTreeGrid.VirtualTreeControl(); this.panel3 = new System.Windows.Forms.Panel(); this.label2 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // inputControl // this.inputControl.Dock = System.Windows.Forms.DockStyle.Fill; this.inputControl.EnableExplorerTheme = true; this.inputControl.HasGridLines = true; this.inputControl.HasHorizontalGridLines = true; this.inputControl.HasLines = false; this.inputControl.HasRootLines = false; this.inputControl.HasVerticalGridLines = true; this.inputControl.LabelEditSupport = Microsoft.VisualStudio.VirtualTreeGrid.VirtualTreeLabelEditActivationStyles.ImmediateSelection; this.inputControl.Location = new System.Drawing.Point(0, 30); this.inputControl.Name = "inputControl"; this.inputControl.Size = new System.Drawing.Size(562, 142); this.inputControl.TabIndex = 2; this.inputControl.Text = "virtualTreeControl1"; // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.inputControl); this.splitContainer1.Panel1.Controls.Add(this.panel1); this.splitContainer1.Panel1.Controls.Add(this.panel2); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.outputControl); this.splitContainer1.Panel2.Controls.Add(this.panel3); this.splitContainer1.Size = new System.Drawing.Size(562, 398); this.splitContainer1.SplitterDistance = 199; this.splitContainer1.TabIndex = 3; // // panel1 // this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(562, 30); this.panel1.TabIndex = 1; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(60, 13); this.label1.TabIndex = 0; this.label1.Text = "Parameters"; // // panel2 // this.panel2.Controls.Add(this.btnInvoke); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel2.Location = new System.Drawing.Point(0, 172); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(562, 27); this.panel2.TabIndex = 4; // // btnInvoke // this.btnInvoke.Dock = System.Windows.Forms.DockStyle.Right; this.btnInvoke.Location = new System.Drawing.Point(487, 0); this.btnInvoke.Name = "btnInvoke"; this.btnInvoke.Size = new System.Drawing.Size(75, 27); this.btnInvoke.TabIndex = 0; this.btnInvoke.Text = "Invoke"; this.btnInvoke.UseVisualStyleBackColor = true; this.btnInvoke.Click += new System.EventHandler(this.btnInvoke_Click); // // outputControl // this.outputControl.Dock = System.Windows.Forms.DockStyle.Fill; this.outputControl.EnableExplorerTheme = true; this.outputControl.HasLines = false; this.outputControl.HasRootLines = false; this.inputControl.HasGridLines = true; this.inputControl.HasVerticalGridLines = true; this.inputControl.LabelEditSupport = Microsoft.VisualStudio.VirtualTreeGrid.VirtualTreeLabelEditActivationStyles.ImmediateSelection; this.outputControl.Location = new System.Drawing.Point(0, 28); this.outputControl.Name = "outputControl"; this.outputControl.Size = new System.Drawing.Size(562, 167); this.outputControl.TabIndex = 1; this.outputControl.Text = "virtualTreeControl1"; // // panel3 // this.panel3.Controls.Add(this.label2); this.panel3.Dock = System.Windows.Forms.DockStyle.Top; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(562, 28); this.panel3.TabIndex = 0; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(4, 7); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(37, 13); this.label2.TabIndex = 0; this.label2.Text = "Result"; // // OperationInvokerUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); this.Name = "OperationInvokerUserControl"; this.Size = new System.Drawing.Size(562, 398); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.ResumeLayout(false); }
public static void InitializeHeaders(VirtualTreeControl control) { control.SetColumnHeaders(new VirtualTreeColumnHeader[] { new VirtualTreeColumnHeader("Change"), new VirtualTreeColumnHeader("Details (1)"), new VirtualTreeColumnHeader("Details (2)"), new VirtualTreeColumnHeader("", 36, true), new VirtualTreeColumnHeader("Partition"), new VirtualTreeColumnHeader("ChangeSource"), new VirtualTreeColumnHeader("DomainModel"), new VirtualTreeColumnHeader("DomainClass"), new VirtualTreeColumnHeader("ElementId"), }, true); control.ColumnPermutation = new ColumnPermutation( (int)ColumnContent.Count, new int[]{ (int)ColumnContent.Index, (int)ColumnContent.Partition, (int)ColumnContent.ChangeSource, (int)ColumnContent.Model, (int)ColumnContent.Class, (int)ColumnContent.Id, (int)ColumnContent.ChangeType, (int)ColumnContent.Detail1, (int)ColumnContent.Detail2, }, false); }
/// <summary> /// Leave the initial selection empty /// </summary> protected override void SelectInitialValue(object value, VirtualTreeControl control) { // Nothing to do, leave it blank }
/// <summary> /// Set display options on the tree control. Changes should be limited to basic display settings /// such as root line display. /// </summary> /// <param name="treeControl">A <see cref="VirtualTreeControl"/></param> protected virtual Control SetTreeControlDisplayOptions(VirtualTreeControl treeControl) { // Empty default implementation return(null); }