Exemple #1
0
        /// <summary>
        /// Adds object(s) editor. Selects proper <see cref="CustomEditor"/> based on overrides.
        /// </summary>
        /// <param name="values">The values.</param>
        /// <param name="overrideEditor">The custom editor to use. If null will detect it by auto.</param>
        /// <returns>The created element.</returns>
        public CustomEditor Object(ValueContainer values, CustomEditor overrideEditor = null)
        {
            if (values == null)
            {
                throw new ArgumentNullException();
            }

            var editor = CustomEditorsUtil.CreateEditor(values, overrideEditor);

            OnAddEditor(editor);
            editor.Initialize(CustomEditor.CurrentCustomEditor.Presenter, this, values);

            return(editor);
        }
Exemple #2
0
        /// <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.Name, true);
                group.Panel.Close(false);
                return(group.Object(values, editor));
            }

            var property = AddPropertyItem(label, tooltip);

            return(property.Object(values, editor));
        }
Exemple #3
0
        /// <summary>
        /// Adds object property editor. 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 Property(string name, ValueContainer values, CustomEditor overrideEditor = null, string tooltip = null)
        {
            var editor = CustomEditorsUtil.CreateEditor(values, overrideEditor);
            var style  = editor.Style;

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

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

            var property = AddPropertyItem(name, tooltip);

            return(property.Object(values, editor));
        }
Exemple #4
0
            /// <inheritdoc />
            public override void Initialize(LayoutElementsContainer layout)
            {
                var selection = Presenter.Selection;

                if (selection.Count > 0)
                {
                    Type type = typeof(object);
                    if (selection.HasDiffrentTypes == false)
                    {
                        type = selection[0].GetType();
                    }
                    Editor = CustomEditorsUtil.CreateEditor(type, false);
                    Editor.Initialize(Presenter, Presenter, selection);
                    OnChildCreated(Editor);
                }
                else
                {
                    var label = layout.Label(_noSelectionText, TextAlignment.Center);
                    label.Label.Height = 20.0f;
                }

                base.Initialize(layout);
            }