1
// ItemSource.cs created with MonoDevelop
2
// User: dave at 1:08 AM 8/17/2007
4
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
8
using System.Collections.Generic;
15
public class ItemSource : GCObject
18
public static readonly string DefaultItemSourceName = "";
19
public static readonly string DefaultItemSourceDescription = "";
20
public static readonly string DefaultItemSourceIcon = "";
23
protected IItemSource source;
24
protected List<Item> items;
26
public ItemSource (IItemSource source)
29
throw new ArgumentNullException ();
32
items = new List<Item> ();
33
foreach (IItem item in source.Items) {
34
items.Add (new Item (item));
39
public override string Name {
40
get { return (source.Name == null ? DefaultItemSourceName : source.Name); }
43
public override string Description {
44
get { return (source.Description == null ? DefaultItemSourceDescription : source.Description); }
47
public override string Icon {
48
get { return (source.Icon == null ? DefaultItemSourceIcon : source.Icon); }
51
public bool UpdateItems () {
52
if (source.UpdateItems ()) {
54
items = new List<Item> ();
55
foreach (IItem item in source.Items) {
56
items.Add (new Item (item));
64
public ICollection<Item> Items {
69
get { return enabled; }
70
set { enabled = value; }
73
public override string ToString ()
75
string items_str = GetType().ToString() + " {";
76
foreach (Item item in items) {
77
items_str = String.Format ("{0}\t{1}\n", items_str, item);