Esempio n. 1
0
            public PanelTab()
            {
                MinSize    = new Vector2(TabMinWidth, TabHeight);
                MaxSize    = new Vector2(TabMaxWidth, TabHeight);
                LayoutCell = new LayoutCell(Alignment.LeftTop);
                Size       = MinSize;
                Layout     = new HBoxLayout();
                var caption = new SimpleText {
                    Id             = "TextPresenter",
                    Padding        = Theme.Metrics.ControlsPadding,
                    ForceUncutText = false,
                    FontHeight     = Theme.Metrics.TextHeight,
                    HAlignment     = HAlignment.Center,
                    VAlignment     = VAlignment.Center,
                    OverflowMode   = TextOverflowMode.Ellipsis,
                    LayoutCell     = new LayoutCell(Alignment.Center),
                };
                var presenter = new TabPresenter(caption);

                CompoundPresenter.Add(presenter);
                DefaultAnimation.AnimationEngine = new AnimationEngineDelegate {
                    OnRunAnimation = (animation, markerId, animationTimeCorrection) => {
                        presenter.SetState(markerId);
                        return(true);
                    }
                };
                AddNode(caption);
                HitTestTarget = true;
                LateTasks.Add(Theme.MouseHoverInvalidationTask(this));
                this.AddChangeWatcher(() => Active,
                                      isActive => Padding = isActive ? new Thickness {
                    Top = -1f, Bottom = 1f
                } : new Thickness());
            }
Esempio n. 2
0
 public GradientControlPointWidget(GradientControlPoint controlPoint)
 {
     ControlPoint = controlPoint;
     Pivot        = new Vector2(0.5f, 0);
     CompoundPresenter.Add(new SyncDelegatePresenter <Widget>(Render));
     HitTestTarget = true;
     chessTexture  = PrepareChessTexture(Color4.White, Color4.Black);
 }
Esempio n. 3
0
            public NodeComponentCollectionRow(
                Model3DAttachment.NodeComponentCollection source,
                ObservableCollection <Model3DAttachment.NodeComponentCollection> sourceCollection) : base(source, sourceCollection)
            {
                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 nodeIdPropEditor = new StringPropertyEditor(
                    Decorate(new PropertyEditorParams(
                                 Header,
                                 source,
                                 nameof(Model3DAttachment.NodeComponentCollection.NodeId))));

                nodeIdPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                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,
                };

                if (source.Components == null)
                {
                    source.Components = new ObservableCollection <NodeComponent>();
                }

                BuildList(source.Components, expandableContentWrapper);
                Nodes.Add(expandableContentWrapper);
                expandableContentWrapper.AddChangeWatcher(
                    () => expandedButton.Expanded,
                    (v) => expandableContentWrapper.Visible = v);
                CompoundPresenter.Add(Presenters.StripePresenter);
            }
Esempio n. 4
0
 public RulerRowView(RulerData overlay, IList <RulerData> overlays) : base()
 {
     Layout          = new HBoxLayout();
     Nodes.Add(Label = new ThemedSimpleText {
         Padding = new Thickness {
             Left = 10
         },
     });
     this.AddChangeWatcher(() => overlay.Name, (name) => Label.Text = name);
     Nodes.Add(new Widget());
     Nodes.Add(deleteButton = new ThemedDeleteButton {
         Anchors    = Anchors.Right,
         LayoutCell = new LayoutCell(Alignment.LeftTop)
     });
     CompoundPresenter.Add(StripePresenter);
     deleteButton.Clicked = () => overlays.Remove(overlay);
     MinMaxHeight         = 20;
 }
Esempio n. 5
0
 public ToolbarButton()
 {
     highlightable = true;
     Nodes.Clear();
     Padding = new Thickness(2);
     Size    = MinMaxSize = Theme.Metrics.DefaultToolbarButtonSize;
     DefaultAnimation.AnimationEngine = new AnimationEngineDelegate {
         OnRunAnimation = (animation, markerId, animationTimeCorrection) => {
             if (markerId == "Focus")
             {
                 state = State.Highlight;
             }
             else if (markerId == "Press")
             {
                 state = State.Press;
             }
             else
             {
                 state = State.Default;
             }
             Window.Current.Invalidate();
             return(true);
         }
     };
     CompoundPresenter.Add(new DelegatePresenter <Widget>(w => {
         w.PrepareRendererState();
         Renderer.Shader = Enabled ? ShaderId.Diffuse : ShaderId.Silhuette;
         Color4 bgColor, borderColor;
         GetColors(state, out bgColor, out borderColor);
         if (bgColor != Color4.Transparent)
         {
             Renderer.DrawRect(Vector2.Zero, Size, bgColor);
         }
         if (Texture != null)
         {
             var iconColor = Enabled ? GlobalColor : GlobalColor * ColorTheme.Current.Toolbar.ButtonDisabledColor;
             Renderer.DrawSprite(Texture, iconColor, ContentPosition, ContentSize, Vector2.Zero, Vector2.One);
         }
         if (borderColor != Color4.Transparent)
         {
             Renderer.DrawRectOutline(Vector2.Zero, Size, borderColor);
         }
     }));
 }
Esempio n. 6
0
            public MeshRow(Model3DAttachment.MeshOption mesh, ObservableCollection <Model3DAttachment.MeshOption> options) : base(mesh, options)
            {
                Layout  = new VBoxLayout();
                Padding = new Thickness(AttachmentMetrics.Spacing);
                var meshIdPropEditor = new StringPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        mesh,
                        nameof(Model3DAttachment.MeshOption.Id))
                {
                    ShowLabel = false
                });

                meshIdPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                var cullModePropEditor = new EnumPropertyEditor <CullMode>(
                    new PropertyEditorParams(
                        Header,
                        mesh,
                        nameof(Model3DAttachment.MeshOption.CullMode))
                {
                    ShowLabel = false
                });

                cullModePropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.EditorWidth;

                var hitPropEditor = new BooleanPropertyEditor(
                    new PropertyEditorParams(
                        Header,
                        mesh,
                        nameof(Model3DAttachment.MeshOption.HitTestTarget))
                {
                    ShowLabel = false
                });

                hitPropEditor.ContainerWidget.MinMaxWidth = AttachmentMetrics.ControlWidth;
                CompoundPresenter.Add(Presenters.StripePresenter);
            }
Esempio n. 7
0
            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);
            }