Adding SoundGraphDisplay and SensorFrontView classes.
They were respectively based on SystemTray and SensorNotifyIcon.
SoundGraphDisplay is now able to load iMONDisplay.dll providing it lives on your PATH.
Adding option to sensor context menu for adding it into FrontView.
2 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
5 using System.Windows.Forms;
8 namespace Aga.Controls.Tree
12 #region NodeCollection
14 private class NodeCollection : Collection<Node>
18 public NodeCollection(Node owner)
23 protected override void ClearItems()
25 while (this.Count != 0)
26 this.RemoveAt(this.Count - 1);
29 protected override void InsertItem(int index, Node item)
32 throw new ArgumentNullException("item");
34 if (item.Parent != _owner)
36 if (item.Parent != null)
37 item.Parent.Nodes.Remove(item);
38 item._parent = _owner;
40 for (int i = index; i < Count; i++)
42 base.InsertItem(index, item);
44 TreeModel model = _owner.FindModel();
46 model.OnNodeInserted(_owner, index, item);
50 protected override void RemoveItem(int index)
52 Node item = this[index];
55 for (int i = index + 1; i < Count; i++)
57 base.RemoveItem(index);
59 TreeModel model = _owner.FindModel();
61 model.OnNodeRemoved(_owner, index, item);
64 protected override void SetItem(int index, Node item)
67 throw new ArgumentNullException("item");
70 InsertItem(index, item);
78 private TreeModel _model;
79 internal TreeModel Model
81 get { return _model; }
82 set { _model = value; }
85 private NodeCollection _nodes;
86 public Collection<Node> Nodes
88 get { return _nodes; }
94 get { return _parent; }
100 _parent.Nodes.Remove(this);
103 value.Nodes.Add(this);
108 private int _index = -1;
117 public Node PreviousNode
123 return _parent.Nodes[index - 1];
134 if (index >= 0 && index < _parent.Nodes.Count - 1)
135 return _parent.Nodes[index + 1];
141 private string _text;
142 public virtual string Text
144 get { return _text; }
155 private CheckState _checkState;
156 public virtual CheckState CheckState
158 get { return _checkState; }
161 if (_checkState != value)
169 private Image _image;
172 get { return _image; }
187 set { _tag = value; }
190 public bool IsChecked
194 return CheckState != CheckState.Unchecked;
199 CheckState = CheckState.Checked;
201 CheckState = CheckState.Unchecked;
205 public virtual bool IsLeaf
220 public Node(string text)
223 _nodes = new NodeCollection(this);
226 public override string ToString()
231 private TreeModel FindModel()
236 if (node.Model != null)
243 protected void NotifyModel()
245 TreeModel model = FindModel();
246 if (model != null && Parent != null)
248 TreePath path = model.GetPath(Parent);
251 TreeModelEventArgs args = new TreeModelEventArgs(path, new int[] { Index }, new object[] { this });
252 model.OnNodesChanged(args);