Ejemplo n.º 1
0
 /// <summary>フォーカスを釈放</summary>
 public void SetUnFocus()
 {
     if (this._state != IElementState.UnFocus)
     {
         this._state = IElementState.UnFocus;
     }
 }
Ejemplo n.º 2
0
 public void RenderFrame(IElementState root)
 {
     d2dTarget.BeginDraw();
     d2dTarget.Clear(new SharpDX.Mathematics.Interop.RawColor4(32 / 255f, 103 / 255f, 178 / 255f, 1f));
     root.Render(this);
     d2dTarget.Flush();
     d2dTarget.EndDraw();
 }
Ejemplo n.º 3
0
 /// <summary>部品欄のアイコン選択状態をセット</summary>
 public void SetSelected()
 {
     if (this._state != IElementState.Selected)
     {
         SetHotspotStyle(Colors.Red, 0.5);
         this._state = IElementState.Selected;
     }
 }
Ejemplo n.º 4
0
        /// <summary>フォーカスする</summary>
        public void SetFocus()
        {
            if (this._state != IElementState.Focus)
            {
                SetHotspotStyle(Colors.Blue, 1.0);

                this._state = IElementState.Focus;
            }
        }
 public StatelessComponentElementState(StatelessComponentElementState <P, C> existing, StatelessComponentElement <P, C> parent, RenderContext context)
 {
     ComponentInstance = existing?.ComponentInstance ?? CreateInstance(parent.Props);
     renderResult      = ComponentInstance.Render(parent.Props, context.Context).Update(existing?.renderResult, context);
     if (ComponentInstance is IDisposable)
     {
         context.Disposables.Add(ComponentInstance as IDisposable);
     }
 }
Ejemplo n.º 6
0
 private void TextClicked(ChangeEvent <MouseState> mouse, IElementState element, StoreState state, Action <StoreState> dispatch)
 {
     if (mouse.OriginalState.LeftButtonDown && !mouse.NewState.LeftButtonDown && element.BoundingBox.IsInBounds(mouse.NewState))
     {
         dispatch(new StoreState {
             Clicked = !state.Clicked, Selection = state.Selection
         });
     }
 }
 public BackgroundUpdateContext(IElement <IElementState> root, IRenderer renderer, IComponentContext context, Bounds initialBounds)
 {
     this.root           = root;
     this.renderer       = renderer;
     this.context        = context;
     currentBounds       = initialBounds;
     currentDisposables  = new HashSet <IDisposable>();
     currentElementState = root.Update(null, new RenderContext(currentBounds, renderer, context, this, currentDisposables));
     renderer.RenderFrame(currentElementState);
 }
Ejemplo n.º 8
0
        public S Update(IElementState existing, RenderContext context)
        {
            var result = (S)typeof(S).GetConstructor(new Type[] { typeof(S), typeof(E), typeof(RenderContext) }).Invoke(new object[] { existing as S, (E)this, context });

            if (result is IDisposable)
            {
                context.Disposables.Add(result as IDisposable);
            }
            return(result);
        }
Ejemplo n.º 9
0
 public StatefulComponentElementState(StatefulComponentElementState <P, S, C> existing, StatefulComponentElement <P, S, C> parent, RenderContext context)
 {
     componentInstance = existing?.componentInstance ?? CreateInstance(parent.Props);
     componentInstance.updateContext = context.UpdateContext;
     renderResult = componentInstance.Render(parent.Props, componentInstance.state, context.Context).Update(existing?.renderResult, context);
     if (componentInstance is IDisposable)
     {
         context.Disposables.Add(componentInstance as IDisposable);
     }
 }
Ejemplo n.º 10
0
        /// <summary>フォーカスを釈放</summary>
        public void SetUnFocus()
        {
            if (this._state != IElementState.UnFocus)
            {
                //HotspotLeft.Visibility = Visibility.Collapsed;
                //HotspotTop.Visibility = Visibility.Collapsed;
                //HotspotRight.Visibility = Visibility.Collapsed;
                //HotspotBottom.Visibility = Visibility.Collapsed;

                this._state = IElementState.UnFocus;
            }
        }
