コード例 #1
0
        void AppendProperty(TreeIter piter, PropertyDescriptor prop, InstanceData idata)
        {
            TreeIter iter;

            if (piter.Equals(TreeIter.Zero))
            {
                iter = store.AppendValues(prop.DisplayName, prop, false, idata);
            }
            else
            {
                iter = store.AppendValues(piter, prop.DisplayName, prop, false, idata);
            }
            propertyRows [prop] = store.GetStringFromIter(iter);

            TypeConverter tc = prop.Converter;

            if (typeof(ExpandableObjectConverter).IsAssignableFrom(tc.GetType()))
            {
                object cob = prop.GetValue(idata.Instance);
                foreach (PropertyDescriptor cprop in TypeDescriptor.GetProperties(cob))
                {
                    AppendProperty(iter, cprop, cob);
                }
            }
        }
コード例 #2
0
 bool UpdateProperty(PropertyDescriptor pd, TreeIter it, object instance)
 {
     do
     {
         PropertyDescriptor prop  = (PropertyDescriptor)store.GetValue(it, 1);
         InstanceData       idata = (InstanceData)store.GetValue(it, 3);
         if (prop != null && idata != null && prop.Name == pd.Name && idata.Instance == instance)
         {
             // Don't update the current editing node, since it may cause tree update problems
             if (!tree.Editing || !store.GetPath(tree.EditingIter).Equals(store.GetPath(it)))
             {
                 store.SetValue(it, 1, pd);
             }
             return(true);
         }
         TreeIter ci;
         if (store.IterChildren(out ci, it))
         {
             if (UpdateProperty(pd, ci, instance))
             {
                 return(true);
             }
         }
     }while (store.IterNext(ref it));
     return(false);
 }
コード例 #3
0
        internal void Populate(PropertyDescriptorCollection properties, object instance)
        {
            bool categorised = PropertySort == PropertySort.Categorized;

            //transcribe browsable properties
            ArrayList sorted = new ArrayList();

            foreach (PropertyDescriptor descriptor in properties)
            {
                if (descriptor.IsBrowsable)
                {
                    sorted.Add(descriptor);
                }
            }

            if (sorted.Count == 0)
            {
                return;
            }

            InstanceData idata = new InstanceData(instance);

            if (!categorised)
            {
                if (PropertySort != PropertySort.NoSort)
                {
                    sorted.Sort(new SortByName());
                }
                foreach (PropertyDescriptor pd in sorted)
                {
                    AppendProperty(TreeIter.Zero, pd, idata);
                }
            }
            else
            {
                sorted.Sort(new SortByCat());
                string   oldCat  = null;
                TreeIter catIter = TreeIter.Zero;

                foreach (PropertyDescriptor pd in sorted)
                {
                    if (pd.Category != oldCat)
                    {
                        catIter = store.AppendValues(pd.Category, null, true, idata);
                        oldCat  = pd.Category;
                    }
                    AppendProperty(catIter, pd, idata);
                }
            }
        }
コード例 #4
0
        void PropertyData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererProperty rc = (CellRendererProperty)cell;
            bool group = (bool)model.GetValue(iter, 2);

            if (group)
            {
                rc.SetData(null, null, null);
            }
            else
            {
                PropertyDescriptor prop     = (PropertyDescriptor)model.GetValue(iter, 1);
                PropertyEditorCell propCell = editorManager.GetEditor(prop);
                InstanceData       idata    = (InstanceData)model.GetValue(iter, 3);
                propCell.Initialize(tree, editorManager, prop, idata.Instance);
                rc.SetData(idata.Instance, prop, propCell);
            }
        }
コード例 #5
0
        void AppendProperty(TreeIter piter, PropertyDescriptor prop, InstanceData idata)
        {
            TreeIter iter;

            if (piter.Equals (TreeIter.Zero))
                iter = store.AppendValues (prop.DisplayName, prop, false, idata);
            else
                iter = store.AppendValues (piter, prop.DisplayName, prop, false, idata);
            propertyRows [prop] = store.GetStringFromIter (iter);

            TypeConverter tc = prop.Converter;
            if (typeof (ExpandableObjectConverter).IsAssignableFrom (tc.GetType ())) {
                object cob = prop.GetValue (idata.Instance);
                foreach (PropertyDescriptor cprop in TypeDescriptor.GetProperties (cob))
                    AppendProperty (iter, cprop, cob);
            }
        }
コード例 #6
0
        internal void Populate(PropertyDescriptorCollection properties, object instance)
        {
            bool categorised = PropertySort == PropertySort.Categorized;

            //transcribe browsable properties
            ArrayList sorted = new ArrayList();

            foreach (PropertyDescriptor descriptor in properties)
                if (descriptor.IsBrowsable)
                    sorted.Add (descriptor);

            if (sorted.Count == 0)
                return;

            InstanceData idata = new InstanceData (instance);

            if (!categorised) {
                if (PropertySort != PropertySort.NoSort)
                    sorted.Sort(new SortByName ());
                foreach (PropertyDescriptor pd in sorted)
                    AppendProperty (TreeIter.Zero, pd, idata);
            }
            else {
                sorted.Sort (new SortByCat ());
                string oldCat = null;
                TreeIter catIter = TreeIter.Zero;

                foreach (PropertyDescriptor pd in sorted) {
                    if (pd.Category != oldCat) {
                        catIter = store.AppendValues (pd.Category, null, true, idata);
                        oldCat = pd.Category;
                    }
                    AppendProperty (catIter, pd, idata);
                }
            }
        }