using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.IO;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Barotrauma;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using System.Xml;
using System.Xml.Linq;
namespace QICrabUI
{
public class CommandAttribute : System.Attribute { }
///
/// Can be dispatched up the component tree to notify parent about something
/// add pass some event data without creating a hard link
///
///
public record CUICommand(string Name, object Data = null);
///
/// Can be dispatched down the component tree to pass some data to the children
/// without creating a hard link
///
public record CUIData(string Name, object Data = null);
public partial class CUIComponent
{
private void SetupCommands()
{
// This is actually expensive
//AddCommands();
OnTreeChanged += UpdateDataTargets;
}
///
/// This command will be dispatched up when some component specific event happens
///
[CUISerializable] public string Command { get; set; }
///
/// this will be executed on any command
///
public event Action OnAnyCommand;
///
/// Will be executed when receiving any data
///
public event Action OnAnyData;
///
/// Happens when appropriate data is received
///
public event Action