Ejemplo n.º 11
0
        /// <summary>フォーカスする</summary>
        public void SetFocus()
        {
            if (this._state != IElementState.Focus)
            {
                SetHotspotStyle(Colors.Blue, 1.0);
                //HotspotLeft.Visibility = Visibility.Visible;
                //HotspotTop.Visibility = Visibility.Visible;
                //HotspotRight.Visibility = Visibility.Visible;
                //HotspotBottom.Visibility = Visibility.Visible;

                this._state = IElementState.Focus;
            }
        }
Ejemplo n.º 12
0
        /// <summary>部品欄のアイコン選択状態をセット</summary>
        public void SetSelected()
        {
            if (this._state != IElementState.Selected)
            {
                SetHotspotStyle(Colors.Red, 0.5);
                //HotspotLeft.Visibility = Visibility.Visible;
                //HotspotTop.Visibility = Visibility.Visible;
                //HotspotRight.Visibility = Visibility.Visible;
                //HotspotBottom.Visibility = Visibility.Visible;

                this._state = IElementState.Selected;
            }
        }
Ejemplo n.º 13
0
        public ReduxProviderElementState(ReduxProviderElement <TState, TAction> element, IElementState existing, RenderContext renderContext)
        {
            var existingProviderState = existing as ReduxProviderElementState <TState, TAction>;

            this.state = existingProviderState?.state ?? element.Store.State;
            var nestedContext = new RenderContext(
                renderContext.Bounds,
                renderContext.Renderer,
                new ReduxProviderComponentContext <TState, TAction>(() => state, action => element.Store.Dispatch(action)),
                renderContext.UpdateContext,
                renderContext.Disposables);

            this.nested = element.Child.Update(existingProviderState?.nested, nestedContext);
        }
        private void OnUpdatesFinished()
        {
            var newDisposables  = new HashSet <IDisposable>();
            var newElementState = root.Update(currentElementState, new RenderContext(currentBounds, renderer, context, this, newDisposables));

            foreach (var disposable in currentDisposables)
            {
                if (!newDisposables.Contains(disposable))
                {
                    disposable.Dispose();
                }
            }
            currentDisposables  = newDisposables;
            currentElementState = newElementState;
            renderer.RenderFrame(currentElementState);
        }
Ejemplo n.º 15
0
 public OverlayElementState(OverlayElementState existing, OverlayElement element, RenderContext context)
 {
     child   = element.Props.Child.Update(existing?.child, context);
     overlay = element.Props.Overlay.Update(existing?.overlay, context);
 }
Ejemplo n.º 16
0
 public IElementState Update(IElementState existing, RenderContext renderContext)
 {
     return(new ReduxProviderElementState <TState, TAction>(this, existing, renderContext));
 }
Ejemplo n.º 17
0
 public BackgroundElementState(BackgroundElementState existingState, BackgroundElement other, RenderContext context)
 {
     props            = other.Props;
     nestedState      = other.Child.Update(existingState?.nestedState, context);
     solidColourState = context.Renderer.UpdateSolidColourElementState(existingState?.solidColourState, new SolidColourElement(new SolidColourElementProps(other.Props.Colour, b => nestedState.BoundingBox)), context);
 }
Ejemplo n.º 18
0
 public StretchElementState(StretchElementState existing, StretchElement element, RenderContext context)
 {
     nestedState = element.Child.Update(existing?.nestedState, context);
     BoundingBox = context.Bounds;
 }
Ejemplo n.º 19
0
 public ITextElementState UpdateTextElementState(IElementState existing, TextElement t, RenderContext context)
 {
     return(new TextElementState(existing as TextElementState, t, context));
 }
Ejemplo n.º 20
0
 public ISolidColourElementState UpdateSolidColourElementState(IElementState existing, SolidColourElement b2, RenderContext context)
 {
     return(new SolidColourElementState(existing as SolidColourElementState, b2, context));
 }
Ejemplo n.º 21
0
 public ISolidColourElementState Update(IElementState existing, RenderContext context)
 {
     return(context.Renderer.UpdateSolidColourElementState(existing, this, context));
 }
Ejemplo n.º 22
0
 public ITextElementState Update(IElementState existing, RenderContext context)
 {
     return(context.Renderer.UpdateTextElementState(existing, this, context));
 }
Ejemplo n.º 23
0
 public IEventElementState <TEvent> Update(IElementState existing, RenderContext renderContext)
 {
     return(new EventElementState <TEvent>(this, renderContext.Bounds));
 }