using System; using System.Collections; using System.Drawing; using Core.Common.Gui.Swf.Properties; namespace Core.Common.Gui.Swf { /// /// Enumeration of available folder images in the project explorer. /// public enum FolderImageType { None, Input, Output } /// /// Folder item in the a treeview. Provide a caption and a list of child items to get the items rendered in a tree. /// TODO : Improve TreeNodeModelDataWrapper to include a filter for the DataItems and remove this class /// public class TreeFolder { private static readonly Bitmap inputFolderImage = Resources.folder_input; private static readonly Bitmap outputFolderImage = Resources.folder_output; private static readonly Bitmap folderImage = Resources.Folder; /// /// TODO: refactor childItems to be Func[IEnumerable] since it may change after property/collection change /// /// /// /// /// public TreeFolder(object parent, IEnumerable childItems, string text, FolderImageType imageType) { ChildItems = childItems; Text = text; Image = GetImage(imageType); Parent = parent; } public string Text { get; private set; } public Image Image { get; private set; } public virtual IEnumerable ChildItems { get; private set; } /// /// Gets the tree folder parent node. /// /// The parent can be set to null public object Parent { get; private set; } private static Image GetImage(FolderImageType type) { switch (type) { case FolderImageType.Input: return inputFolderImage; case FolderImageType.Output: return outputFolderImage; case FolderImageType.None: return folderImage; } throw new NotImplementedException(); } } }