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; }
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); }
public bool IsEditorExpanded(GroupedPropertyEditor editor) { if (editor == null) { return(false); } string id = GetEditorFullId(editor); return(expandedNodes.Contains(id)); }
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); } }
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; }
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); } }
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); }
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); } }
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; } }
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(); }
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; }
public bool IsEditorExpanded(GroupedPropertyEditor editor) { if (editor == null) return false; string id = GetEditorFullId(editor); return expandedNodes.Contains(id); }
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); }
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); } }
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); }
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); }
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; }