예제 #1
0
        protected void AddPropertyEditor(PropertyEditor editor, int atIndex = -1)
        {
            if (this.propertyEditors.Contains(editor))
            {
                this.propertyEditors.Remove(editor);
            }

            editor.ParentEditor = this;
            this.UpdateChildWidth(editor);

            if (atIndex == -1)
            {
                this.propertyEditors.Add(editor);
            }
            else
            {
                this.propertyEditors.Insert(atIndex, editor);
            }

            GroupedPropertyEditor groupedEditor = editor as GroupedPropertyEditor;

            if (groupedEditor != null && groupedEditor.Expanded && !groupedEditor.ContentInitialized)
            {
                groupedEditor.InitContent();
            }

            this.OnEditorAdded(editor);
            this.UpdateHeight();

            editor.ValueChanged    += this.OnValueChanged;
            editor.EditingFinished += this.OnEditingFinished;
            editor.SizeChanged     += this.child_SizeChanged;
        }
예제 #2
0
 public void SetEditorExpanded(GroupedPropertyEditor editor, bool expanded)
 {
     if (editor == null) return;
     string id = GetEditorFullId(editor);
     if (expanded) this.expandedNodes.Add(id);
     else this.expandedNodes.Remove(id);
 }
예제 #3
0
        public bool IsEditorExpanded(GroupedPropertyEditor editor)
        {
            if (editor == null)
            {
                return(false);
            }
            string id = GetEditorFullId(editor);

            return(expandedNodes.Contains(id));
        }
예제 #4
0
        protected void IndentChildExpandOnMouseUp(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null)
            {
                return;
            }

            if (childGroup.expandCheckPressed && (e.Button & MouseButtons.Left) != MouseButtons.None)
            {
                Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
                childGroup.expandCheckPressed = false;
                this.Invalidate(expandRect);
            }
        }
예제 #5
0
        protected void IndentChildExpandOnMouseLeave(EventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null)
            {
                return;
            }
            Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);

            if (childGroup.expandCheckHovered)
            {
                this.Invalidate(expandRect);
            }
            childGroup.expandCheckHovered = false;
            childGroup.expandCheckPressed = false;
        }
예제 #6
0
        public void SetEditorExpanded(GroupedPropertyEditor editor, bool expanded)
        {
            if (editor == null)
            {
                return;
            }
            string id = GetEditorFullId(editor);

            if (expanded)
            {
                this.expandedNodes.Add(id);
            }
            else
            {
                this.expandedNodes.Remove(id);
            }
        }
예제 #7
0
        protected bool IndentChildExpandOnMouseDown(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null)
            {
                return(false);
            }

            if (childGroup.expandCheckHovered && (e.Button & MouseButtons.Left) != MouseButtons.None)
            {
                Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
                childGroup.expandCheckPressed = true;
                this.Invalidate(expandRect);
                childGroup.OnExpandCheckPressed();
                return(true);
            }

            return(false);
        }
예제 #8
0
        protected void IndentChildExpandOnMouseMove(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null)
            {
                return;
            }
            Rectangle expandRect        = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
            bool      lastExpandHovered = childGroup.expandCheckHovered;

            childGroup.expandCheckHovered =
                childGroup.CanExpand &&
                (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None &&
                expandRect.Contains(e.Location);

            if (lastExpandHovered != childGroup.expandCheckHovered)
            {
                this.Invalidate(expandRect);
            }
        }
예제 #9
0
        protected void UpdatePropertyEditor()
        {
            if (this.mainEditor == null)
            {
                return;
            }

            this.mainEditor.ParentGrid   = this;
            this.mainEditor.ParentEditor = null;
            this.mainEditor.Hints       &= ~(PropertyEditor.HintFlags.HasButton | PropertyEditor.HintFlags.ButtonEnabled);
            this.mainEditor.Getter       = this.ValueGetter;
            this.mainEditor.Setter       = this.readOnly ? null : (Action <IEnumerable <object> >) this.ValueSetter;
            this.mainEditor.Width        = this.ClientSize.Width;
            if (this.mainEditor is GroupedPropertyEditor)
            {
                GroupedPropertyEditor mainGroupEditor = this.mainEditor as GroupedPropertyEditor;
                mainGroupEditor.HeaderStyle = GroupHeaderStyle.Emboss;
                mainGroupEditor.Hints      &= ~PropertyEditor.HintFlags.HasExpandCheck;
            }
        }
예제 #10
0
        protected void InitPropertyEditor(Type type)
        {
            if (this.mainEditor != null)
            {
                this.DisposePropertyEditor();
            }

            this.focusEditor                 = null;
            this.mainEditor                  = this.editorProvider.CreateEditor(type, new ProviderContext(this));
            this.mainEditor.SizeChanged     += this.mainEditor_SizeChanged;
            this.mainEditor.ValueChanged    += this.mainEditor_ValueChanged;
            this.mainEditor.EditingFinished += this.mainEditor_EditingFinished;
            this.UpdatePropertyEditor();
            this.ConfigureEditor(this.mainEditor);

            if (this.mainEditor is GroupedPropertyEditor)
            {
                GroupedPropertyEditor mainGroupEditor = this.mainEditor as GroupedPropertyEditor;
                mainGroupEditor.Expanded = true;
            }

            this.Invalidate();
        }
