using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Drawing;
namespace ST.Library.UI.NodeEditor
{
public enum ConnectionStatus
{
///
/// No owner exists
///
[Description("No owner exists")]
NoOwner,
///
/// same owner
///
[Description("same owner")]
SameOwner,
///
/// Both are input or output options
///
[Description("both input or output options")]
SameInputOrOutput,
///
/// Different data types
///
[Description("Different data types")]
ErrorType,
///
/// Single connection node
///
[Description("Single connection node")]
SingleOption,
///
/// A circular path appears
///
[Description("A circular path appears")]
Loop,
///
/// Existing connection
///
[Description("existing connection")]
Exists,
///
/// blank options
///
[Description("Blank option")]
EmptyOption,
///
/// already connected
///
[Description("Connected")]
Connected,
///
/// The connection is disconnected
///
[Description("The connection was disconnected")]
DisConnected,
///
/// Node is locked
///
[Description("Node is locked")]
Locked,
///
/// Operation rejected
///
[Description("Operation denied")]
Reject,
///
/// is being connected
///
[Description("being connected")]
Connecting,
///
/// Disconnecting
///
[Description("Disconnecting")]
DisConnecting
}
public enum AlertLocation
{
Left,
Top,
Right,
Bottom,
Center,
LeftTop,
RightTop,
RightBottom,
LeftBottom,
}
public struct DrawingTools
{
public Graphics Graphics;
public Pen Pen;
public SolidBrush SolidBrush;
}
public enum CanvasMoveArgs //View the parameters needed when moving the canvas ->MoveCanvas()
{
Left = 1, //indicates that only the X coordinate is moved
Top = 2, //Indicates that only the Y coordinate is moved
All = 4 //Indicates that XY move at the same time
}
public struct NodeFindInfo
{
public STNode Node;
public STNodeOption NodeOption;
public string Mark;
public string[] MarkLines;
}
public struct ConnectionInfo
{
public STNodeOption Input;
public STNodeOption Output;
}
public delegate void STNodeOptionEventHandler(object sender, STNodeOptionEventArgs e);
public class STNodeOptionEventArgs : EventArgs
{
private STNodeOption _TargetOption;
///
/// The corresponding Option that triggers this event
///
public STNodeOption TargetOption {
get { return _TargetOption; }
}
private ConnectionStatus _Status;
///
/// Connection status between Option
///
public ConnectionStatus Status {
get { return _Status; }
internal set { _Status = value; }
}
private bool _IsSponsor;
///
/// Whether it is the initiator of this behavior
///
public bool IsSponsor {
get { return _IsSponsor; }
}
public STNodeOptionEventArgs(bool isSponsor, STNodeOption opTarget, ConnectionStatus cr) {
this._IsSponsor = isSponsor;
this._TargetOption = opTarget;
this._Status = cr;
}
}
public delegate void STNodeEditorEventHandler(object sender, STNodeEditorEventArgs e);
public delegate void STNodeEditorOptionEventHandler(object sender, STNodeEditorOptionEventArgs e);
public class STNodeEditorEventArgs : EventArgs
{
private STNode _Node;
public STNode Node {
get { return _Node; }
}
public STNodeEditorEventArgs(STNode node) {
this._Node = node;
}
}
public class STNodeEditorOptionEventArgs : STNodeOptionEventArgs
{
private STNodeOption _CurrentOption;
///
/// Option to actively trigger events
///
public STNodeOption CurrentOption {
get { return _CurrentOption; }
}
private bool _Continue = true;
///
/// Whether to continue the downward operation for Begin(Connecting/DisConnecting) whether to continue the backward operation
///
public bool Continue {
get { return _Continue; }
set { _Continue = value; }
}
public STNodeEditorOptionEventArgs(STNodeOption opTarget, STNodeOption opCurrent, ConnectionStatus cr)
: base(false, opTarget, cr) {
this._CurrentOption = opCurrent;
}
}
}