/// <summary>フォーカスを釈放</summary> public void SetUnFocus() { if (this._state != IElementState.UnFocus) { this._state = IElementState.UnFocus; } }
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(); }
/// <summary>部品欄のアイコン選択状態をセット</summary> public void SetSelected() { if (this._state != IElementState.Selected) { SetHotspotStyle(Colors.Red, 0.5); this._state = IElementState.Selected; } }
/// <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); } }
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); }
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); }
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); } }
/// <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; } }
/// <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; } }
/// <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; } }
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); }
public OverlayElementState(OverlayElementState existing, OverlayElement element, RenderContext context) { child = element.Props.Child.Update(existing?.child, context); overlay = element.Props.Overlay.Update(existing?.overlay, context); }
public IElementState Update(IElementState existing, RenderContext renderContext) { return(new ReduxProviderElementState <TState, TAction>(this, existing, renderContext)); }
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); }
public StretchElementState(StretchElementState existing, StretchElement element, RenderContext context) { nestedState = element.Child.Update(existing?.nestedState, context); BoundingBox = context.Bounds; }
public ITextElementState UpdateTextElementState(IElementState existing, TextElement t, RenderContext context) { return(new TextElementState(existing as TextElementState, t, context)); }
public ISolidColourElementState UpdateSolidColourElementState(IElementState existing, SolidColourElement b2, RenderContext context) { return(new SolidColourElementState(existing as SolidColourElementState, b2, context)); }
public ISolidColourElementState Update(IElementState existing, RenderContext context) { return(context.Renderer.UpdateSolidColourElementState(existing, this, context)); }
public ITextElementState Update(IElementState existing, RenderContext context) { return(context.Renderer.UpdateTextElementState(existing, this, context)); }
public IEventElementState <TEvent> Update(IElementState existing, RenderContext renderContext) { return(new EventElementState <TEvent>(this, renderContext.Bounds)); }