예제 #11
0
        protected bool IndentChildExpandOnMouseDown(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null) return false;

            if (childGroup.expandCheckHovered && (e.Button & MouseButtons.Left) != MouseButtons.None)
            {
                Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
                childGroup.expandCheckPressed = true;
                this.Invalidate(expandRect);
                childGroup.OnExpandCheckPressed();
                return true;
            }

            return false;
        }
예제 #12
0
 public bool IsEditorExpanded(GroupedPropertyEditor editor)
 {
     if (editor == null) return false;
     string id = GetEditorFullId(editor);
     return expandedNodes.Contains(id);
 }
예제 #13
0
        protected void IndentChildExpandOnMouseMove(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null) return;
            Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
            bool lastExpandHovered = childGroup.expandCheckHovered;

            childGroup.expandCheckHovered =
                childGroup.CanExpand &&
                (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None &&
                expandRect.Contains(e.Location);

            if (lastExpandHovered != childGroup.expandCheckHovered) this.Invalidate(expandRect);
        }
예제 #14
0
        protected void IndentChildExpandOnMouseUp(MouseEventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null) return;

            if (childGroup.expandCheckPressed && (e.Button & MouseButtons.Left) != MouseButtons.None)
            {
                Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
                childGroup.expandCheckPressed = false;
                this.Invalidate(expandRect);
            }
        }
예제 #15
0
        protected void PaintIndentExpandButton(Graphics g, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup.headerHeight == 0)
            {
                return;
            }
            if ((childGroup.Hints & HintFlags.HasExpandCheck) == HintFlags.None)
            {
                return;
            }

            Rectangle indentExpandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
            Rectangle expandButtonRect = new Rectangle(
                indentExpandRect.X + indentExpandRect.Width / 2 - ControlRenderer.ExpandNodeSize.Width / 2,
                indentExpandRect.Y + indentExpandRect.Height / 2 - ControlRenderer.ExpandNodeSize.Height / 2 - 1,
                ControlRenderer.ExpandNodeSize.Width,
                ControlRenderer.ExpandNodeSize.Height);
            ExpandNodeState expandState = ExpandNodeState.OpenedDisabled;

            if (childGroup.Enabled && childGroup.CanExpand && (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None)
            {
                if (!childGroup.Expanded)
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.ClosedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.ClosedNormal;
                    }
                }
                else
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.OpenedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.OpenedNormal;
                    }
                }
            }
            else
            {
                if (childGroup.Expanded)
                {
                    expandState = ExpandNodeState.OpenedDisabled;
                }
                else
                {
                    expandState = ExpandNodeState.ClosedDisabled;
                }
            }

            ControlRenderer.DrawExpandNode(g, expandButtonRect.Location, expandState);
        }
예제 #16
0
        protected void PaintIndentExpandButton(Graphics g, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup.headerHeight == 0) return;
            if ((childGroup.Hints & HintFlags.HasExpandCheck) == HintFlags.None) return;

            Rectangle indentExpandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);
            Rectangle expandButtonRect = new Rectangle(
                indentExpandRect.X + indentExpandRect.Width / 2 - ControlRenderer.ExpandNodeSize.Width / 2,
                indentExpandRect.Y + indentExpandRect.Height / 2 - ControlRenderer.ExpandNodeSize.Height / 2 - 1,
                ControlRenderer.ExpandNodeSize.Width,
                ControlRenderer.ExpandNodeSize.Height);
            ExpandNodeState expandState = ExpandNodeState.OpenedDisabled;
            if (childGroup.Enabled && childGroup.CanExpand && (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None)
            {
                if (!childGroup.Expanded)
                {
                    if (childGroup.expandCheckPressed)		expandState = ExpandNodeState.ClosedPressed;
                    else if (childGroup.expandCheckHovered)	expandState = ExpandNodeState.ClosedHot;
                    else if (childGroup.Focused)			expandState = ExpandNodeState.ClosedHot;
                    else									expandState = ExpandNodeState.ClosedNormal;
                }
                else
                {
                    if (childGroup.expandCheckPressed)		expandState = ExpandNodeState.OpenedPressed;
                    else if (childGroup.expandCheckHovered)	expandState = ExpandNodeState.OpenedHot;
                    else if (childGroup.Focused)			expandState = ExpandNodeState.OpenedHot;
                    else									expandState = ExpandNodeState.OpenedNormal;
                }
            }
            else
            {
                if (childGroup.Expanded)	expandState = ExpandNodeState.OpenedDisabled;
                else						expandState = ExpandNodeState.ClosedDisabled;
            }

            ControlRenderer.DrawExpandNode(g, expandButtonRect.Location, expandState);
        }
예제 #17
0
        protected void IndentChildExpandOnMouseLeave(EventArgs e, GroupedPropertyEditor childGroup, int curY)
        {
            if (childGroup == null) return;
            Rectangle expandRect = new Rectangle(0, curY, this.indent, childGroup.headerHeight);

            if (childGroup.expandCheckHovered) this.Invalidate(expandRect);
            childGroup.expandCheckHovered = false;
            childGroup.expandCheckPressed = false;
        }