Table of Contents

Class StructureEditor<T>

Namespace
NanoByte.StructureEditor.EtoForms
Assembly
NanoByte.StructureEditor.EtoForms.dll

An editor for hierarchical structures.

public class StructureEditor<T> : Panel, IHandlerSource, IDisposable, IBindable, IMouseInputSource, IKeyboardInputSource, ICallbackSource, IBindableWidgetContainer, IStructureEditor<T>, IPendingChanges where T : class

Type Parameters

T

The type of object to edit.

Inheritance
object
Widget
BindableWidget
Control
Container
Panel
StructureEditor<T>
Implements
IHandlerSource
IBindable
IMouseInputSource
IKeyboardInputSource
ICallbackSource
IBindableWidgetContainer
Inherited Members
Panel.Remove(Control)
Panel.Controls
Panel.Padding
Panel.MinimumSize
Panel.ContextMenu
Panel.Content
Container.RemoveAll()
Container.RemoveParent(Control)
Container.SetLogicalParent(Control)
Container.RemoveLogicalParent(Control)
Container.ClientSize
Container.Children
Container.VisualChildren
Container.StyleProvider
Container.Styles
Control.SizeChangedEvent
Control.KeyDownEvent
Control.KeyUpEvent
Control.TextInputEvent
Control.MouseDownEvent
Control.MouseUpEvent
Control.MouseMoveEvent
Control.MouseLeaveEvent
Control.MouseEnterEvent
Control.MouseDoubleClickEvent
Control.MouseWheelEvent
Control.GotFocusEvent
Control.LostFocusEvent
Control.ShownEvent
Control.ThemeChangedEvent
Control.DragDropEvent
Control.DragOverEvent
Control.DragEnterEvent
Control.DragLeaveEvent
Control.DragEndEvent
Control.EnabledChangedEvent
Control.OnKeyDown(KeyEventArgs)
Control.OnKeyUp(KeyEventArgs)
Control.OnTextInput(TextInputEventArgs)
Control.OnMouseDown(MouseEventArgs)
Control.OnMouseUp(MouseEventArgs)
Control.OnMouseMove(MouseEventArgs)
Control.OnMouseLeave(MouseEventArgs)
Control.OnMouseEnter(MouseEventArgs)
Control.OnMouseDoubleClick(MouseEventArgs)
Control.OnMouseWheel(MouseEventArgs)
Control.OnDragDrop(DragEventArgs)
Control.OnDragOver(DragEventArgs)
Control.OnDragEnter(DragEventArgs)
Control.OnDragLeave(DragEventArgs)
Control.OnDragEnd(DragEventArgs)
Control.Invalidate()
Control.Invalidate(Rectangle)
Control.UpdateLayout()
Control.GetPreferredSize()
Control.GetPreferredSize(SizeF)
Control.CaptureMouse()
Control.ReleaseMouseCapture()
Control.Detach()
Control.AttachNative()
Control.DetachNative()
Control.Focus()
Control.SuspendLayout()
Control.ResumeLayout()
Control.PointFromScreen(PointF)
Control.PointToScreen(PointF)
Control.RectangleToScreen(RectangleF)
Control.RectangleFromScreen(RectangleF)
Control.DoDragDrop(DataObject, DragEffects)
Control.DoDragDrop(DataObject, DragEffects, Image, PointF)
Control.TriggerStyleChanged()
Control.OnApplyCascadingStyles()
Control.Print()
Control.GetCallback()
Control.IsDesignMode
Control.Handler
Control.Gestures
Control.Loaded
Control.VisualControls
Control.Tag
Control.LogicalParent
Control.IsVisualControl
Control.Size
Control.IsMouseCaptured
Control.Width
Control.Height
Control.Enabled
Control.Visible
Control.Parent
Control.VisualParent
Control.IsAttached
Control.BackgroundColor
Control.HasFocus
Control.IsSuspended
Control.ParentWindow
Control.SupportedPlatformCommands
Control.Bounds
Control.Location
Control.Cursor
Control.ToolTip
Control.TabIndex
Control.TabStop
Control.AllowDrop
Control.SizeChanged
Control.KeyDown
Control.KeyUp
Control.TextInput
Control.MouseDown
Control.MouseUp
Control.MouseMove
Control.MouseLeave
Control.MouseEnter
Control.MouseDoubleClick
Control.MouseWheel
Control.GotFocus
Control.LostFocus
Control.Shown
Control.ThemeChanged
Control.PreLoad
Control.Load
Control.LoadComplete
Control.UnLoad
Control.DragDrop
Control.DragOver
Control.DragEnter
Control.DragLeave
Control.DragEnd
Control.EnabledChanged
BindableWidget.Unbind()
BindableWidget.UpdateBindings(BindingUpdateMode)
BindableWidget.Parents
BindableWidget.DataContext
BindableWidget.Bindings
BindableWidget.IsDataContextChanging
BindableWidget.DataContextChanged
Widget.Initialize()
Widget.Dispose()
Widget.ToString()
Widget.Platform
Widget.NativeHandle
Widget.Properties
Widget.ID
Widget.Style
Widget.ControlObject
Widget.IsDisposed
Widget.StyleChanged

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

factory Func<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

ICommandManager<T>

SelectedTarget

The target object of the currently selected node; null if nothing is selected.

public object? SelectedTarget { get; }

Property Value

object

Serializer

The serializer used for the text representation of the selected node. Defaults to XmlStructureSerializer.

public IStructureSerializer Serializer { get; set; }

Property Value

IStructureSerializer

Remarks

Set automatically by Open(ICommandManager<T>) when passed a SerializingCommandManager<T>.

Methods

CommitPendingChanges()

Applies any user input in the node editor or text editor that has not been applied yet (e.g., because the control still has focus).

public void CommitPendingChanges()

Remarks

Call this before reading or saving the CommandManager's target.

DescribeRoot(string)

Sets up handling for the root element with a generic editor.

public IContainerDescription<T> DescribeRoot(string name)

Parameters

name string

The 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

name string

The name of the root element.

Returns

IContainerDescription<T>

The ContainerDescription<TContainer> for use in a "Fluent API" style.

Type Parameters

TEditor

An 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

TContainer

The type of the container to describe.

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

Open(ICommandManager<T>)

Opens an object for editing using the specified ICommandManager<T>.

public void Open(ICommandManager<T> commandManager)

Parameters

commandManager ICommandManager<T>

Holds the object being edited and manages undo/redo operations on it. If this is a SerializingCommandManager<T> its Serializer is also applied to Serializer.

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()

Events

SelectionChanged

Raised when the selected node in the tree changes.

public event EventHandler<EventArgs>? SelectionChanged

Event Type

EventHandler<EventArgs>