/// <summary>
        /// Adds object property editor. Selects proper <see cref="CustomEditor"/> based on overrides.
        /// </summary>
        /// <param name="label">The property label.</param>
        /// <param name="values">The values.</param>
        /// <param name="overrideEditor">The custom editor to use. If null will detect it by auto.</param>
        /// <param name="tooltip">The property label tooltip text.</param>
        /// <returns>The created element.</returns>
        public CustomEditor Property(PropertyNameLabel label, ValueContainer values, CustomEditor overrideEditor = null, string tooltip = null)
        {
            var editor = CustomEditorsUtil.CreateEditor(values, overrideEditor);
            var style  = editor.Style;

            if (style == DisplayStyle.InlineIntoParent)
            {
                return(Object(values, editor));
            }

            if (style == DisplayStyle.Group)
            {
                var group = Group(label.Text, editor, true);
                group.Panel.Close(false);
                group.Panel.TooltipText = tooltip;
                return(group.Object(values, editor));
            }

            var property = AddPropertyItem(label, tooltip);

            return(property.Object(values, editor));
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ListValueContainer"/> class.
        /// </summary>
        /// <param name="elementType">Type of the collection elements.</param>
        /// <param name="index">The index.</param>
        /// <param name="values">The collection values.</param>
        public ListValueContainer(Type elementType, int index, ValueContainer values)
            : this(elementType, index)
        {
            Capacity = values.Count;
            for (int i = 0; i < values.Count; i++)
            {
                var v = (IList)values[i];
                Add(v[index]);
            }

            if (values.HasReferenceValue)
            {
                var v = (IList)values.ReferenceValue;

                // Get the reference value if collections are the same size
                if (v != null && values.Count == v.Count)
                {
                    _referenceValue    = v[index];
                    _hasReferenceValue = true;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Adds object(s) editor with name label. Selects proper <see cref="CustomEditor"/> based on overrides.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="values">The values.</param>
        /// <param name="overrideEditor">The custom editor to use. If null will detect it by auto.</param>
        /// <param name="tooltip">The property label tooltip text.</param>
        /// <returns>The created element.</returns>
        public CustomEditor Object(string name, ValueContainer values, CustomEditor overrideEditor = null, string tooltip = null)
        {
            var property = AddPropertyItem(name, tooltip);

            return(property.Object(values, overrideEditor));
        }
Пример #4
0
 /// <inheritdoc />
 public override void Set(ValueContainer instanceValues)
 {
     // Not supported
 }
Пример #5
0
        internal virtual void Initialize(CustomEditorPresenter presenter, LayoutElementsContainer layout, ValueContainer values)
        {
            _layout    = layout;
            _presenter = presenter;
            _values    = values;

            var prev = CurrentCustomEditor;

            CurrentCustomEditor = this;

            _isSetBlocked = true;
            Initialize(layout);
            Refresh();
            _isSetBlocked = false;

            CurrentCustomEditor = prev;
        }
Пример #6
0
 /// <summary>
 /// Synchronizes the child values container with this editor values.
 /// </summary>
 /// <param name="values">The values to synchronize.</param>
 protected virtual void SyncChildValues(ValueContainer values)
 {
     values.Set(Values);
 }
Пример #7
0
 /// <inheritdoc />
 protected override void SyncChildValues(ValueContainer values)
 {
     // Skip
 }