Class StructureEditor<T>
- Namespace
- NanoByte.StructureEditor.WinForms
- Assembly
- NanoByte.StructureEditor.WinForms.dll
An editor for hierarchical structures.
public class StructureEditor<T> : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IStructureEditor<T> where T : class, IEquatable<T>
Type Parameters
TThe type of object to edit.
- Inheritance
-
objectStructureEditor<T>
- Implements
- Inherited Members
Remarks
Derive and call DescribeRoot(string) or DescribeRoot<TEditor>(string) as well as Describe<TContainer>() in the constructor.
Constructors
StructureEditor()
Creates a new structure editor for a T with a parameterless constructor.
public StructureEditor()
StructureEditor(Func<T>)
Creates a new structure editor.
public StructureEditor(Func<T> factory)
Parameters
factoryFunc<T>Callback to create a new instance of
T.
Properties
CommandManager
Holds the object being edited and manages undo/redo operations on it.
public ICommandManager<T> CommandManager { get; }
Property Value
Methods
DescribeRoot(string)
Sets up handling for the root element with a generic editor.
public IContainerDescription<T> DescribeRoot(string name)
Parameters
namestringThe name of the root element.
Returns
- IContainerDescription<T>
The ContainerDescription<TContainer> for use in a "Fluent API" style.
DescribeRoot<TEditor>(string)
Sets up handling for the root element with a custom editor.
public IContainerDescription<T> DescribeRoot<TEditor>(string name) where TEditor : INodeEditor<T>, new()
Parameters
namestringThe name of the root element.
Returns
- IContainerDescription<T>
The ContainerDescription<TContainer> for use in a "Fluent API" style.
Type Parameters
TEditorAn editor for modifying the content of the root.
Describe<TContainer>()
Adds a ContainerDescription<TContainer> used to describe the structure of the data being edited.
public IContainerDescription<TContainer> Describe<TContainer>() where TContainer : class
Returns
- IContainerDescription<TContainer>
The ContainerDescription<TContainer> for use in a "Fluent API" style.
Type Parameters
TContainerThe type of the container to describe.
Dispose(bool)
Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
GetSerialized()
Returns the serialized representation of the selected NanoByte.StructureEditor.WinForms.StructureTreeNode.
protected virtual string GetSerialized()
Returns
Open(ICommandManager<T>)
Opens an object for editing using the specified ICommandManager<T>.
public void Open(ICommandManager<T> commandManager)
Parameters
commandManagerICommandManager<T>Holds the object being edited and manages undo/redo operations on it.
Redo()
Redoes the last action.
public void Redo()
Remove()
Removes the currently selected entry.
public void Remove()
Undo()
Undoes the last action.
public void Undo()