public TreeDragDropEventArgs(eTreeAction action, Node[] nodes, Node oldParentNode, Node newParentNode, int insertPosition) : base(action, nodes) { this.NewParentNode = newParentNode; this.OldParentNode = oldParentNode; this.InsertPosition = insertPosition; }
/// <summary> /// Adds new object to the collection and provides information about the source of the command /// </summary> /// <param name="node">Node to add</param> /// <param name="action">Source action</param> /// <returns></returns> public override int Add(Node node, eTreeAction action) { if (this.List.Contains(node)) return -1; if (TreeSelectionControl.MultiSelect) { if (TreeSelectionControl.MultiSelectRule == eMultiSelectRule.SameParent && this.Count>0) { if (this[0].Parent != node.Parent) throw new InvalidOperationException("Node being added does not belong to the same parent as currently selected nodes. See AdvTree.MultiSelectRule property"); } if (!SuspendEvents) { AdvTreeNodeCancelEventArgs cancelArgs = new AdvTreeNodeCancelEventArgs(action, node); TreeSelectionControl.InvokeOnBeforeNodeSelect(cancelArgs); if (cancelArgs.Cancel) return -1; } } return base.Add(node, action); }
/// <summary> /// Default constructor. /// </summary> /// <param name="action">Default action</param> /// <param name="node">Default node.</param> public AdvTreeNodeCancelEventArgs(eTreeAction action, Node node):base(action,node) { }
/// <summary> /// Default constructor for event data. /// </summary> /// <param name="action">Type of the action event is raised for.</param> /// <param name="cell">Cell that event is raised for.</param> public TreeGXCellCancelEventArgs(eTreeAction action, Cell cell):base(action,cell) { }
private void SelectPreviousNode(eTreeAction action) { Node node = null; if (this.SelectedNode == null) node = NodeOperations.GetLastVisibleNode(_AdvTree); else node = NodeOperations.GetPreviousVisibleNode(this.SelectedNode); if (node != null && !node.CanSelect) { int counter = 0; while (node != null && counter < 100) { node = NodeOperations.GetPreviousVisibleNode(node); if (node != null && node.CanSelect) break; } } if (node != null) { if (_DataManager != null) { while (node != null && node.DataKey == null) node = NodeOperations.GetNextVisibleNode(node); if (node != null) SelectNode(node, action); } else SelectNode(node, action); } }
/// <summary> /// Adds new object to the collection and provides information about the source of the command /// </summary> /// <param name="node">Node to add</param> /// <param name="action">Source action</param> /// <returns></returns> public virtual int Add(Node node, eTreeAction action) { m_SourceAction = action; return List.Add(node); }
/// <summary> /// Removes specified object from the collection and provides information about source of the command /// </summary> /// <param name="node">Node to remove</param> /// <param name="action">Source action</param> public virtual void Remove(Node node, eTreeAction action) { m_SourceAction = action; List.Remove(node); }
/// <summary> /// Places the node into the editing mode if possible, raises the exception if node is read-only. /// </summary> /// <param name="action">Action that caused the edit mode.</param> /// <param name="focusEditor">Indicates whether to focus the editor.</param> public virtual void EnterEditorMode(eTreeAction action, bool focusEditor) { if (IsEditing) throw new InvalidOperationException("Node is already in edit mode."); if (!Enabled) throw new InvalidOperationException("Node is disabled. Cannot enter edit mode."); if (_IsUsingInlineEditor) { if (_Editor is IPropertyValueEditor) ((IPropertyValueEditor)_Editor).EditValue = PropertyValue; IsEditing = true; if (focusEditor) { if (_Editor is IPropertyValueEditor) ((IPropertyValueEditor)_Editor).FocusEditor(); } EditValueChanged = false; return; } if (_Editor == null) { _Editor = CreateNodeEditor(); TextBoxDropDown editor = _Editor as TextBoxDropDown; if (editor != null) { if (IsPassword) { editor.PasswordChar = AdvPropertyGrid.PasswordChar; editor.Text = GetPropertyTextValue(); } else { editor.PasswordChar = '\0'; editor.Text = this.EditCell.Text; } } else if (_Editor is IPropertyValueEditor) { ((IPropertyValueEditor)_Editor).EditValue = PropertyValue; if (!IsReadOnly) ((Control)_Editor).Enabled = false; } ElementStyle valueChangedStyle = this.ValueChangedStyle; if (this.EditCell.StyleNormal == valueChangedStyle && valueChangedStyle.Font != null) { if (editor != null) editor.TextBox.Font = valueChangedStyle.Font; else if (_Editor is IPropertyValueEditor) ((IPropertyValueEditor)_Editor).EditorFont = valueChangedStyle.Font; } this.EditCell.HostedControl = (Control)_Editor; IsEditing = true; if (focusEditor) { if (editor != null) editor.Focus(); else if (_Editor is IPropertyValueEditor) ((IPropertyValueEditor)_Editor).FocusEditor(); } EditValueChanged = false; } }
/// <summary> /// Called after node has been selected. /// </summary> /// <param name="action">Provides information on how selection was performed</param> protected virtual void OnSelected(eTreeAction action) { }
public void InternalDeselected(eTreeAction action) { OnDeselected(action); }
/// <summary> /// Initializes new instance of CellEditEventArgs class. /// </summary> /// <param name="cell">Reference to Cell this event is raised for.</param> /// <param name="action">Indicates the action that caused the event.</param> /// <param name="newText">Indicates new text of the cell if it applies to given event.</param> public CellEditEventArgs(Cell cell, eTreeAction action, string newText) { this.Action=action; this.Cell=cell; this.NewText=newText; }
public override void EnterEditorMode(eTreeAction action, bool focusEditor) { }
public TreeGXDragDropEventArgs(eTreeAction action, Node node, Node oldParentNode, Node newParentNode):base(action,node) { this.NewParentNode = newParentNode; this.OldParentNode = oldParentNode; }
internal void SetSelected(bool selected, eTreeAction actionSource) { m_Selected = selected; }
/// <summary> /// Invokes <see cref="AdvTree.AfterCheck">AfterCheck</see> event on AdvTree /// control. /// </summary> protected virtual void InvokeAfterCheck(eTreeAction actionSource) { AdvTree tree=this.TreeControl; if(tree!=null) { tree.InvokeAfterCheck(new AdvTreeCellEventArgs(actionSource, this)); } m_ActionSource=eTreeAction.Code; }
protected override void OnExpandChanging(bool expanded, eTreeAction action) { if (expanded) { LoadChildProperties(); } base.OnExpandChanging(expanded, action); }
protected override void OnSelected(eTreeAction action) { if (_IsDisposed || _IsDisposing) return; UpdateDisplayedValue(); AdvTree.AdvTree tree = this.TreeControl; bool focusEditor = false; Point pos = Point.Empty; if (tree != null) { pos = tree.PointToClient(Control.MousePosition); if (this.EditCell.Bounds.Contains(pos)) focusEditor = true; } if (action == eTreeAction.Keyboard && WinApi.HIWORD(WinApi.GetKeyState(9)) != 0) focusEditor = true; if (this.Enabled && (!this.IsReadOnly && CanEditPropertyContent())) { EnterEditorMode(action, focusEditor); if (focusEditor && !pos.IsEmpty && _Editor is TextBoxDropDown) { ((TextBoxDropDown)_Editor).TextBox.SelectAll(); } } AdvPropertyGrid grid = AdvPropertyGrid; if (grid != null) { string description = GetDescriptionAttributeValue(); if (!string.IsNullOrEmpty(description)) { bool replaceNewLineCharacters = false; if (!TextMarkup.MarkupParser.IsMarkup(ref description)) replaceNewLineCharacters = true; description = description.Replace("<", "<"); description = description.Replace(">", ">"); description = "<b>" + this.Text + "</b><br/>" + description; if (replaceNewLineCharacters) description = description.Replace("\n", "<br/>"); } grid.HelpPanel.Text = description; } base.OnSelected(action); }
public void InternalSelected(eTreeAction action) { OnSelected(action); }
/// <summary> /// Inserts new object into the collection. /// </summary> /// <param name="index">Position of the object.</param> /// <param name="value">Object to insert.</param> /// <param name="action">Action that is causing the event</param> public virtual void Insert(int index, Node value, eTreeAction action) { m_SourceAction = action; List.Insert(index, value); }
/// <summary> /// Sets the Checked or CheckState properties. /// </summary> /// <param name="value">New value for checked state.</param> /// <param name="actionSource">Action source.</param> public void SetChecked(bool value, eTreeAction actionSource) { SetChecked(value ? CheckState.Checked : CheckState.Unchecked, actionSource); }
private void NodeInsertComplete(object value) { if (!_PassiveCollection) { Node node = value as Node; if (m_ParentNode != null) { if (node.Parent != null && node.Parent != m_ParentNode) node.Remove(); node.SetParent(m_ParentNode); if (m_ParentNode.NodesColumns.IsSorted) { AdvTree parentTree = m_TreeControl; if (parentTree == null) parentTree = m_ParentNode.TreeControl; if (parentTree != null) parentTree.PushSortRequest(m_ParentNode); } } else { if (node.Parent != null) node.Remove(); else node.InvokeOnParentChanged(); if (m_TreeControl != null && m_TreeControl.Columns.IsSorted) { m_TreeControl.PushSortRequest(); } } node.internalTreeControl = m_TreeControl; if (m_ParentNode != null) m_ParentNode.OnChildNodeInserted(node); else node.SizeChanged = true; AdvTree tree = GetTreeControl(); if (tree != null) tree.InvokeAfterNodeInsert(m_SourceAction, value as Node, m_ParentNode); } m_SourceAction = eTreeAction.Code; }
/// <summary> /// Sets the Checked or CheckState properties. /// </summary> /// <param name="value">New value for checked state.</param> /// <param name="actionSource">Action source.</param> public void SetChecked(CheckState value, eTreeAction actionSource) { m_Cells[0].SetChecked(value, actionSource); }
/// <summary> /// Default constructor. /// </summary> /// <param name="action">Default action</param> /// <param name="node">Default node.</param> public TreeGXNodeEventArgs(eTreeAction action, Node node) { this.Action = action; this.Node = node; }
/// <summary> /// Sets selected cell and provides information on the action that caused the selection change. /// </summary> /// <param name="value">New selected cell.</param> /// <param name="actionSource">Action source.</param> public void SetSelectedCell(Cell value, eTreeAction actionSource) { AdvTree tree = this.TreeControl; if (!this.IsSelected && value != null) { if (tree != null) tree.SelectedNode = this; } Cell previousSelectedCell = null; Cell selectedCell = null; foreach (Cell cell in m_Cells) { if (cell.IsSelected) previousSelectedCell = cell; if (cell == value && cell.CanSelect) { selectedCell = cell; cell.SetSelected(true, actionSource); } else cell.SetSelected(false, actionSource); } if (tree != null) { tree.InvalidateNode(this); if (value == null || previousSelectedCell != null && value != previousSelectedCell) { tree.InvokeCellUnselected(new AdvTreeCellEventArgs(actionSource, previousSelectedCell)); } if (selectedCell != null && previousSelectedCell != selectedCell) { tree.InvokeCellSelected(new AdvTreeCellEventArgs(actionSource, selectedCell)); } } }
private void SelectNode(Node node, eTreeAction action) { _AdvTree.SelectNode(node, action); }
internal void SelectFirstCell(eTreeAction actionSource) { foreach (Cell cell in m_Cells) { if (cell.CanSelect) { this.SetSelectedCell(cell, actionSource); //cell.SetSelected(true); break; } } }
/// <summary> /// Default constructor for event data. /// </summary> /// <param name="action">Type of the action event is raised for.</param> /// <param name="cell">Cell that event is raised for.</param> public TreeGXCellEventArgs(eTreeAction action, Cell cell) { this.Action=action; this.Cell=cell; }
protected override void OnDeselected(eTreeAction action) { if (this.IsEditing) { if (this.EditValueChanged && !IsReadOnly) ApplyEdit(); ExitEditorMode(action); } base.OnDeselected(action); }
/// <summary> /// Default constructor. /// </summary> /// <param name="action">Default action</param> /// <param name="node">Default node.</param> public AdvTreeMultiNodeCancelEventArgs(eTreeAction action, Node[] nodes) : base(action, nodes[0]) { Nodes = nodes; }
/// <summary> /// Exits the editor mode. /// </summary> /// <param name="action">Action that caused the editor mode exit.</param> public virtual void ExitEditorMode(eTreeAction action) { if (!IsEditing) return; Control editor = _Editor as Control; if (!_IsUsingInlineEditor) { _Editor = null; this.EditCell.HostedControl = null; } if (editor is TextBoxDropDown) { TextBoxDropDown editorDropDown = (TextBoxDropDown)editor; if (editorDropDown.IsPopupOpen) editorDropDown.CloseDropDown(); if (editorDropDown.DropDownControl != null && !_UITypeEditorDropDownControl) { Control c = editorDropDown.DropDownControl; editorDropDown.DropDownControl = null; c.Dispose(); } editorDropDown.ButtonCustomClick -= EditorButtonCustomClick; editorDropDown.ButtonDropDownClick -= EditorButtonDropDownClick; editorDropDown.TextBox.KeyDown -= new KeyEventHandler(EditorKeyDown); editorDropDown.TextBox.TextChanged -= new EventHandler(EditorTextChanged); editorDropDown.Dispose(); } else if (editor != null && !_IsUsingInlineEditor) { if(editor is IPropertyValueEditor) ((IPropertyValueEditor)editor).EditValueChanged -= ValueEditorEditValueChanged; editor.Dispose(); } if (_HighlightWorker != null && _HighlightWorker.IsBusy) _HighlightWorker.CancelAsync(); IsEditing = false; }