public IDictionaryPropertyEditor()
		{
			this.Hints |= HintFlags.HasButton | HintFlags.ButtonEnabled;

			this.offsetEditor = new NumericPropertyEditor();
			this.offsetEditor.EditedType = typeof(uint);
			this.offsetEditor.PropertyName = "Offset";
			this.offsetEditor.Getter = this.OffsetValueGetter;
			this.offsetEditor.Setter = this.OffsetValueSetter;
		}
Beispiel #2
0
        public IDictionaryPropertyEditor()
        {
            this.Hints        |= HintFlags.HasButton | HintFlags.ButtonEnabled;
            this.dictKeySetter = DefaultPropertySetter;

            this.offsetEditor              = new NumericPropertyEditor();
            this.offsetEditor.EditedType   = typeof(uint);
            this.offsetEditor.PropertyName = "Offset";
            this.offsetEditor.Getter       = this.OffsetValueGetter;
            this.offsetEditor.Setter       = this.OffsetValueSetter;
        }
        public IDictionaryPropertyEditor()
        {
            this.Hints |= HintFlags.HasButton | HintFlags.ButtonEnabled;
            this.dictKeySetter = DefaultPropertySetter;

            this.offsetEditor = new NumericPropertyEditor();
            this.offsetEditor.EditedType = typeof(int);
            this.offsetEditor.Minimum = 0;
            this.offsetEditor.PropertyName = "Offset";
            this.offsetEditor.Getter = this.OffsetValueGetter;
            this.offsetEditor.Setter = this.OffsetValueSetter;
            this.offsetEditor.ValueMutable = true;
        }
		public IListPropertyEditor()
		{
			this.Hints |= HintFlags.HasButton | HintFlags.ButtonEnabled;

			this.listIndexSetter = DefaultPropertySetter;

			this.sizeEditor = new NumericPropertyEditor();
			this.sizeEditor.EditedType = typeof(uint);
			this.sizeEditor.PropertyName = "Size";
			this.sizeEditor.Getter = this.SizeValueGetter;
			this.sizeEditor.Setter = this.SizeValueSetter;

			this.offsetEditor = new NumericPropertyEditor();
			this.offsetEditor.EditedType = typeof(uint);
			this.offsetEditor.PropertyName = "Offset";
			this.offsetEditor.Getter = this.OffsetValueGetter;
			this.offsetEditor.Setter = this.OffsetValueSetter;
		}
Beispiel #5
0
        public IListPropertyEditor()
        {
            this.Hints |= HintFlags.HasButton | HintFlags.ButtonEnabled;

            this.listIndexSetter = DefaultPropertySetter;

            this.sizeEditor              = new NumericPropertyEditor();
            this.sizeEditor.EditedType   = typeof(uint);
            this.sizeEditor.PropertyName = "Size";
            this.sizeEditor.Getter       = this.SizeValueGetter;
            this.sizeEditor.Setter       = this.SizeValueSetter;

            this.offsetEditor              = new NumericPropertyEditor();
            this.offsetEditor.EditedType   = typeof(uint);
            this.offsetEditor.PropertyName = "Offset";
            this.offsetEditor.Getter       = this.OffsetValueGetter;
            this.offsetEditor.Setter       = this.OffsetValueSetter;
        }
			public PropertyEditor CreateEditor(Type baseType, ProviderContext context)
			{
				PropertyEditor e = null;

				// Basic numeric data types
				if (baseType == typeof(sbyte) || baseType == typeof(byte) ||
					baseType == typeof(short) || baseType == typeof(ushort) ||
					baseType == typeof(int) || baseType == typeof(uint) ||
					baseType == typeof(long) || baseType == typeof(ulong) ||
					baseType == typeof(float) || baseType == typeof(double) || baseType == typeof(decimal))
					e = new NumericPropertyEditor();
				// Basic data type: Boolean
				else if (baseType == typeof(bool))
				    e = new BoolPropertyEditor();
				// Basic data type: Flagged Enum
				else if (baseType.IsEnum && baseType.GetCustomAttributes(typeof(FlagsAttribute), true).Any())
					e = new FlaggedEnumPropertyEditor();
				// Basic data type: Other Enums
				else if (baseType.IsEnum)
					e = new EnumPropertyEditor();
				// Basic data type: String
				else if (baseType == typeof(string))
					e = new StringPropertyEditor();
				// IList
				else if (typeof(System.Collections.IList).IsAssignableFrom(baseType))
					e = new IListPropertyEditor();
				// IList
				else if (typeof(System.Collections.IDictionary).IsAssignableFrom(baseType))
					e = new IDictionaryPropertyEditor();
				// Unknown data type
				else
				{
					// Ask around if any sub-editor can handle it and choose the most specialized
					var availSubProviders = 
						from p in this.subProviders
						where p.IsResponsibleFor(baseType, context) != EditorPriority_None
						orderby p.IsResponsibleFor(baseType, context) descending
						select p;
					IPropertyEditorProvider subProvider = availSubProviders.FirstOrDefault();
					if (subProvider != null)
					{
						e = subProvider.CreateEditor(baseType, context);
						e.EditedType = baseType;
						return e;
					}

					// If not, default to reflection-driven MemberwisePropertyEditor
					e = new MemberwisePropertyEditor();
				}

				e.EditedType = baseType;
				return e;
			}