namespace UIWidgets.Examples
{
using System;
using UnityEngine;
///
/// TrackDataView.
///
public class TrackDataView : TrackDataViewBase
{
///
/// Drag component.
///
[SerializeField]
public TrackDataDragSupport Drag;
///
/// Name.
///
[SerializeField]
public TextAdapter Name;
///
/// Add listeners.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "HAA0603:Delegate allocation from a method group", Justification = "Required")]
protected override void AddListeners()
{
base.AddListeners();
if (Drag != null)
{
Drag.StartDragEvent.AddListener(DisableResizable);
Drag.EndDragEvent.AddListener(EnableResizable);
}
}
///
/// Remove listeners.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "HAA0603:Delegate allocation from a method group", Justification = "Required")]
protected override void RemoveListeners()
{
base.RemoveListeners();
if (Drag != null)
{
Drag.StartDragEvent.RemoveListener(DisableResizable);
Drag.EndDragEvent.RemoveListener(EnableResizable);
}
}
///
/// Set data.
///
/// Track.
/// Data.
/// Base vertical position.
public override void SetData(Track track, TrackData data, float baseVerticalPostion)
{
if (Drag != null)
{
Drag.Track = track;
Drag.Owner = Owner;
}
Data = data;
name = data.Name;
Name.Value = data.Name;
SetSizeAndPosition(baseVerticalPostion);
}
}
}