21 public List<TreeViewNode>
Nodes {
40 base.MeasureOverride(parentAvailableSize);
65 obj.OnClicked = clickedNode => {
66 if (clickedNode.Nodes.Count > 0) {
72 m_selectedNode.Selected =
false;
74 if (clickedNode.Selectable) {
75 clickedNode.Selected =
true;
81 if (node.
Nodes.Count > 0
107 node.ParentTree =
this;
113 node.ParentTree =
null;
119 node.ParentTree =
null;
124 public void Clear(
bool dispose =
true) {
167 if (value &&
Nodes.Count == 0) {
174 public string Text {
get;
set; }
202 public object Tag {
get;
set; }
228 List<TreeViewNode> children) {
246 new Color(10, 70, 0, 90),
247 new List<TreeViewNode>()
258 new Color(10, 70, 0, 90),
259 new List<TreeViewNode>()
270 new Color(10, 70, 0, 90),
271 new List<TreeViewNode>()
279 public void Remove(
bool dispose =
true) {
293 while (parent !=
null) {
294 parent.Expanded =
true;
302 child.ParentNode =
this;
310 child.ParentTree =
null;
311 child.ParentNode =
null;
347 GC.SuppressFinalize(
this);
371 node.LinkedWidget =
this;
372 XElement node2 =
ContentManager.
Get<XElement>(
"Widgets/TreeViewNodeContentItem");
379 m_selectedHighLight.FillColor =
m_node.SelectedColor;
392 m_node.Expanded = !
m_node.Expanded;
394 m_node.OnClicked?.Invoke();
396 m_icon.IsVisible = m_node.Icon !=
null;
397 if (
m_node.Icon !=
null) {
398 m_icon.Subtexture =
m_node.Subtexture;
399 m_icon.Margin =
m_node.IconMargin;
401 m_selectedHighLight.IsVisible =
m_node.Selected;
static int Max(int x1, int x2)
static object Get(Type type, string name)
Action< TreeViewNode > OnClicked
RectangleWidget m_expandIcon
TreeViewNodeContentItem(TreeViewNode node, float xOffset)
RectangleWidget m_selectedHighLight
Subtexture m_expandIconTexture
ClickableWidget m_clickableWidget
Subtexture m_unexpandIconTexture
void ClearChildren(bool dispose=true)
TreeViewNode(string text, Color textColor, string subText, Color subTextColor, Texture2D icon=null)
TreeViewWidget ParentTree
void Init(string text, Color textColor, string subText, Color subTextColor, Texture2D icon, Color selectedColor, List< TreeViewNode > children)
List< TreeViewNode > m_nodes
void Remove(bool dispose=true)
TreeViewNodeContentItem LinkedWidget
TreeViewNode(string text, string subText, Texture2D icon=null)
List< TreeViewNode > Nodes
void AddChildren(List< TreeViewNode > children)
void RemoveChild(TreeViewNode child, bool dispose=true)
void AddChild(TreeViewNode child)
static readonly Vector2 Zero
static readonly Vector2 One