Esempio n. 1
0
            public VisualHintEditor(VisualHint hint, float leftOffset = 0f)
            {
                this.hint = hint;
                Layout    = new VBoxLayout();

                if (hint.Command != null)
                {
                    BooleanEditor = new BooleanEditor(hint.Command);
                }
                else
                {
                    BooleanEditor = new BooleanEditor(hint.Title);
                }
                BooleanEditor.Changed       += e => CheckHandle(e);
                BooleanEditor.Checked        = hint.Enabled;
                BooleanEditor.CommandIssued += () => CheckSelfAndChildren(BooleanEditor.Checked);

                var rowWidget = new Widget {
                    Layout  = new HBoxLayout(),
                    Padding = new Thickness {
                        Left = leftOffset
                    }
                };

                rowWidget.AddNode(hint.SubHints.Count > 0 ? (button = CreateExpandButton()) : offsetWidget.Clone());
                rowWidget.AddNode(BooleanEditor);
                AddNode(rowWidget);
                container = new Widget {
                    Layout = new VBoxLayout()
                };
                foreach (var subHint in hint.SubHints.Values)
                {
                    if (subHint.Hidden)
                    {
                        continue;
                    }
                    container.AddNode(new VisualHintEditor(subHint, leftOffset + 23)
                    {
                        parent = this
                    });
                }
                rowWidget.AddChangeWatcher(() => hint.Expanded, _ => HandleExpanded());
                TryCheckAll(traverseParents: false);
            }
 public PropertyGraphicStencilFeel(VisualHint.SmartPropertyGrid.PropertyGrid grid, bool editable)
   : base(grid)
   {
       _editable = editable;
   }