public TreeIter AddTreeItem(TreeItem item, TreeIter iter)
        {
            var eitem = new EventItem (eitems.Count, item.eventHandler);
            eitems.Add (eitem);

            if (item.type == EntryType.Readonly || item.type == EntryType.Text || item.type == EntryType.LongText || item.type == EntryType.Integer)
            {
                string text;
                bool editable = true;

                text = item.value as string ?? "";
                if (item.value is char)
                    text = item.value.ToString() ?? "";

                editable &= item.type != EntryType.Readonly;

                return AddPropertyTextBox(iter, eitem.id.ToString(), item.label, text, editable);
            }
            else if (item.type == EntryType.Color)
            {
                var c = (Microsoft.Xna.Framework.Color)item.value;

                return AddPropertyColorBox(iter, eitem.id.ToString(), item.label, c.ToString());
            }
            else if (item.type == EntryType.Combo)
            {
                TreeStore model = null;

                foreach (var v in item.comboItems)
                {
                    if (model == null)
                        model = new TreeStore(v.Key.GetType(), v.Value.GetType());
                    model.AppendValues(v.Key, v.Value);
                }

                return AddPropertyComboBox(iter, eitem.id.ToString(), item.label, model, item.value.ToString());
            }
            else if (item.type == EntryType.Check)
            {
                return AddPropertyComboBox(iter, eitem.id.ToString(), item.label, new [] { "True", "False" }, item.value.ToString());
            }
            else if (item.type == EntryType.List)
            {
                var values = (List<string>)item.value;
                string text = "";

                if (values.Count > 0)
                {
                    text = values[0];
                    for (int i = 1; i < values.Count; i++)
                        text += "\r\n" + values[i];
                }

                return AddPropertyCollectionBox(iter, eitem.id.ToString(), item.label, text);
            }
            else if (item.type == EntryType.FilePath)
            {
                string text;

                text = item.value as string ?? "";
                if (item.value is char)
                    text = item.value.ToString() ?? "";

                return AddPropertyFilePathBox (iter, eitem.id.ToString(), item.label, text);
            }
            else 
                return AddPropertyTextBox (iter, eitem.id.ToString (), item.label, "EntryType not Implemented", false);
        }
Beispiel #2
0
        public TreeIter AddTreeItem(TreeItem item, TreeIter iter)
        {
            var eitem = new EventItem(eitems.Count, item.eventHandler);

            eitems.Add(eitem);

            if (item.type == EntryType.Readonly || item.type == EntryType.Text || item.type == EntryType.LongText || item.type == EntryType.Integer)
            {
                string text;
                bool   editable = true;

                text = item.value as string ?? "";
                if (item.value is char)
                {
                    text = item.value.ToString() ?? "";
                }

                editable &= item.type != EntryType.Readonly;

                return(AddPropertyTextBox(iter, eitem.id.ToString(), item.label, text, editable));
            }
            else if (item.type == EntryType.Color)
            {
                var c = (Microsoft.Xna.Framework.Color)item.value;

                return(AddPropertyColorBox(iter, eitem.id.ToString(), item.label, c.ToString()));
            }
            else if (item.type == EntryType.Combo)
            {
                TreeStore model = null;

                foreach (var v in item.comboItems)
                {
                    if (model == null)
                    {
                        model = new TreeStore(v.Key.GetType(), v.Value.GetType());
                    }
                    model.AppendValues(v.Key, v.Value);
                }

                return(AddPropertyComboBox(iter, eitem.id.ToString(), item.label, model, item.value.ToString()));
            }
            else if (item.type == EntryType.Check)
            {
                return(AddPropertyComboBox(iter, eitem.id.ToString(), item.label, new [] { "True", "False" }, item.value.ToString()));
            }
            else if (item.type == EntryType.List)
            {
                var    values = (List <string>)item.value;
                string text   = "";

                if (values.Count > 0)
                {
                    text = values [0];
                    for (int i = 1; i < values.Count; i++)
                    {
                        text += "\r\n" + values [i];
                    }
                }

                return(AddPropertyCollectionBox(iter, eitem.id.ToString(), item.label, text));
            }
            else
            {
                return(AddPropertyTextBox(iter, eitem.id.ToString(), item.label, "", false));
            }
        }