Esempio n. 1
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);
 }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
        void AppendProperty(TreeIter piter, PropertyDescriptor prop, InstanceData idata)
        {
            TreeIter iter;

            #region this bugfix was backported to here from a newer MonoDevelop version by P.Eisenmann/S.Lohse 2016-12-06
            // only show properties that have BrowsableAttribute set [true], or where BrowsableAttribute is not defined
            var brows = prop.Attributes[typeof(BrowsableAttribute)] as BrowsableAttribute;
            if (brows != null && !brows.Browsable)
            {
                return;
            }
            #endregion

            if (piter.Equals(TreeIter.Zero))
            {
                iter = store.AppendValues(prop.DisplayName.Localized(), prop, false, idata);
            }
            else
            {
                iter = store.AppendValues(piter, prop.DisplayName.Localized(), 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);
                }
            }
        }
Esempio n. 4
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);
                }
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
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);
			}
		}
Esempio n. 7
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);
				}
			}
		}
        void AppendProperty(TreeIter piter, PropertyDescriptor prop, InstanceData idata)
        {
            TreeIter iter;

            #region this bugfix was backported to here from a newer MonoDevelop version by P.Eisenmann/S.Lohse 2016-12-06
            // only show properties that have BrowsableAttribute set [true], or where BrowsableAttribute is not defined
            var brows = prop.Attributes[typeof(BrowsableAttribute)] as BrowsableAttribute;
            if (brows != null && !brows.Browsable)
                return;
            #endregion

            if (piter.Equals (TreeIter.Zero))
                iter = store.AppendValues (prop.DisplayName.Localized(), prop, false, idata);
            else
                iter = store.AppendValues (piter, prop.DisplayName.Localized(), 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);
            }
        }