public ExpandablePropertyEditor(IPropertyEditorParams editorParams) : base(editorParams) { ExpandableContent = new ThemedFrame { Padding = new Thickness(4), Layout = new VBoxLayout(), Visible = false }; ExpandButton = new ThemedExpandButton { Anchors = Anchors.Left, MinMaxSize = Vector2.One * 20f, }; ExpandButton.Clicked += () => Expanded = !Expanded; editorParams.InspectorPane.AddNode(ExpandableContent); ContainerWidget.Nodes.Insert(0, ExpandButton); }
private void BuildList <TData, TRow>(ObservableCollection <TData> source, Widget container, string title, Func <TData> activator, Widget header) where TRow : DeletableRow <TData> { ThemedExpandButton markersExpandButton; container.AddNode(new Widget { Layout = new HBoxLayout { Spacing = AttachmentMetrics.Spacing }, Nodes = { (markersExpandButton = new ThemedExpandButton { MinMaxSize = new Vector2(AttachmentMetrics.ExpandButtonSize) }), new ThemedSimpleText { Text = title }, } }); var list = new Widget { Layout = new VBoxLayout(), Padding = new Thickness { Left = AttachmentMetrics.ExpandContentPadding, Top = AttachmentMetrics.Spacing }, }; container.AddNode(list); var widgetFactory = new AttachmentWidgetFactory <TData>( w => (TRow)Activator.CreateInstance(typeof(TRow), new object[] { w, source }), source); widgetFactory.AddHeader(header); widgetFactory.AddFooter(DeletableRow <TData> .CreateFooter(() => { source.Add(activator()); })); list.Components.Add(widgetFactory); this.AddChangeWatcher(() => markersExpandButton.Expanded, (e) => list.Visible = e); }
private ThemedScrollView CreateScrollView() { scrollView = new ThemedScrollView(); scrollView.Behaviour.Content.Padding = new Thickness(4); scrollView.Behaviour.Content.Layout = new VBoxLayout(); scrollView.Behaviour.Content.LayoutCell = new LayoutCell(Alignment.Center); Rectangle calcRect(Widget w) { var wp = w.ParentWidget; var p = wp.Padding; return(new Rectangle( -w.Position + Vector2.Zero - new Vector2(p.Left, p.Top), -w.Position + wp.Size + new Vector2(p.Right, p.Bottom) )); } scrollView.Content.CompoundPresenter.Add(new SyncDelegatePresenter <Widget>((w) => { w.PrepareRendererState(); var rect = calcRect(w); Renderer.DrawRect(rect.A, rect.B, Theme.Colors.GrayBackground.Transparentify(0.9f)); })); scrollView.Content.CompoundPostPresenter.Add(new SyncDelegatePresenter <Widget>((w) => { w.PrepareRendererState(); var rect = calcRect(w); Renderer.DrawRectOutline(rect.A, rect.B, Theme.Colors.ControlBorder); })); foreach (var key in triggers.Keys) { groupSelection[key] = new Queue <string>(); checkBoxes[key] = new Dictionary <string, ThemedCheckBox>(); var expandButton = new ThemedExpandButton { MinMaxSize = Vector2.One * 20f, LayoutCell = new LayoutCell(Alignment.LeftCenter), Expanded = true }; var groupLabel = new ThemedSimpleText { Text = key, VAlignment = VAlignment.Center, LayoutCell = new LayoutCell(Alignment.Center), ForceUncutText = false, HitTestTarget = true }; var header = new Widget { Layout = new HBoxLayout(), LayoutCell = new LayoutCell(Alignment.Center), Padding = new Thickness(4), Nodes = { expandButton, groupLabel } }; var wrapper = new Frame { Padding = new Thickness(4), Layout = new VBoxLayout(), Visible = true }; expandButton.Clicked += () => { wrapper.Visible = !wrapper.Visible; }; groupLabel.Clicked += () => { wrapper.Visible = !wrapper.Visible; expandButton.Expanded = !expandButton.Expanded; }; foreach (var trigger in triggers[key]) { wrapper.AddNode(CreateTriggerSelectionWidget(trigger, key)); } scrollView.Content.AddNode(new Widget { Layout = new VBoxLayout(), LayoutCell = new LayoutCell(Alignment.Center), Padding = new Thickness(4), Nodes = { header, wrapper } }); } return(scrollView); }
public AnimationRow(Model3DAttachment.Animation animation, ObservableCollection <Model3DAttachment.Animation> options) : base(animation, options) { var isDefault = animation.Name == Model3DAttachment.DefaultAnimationName; deleteButton.Visible = !isDefault; Layout = new VBoxLayout(); var expandedButton = new ThemedExpandButton { MinMaxSize = new Vector2(AttachmentMetrics.ExpandButtonSize), Anchors = Anchors.Left }; Padding = new Thickness(AttachmentMetrics.Spacing); Header.Nodes.Add(expandedButton); var animationNamePropEditor = new StringPropertyEditor( new PropertyEditorParams( Header, animation, nameof(Model3DAttachment.Animation.Name)) { ShowLabel = false }); animationNamePropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth; Header.AddNode(new BlendingCell(Source, nameof(Model3DAttachment.Animation.Blending))); var expandableContentWrapper = new Widget { Layout = new VBoxLayout { Spacing = AttachmentMetrics.Spacing }, LayoutCell = new LayoutCell { StretchY = 0 }, Padding = new Thickness { Left = AttachmentMetrics.ExpandContentPadding, Top = AttachmentMetrics.Spacing, Bottom = AttachmentMetrics.Spacing }, Visible = false, }; BuildList <Model3DAttachment.MarkerData, MarkerRow>( animation.Markers, expandableContentWrapper, "Markers", () => new Model3DAttachment.MarkerData { Marker = new Marker { Id = "Marker", Frame = 0, } }, MarkerRow.CreateHeader()); BuildList <Model3DAttachment.MarkerBlendingData, MarkerBlendingRow>( animation.MarkersBlendings, expandableContentWrapper, "Marker Blendings", () => new Model3DAttachment.MarkerBlendingData { SourceMarkerId = "Marker2", DestMarkerId = "Marker1" }, MarkerBlendingRow.CreateHeader()); if (!isDefault) { BuildList <Model3DAttachment.NodeData, NodeRow>( animation.Nodes, expandableContentWrapper, "Nodes", () => new Model3DAttachment.NodeData { Id = "NodeId" }, NodeRow.CreateHeader()); BuildList <Model3DAttachment.NodeData, NodeRow>( animation.IgnoredNodes, expandableContentWrapper, "Ignored Nodes", () => new Model3DAttachment.NodeData { Id = "NodeId" }, NodeRow.CreateHeader()); } Nodes.Add(expandableContentWrapper); expandableContentWrapper.AddChangeWatcher( () => expandedButton.Expanded, (v) => expandableContentWrapper.Visible = v); CompoundPresenter.Add(Presenters.StripePresenter); }