public static Report CreateReport(Control root, DataContext data) { var report = new Report(); root.Render(report, null, data); return(report); }
protected internal virtual void Render(HtmlTextWriter writer) { // if (_control != null) { _control.Render(writer); } }
// Returns without doing anything if the control is disabled, otherwise, uses the default rendering. protected internal override void Render(HtmlTextWriter writer) { if (Control.Enabled == false) { return; } Control.Render(writer); }
protected internal virtual void Render(HtmlTextWriter w) { Control control = Control; if (control != null) { control.Render(w); } }
protected internal override void Render(HtmlTextWriter writer) { if (((WmlTextWriter)writer).AnalyzeMode) { return; } HtmlTextWriter w = new HtmlTextWriter(writer); Control.Render(w); }
// protected internal override void Render(HtmlTextWriter writer) { WmlTextWriter wmlWriter = writer as WmlTextWriter; if (wmlWriter == null) { // MMIT legacy case (else pageAdapter would have generated a WmlTextWriter). Control.Render(writer); return; } Render(wmlWriter); }
public void Render(RenderInfo renderInfo, MouseMode mouseMode, Control control, InputState inputState) { using (_canvas.SetUpFrame(renderInfo, mouseMode)) { if (inputState.Mouse != null) { /* Convert the screen coordinates into virtual canvas coordinates. */ inputState.Mouse.Position.X *= _canvas.Width / renderInfo.Width; inputState.Mouse.Position.Y *= _canvas.Height / renderInfo.Height; } control.HandleInput(inputState); control.Render(_canvas); DrawFps(_canvas); } }
private static string EvalControlExpression(ExpressionParser parser, TemplateToken token, TemplateParserContext context) { int colon1 = token.Text.LastIndexOf(':'); int colon2 = -1; if (colon1 > 0) { colon2 = token.Text.LastIndexOf(':', colon1 - 1); } string expr = token.Text; string className = null; string classError = null; if (colon2 >= 0) { classError = expr.Substring(colon1 + 1).Trim(); className = expr.Substring(colon2 + 1, colon1 - colon2 - 1); expr = expr.Substring(0, colon2).Trim(); } else if (colon1 >= 0) { className = expr.Substring(colon1 + 1).Trim(); expr = expr.Substring(0, colon1).Trim(); } Control control = parser.Evaluate <Control>(expr, context, token.TokenPosition); if (control != null) { string html = control.Render(context.View, className, classError); return(context.View.ParseTranslations(html)); } else { return("[?[" + expr + "]?]"); } }
/// <summary> /// Renders the control inside the specified generic html container. /// </summary> /// <param name="control"></param> /// <param name="container">The container to render in.</param> /// /// <param name="overwriteContent">Specifies if you want to overwrite the content of the container.</param> public static void Render(this Control control, HtmlGenericControl container, bool overwriteContent) { container.InnerHtml = ((overwriteContent) ? "" : container.InnerHtml) + control.Render(); }
private void updateLayout(Control control, List<Control> revalidatedControls) { LayoutInfo lastLayoutInfo = control.lastLayoutInfo; // работаем с родительским элементом управления if (control.Parent != null) { bool needUpdateParentLayout = true; // если размер текущего контрола не изменился, то состояние ревалидации не распространяется // вверх по дереву элементов, и мы переходим к работе с дочерними элементами // в противном случае мы добавляем родительский элемент в конец очереди ревалидации, и // возвращаем управление if (lastLayoutInfo.validity != LayoutValidity.Nothing) { control.Measure(lastLayoutInfo.measureArgument); // if (lastLayoutInfo.unclippedDesiredSize == control.layoutInfo.unclippedDesiredSize) { if (checkDesiredSizeNotChangedRecursively(control)) { needUpdateParentLayout = false; } } if (needUpdateParentLayout) { // mark the parent control for invalidation too and enqueue them control.Parent.Invalidate(); // мы можем закончить с этим элементом, поскольку мы уже добавили // в конец очереди его родителя, и мы все равно вернемся к нему в след. раз return; } } // работаем с дочерними элементами управления // вызываем для текущего контрола Measure&Arrange с последними значениями аргументов if (lastLayoutInfo.validity == LayoutValidity.Nothing && control.Parent != null) { throw new InvalidOperationException("Assertion failed."); } // rootElement - особый случай if (control.Parent == null) { if (control != RootElement) { throw new InvalidOperationException("Control has no parent but is not known rootElement."); } control.Measure(RootElementRect.Size); control.Arrange(RootElementRect); } else { control.Measure(lastLayoutInfo.measureArgument); control.Arrange(lastLayoutInfo.renderSlotRect); } // update render buffers of current control and its children RenderingBuffer buffer = getOrCreateBufferForControl(control); RenderingBuffer fullBuffer = getOrCreateFullBufferForControl(control); // replace buffers if control has grown LayoutInfo layoutInfo = control.layoutInfo; if (layoutInfo.renderSize.width > buffer.Width || layoutInfo.renderSize.height > buffer.Height) { buffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); fullBuffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); buffers[control] = buffer; fullBuffers[control] = fullBuffer; } buffer.Clear(); if (control.RenderSize.Width != 0 && control.RenderSize.Height != 0) control.Render(buffer); // проверяем дочерние контролы - если их layoutInfo не изменился по сравнению с последним, // то мы можем взять их последний renderBuffer без обновления и применить к текущему контролу fullBuffer.CopyFrom(buffer); IList<Control> children = control.Children; foreach (Control child in children) { if (child.Visibility == Visibility.Visible) { RenderingBuffer fullChildBuffer = processControl(child, revalidatedControls); fullBuffer.ApplyChild(fullChildBuffer, child.ActualOffset, child.RenderSize, child.RenderSlotRect, child.LayoutClip); } else { // чтобы следующий Invalidate перезаписал lastLayoutInfo if (child.SetValidityToRender()) { revalidatedControls.Add(child); } } } // Save overlappingRect for each control child refreshChildrenLastOverlappedRects( control, false ); if (control.SetValidityToRender()) { revalidatedControls.Add(control); } addControlToRenderingUpdatedList(control); }
private RenderingBuffer processControl(Control control, List<Control> revalidatedControls) { RenderingBuffer buffer = getOrCreateBufferForControl(control); RenderingBuffer fullBuffer = getOrCreateFullBufferForControl(control); // LayoutInfo lastLayoutInfo = control.lastLayoutInfo; LayoutInfo layoutInfo = control.layoutInfo; // control.Measure(lastLayoutInfo.measureArgument); control.Arrange(lastLayoutInfo.renderSlotRect); // if lastLayoutInfo eq layoutInfo we can use last rendered buffer // if (layoutInfo.Equals(lastLayoutInfo) && lastLayoutInfo.validity == LayoutValidity.Render) { if (checkRenderingWasNotChangedRecursively(control)) { if (control.SetValidityToRender()) { revalidatedControls.Add(control); } return fullBuffer; } // replace buffers if control has grown if (layoutInfo.renderSize.width > buffer.Width || layoutInfo.renderSize.height > buffer.Height) { buffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); fullBuffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); buffers[control] = buffer; fullBuffers[control] = fullBuffer; } // otherwise we should assemble full rendered buffer using childs buffer.Clear(); if (control.RenderSize.Width != 0 && control.RenderSize.Height != 0) control.Render(buffer); // fullBuffer.CopyFrom(buffer); foreach (Control child in control.Children) { if (child.Visibility == Visibility.Visible) { RenderingBuffer fullChildBuffer = processControl(child, revalidatedControls); fullBuffer.ApplyChild(fullChildBuffer, child.ActualOffset, child.RenderSize, child.RenderSlotRect, child.LayoutClip); } else { // чтобы следующий Invalidate для этого контрола // перезаписал lastLayoutInfo if (child.SetValidityToRender()) { revalidatedControls.Add(child); } } } // Save overlappingRect for each control child refreshChildrenLastOverlappedRects( control, false ); if (control.SetValidityToRender()) { revalidatedControls.Add(control); } return fullBuffer; }
private RenderingBuffer processControl(Control control, List <Control> revalidatedControls) { RenderingBuffer buffer = getOrCreateBufferForControl(control); RenderingBuffer fullBuffer = getOrCreateFullBufferForControl(control); // LayoutInfo lastLayoutInfo = control.lastLayoutInfo; LayoutInfo layoutInfo = control.layoutInfo; // control.Measure(lastLayoutInfo.measureArgument); control.Arrange(lastLayoutInfo.renderSlotRect); // if lastLayoutInfo eq layoutInfo we can use last rendered buffer // if (layoutInfo.Equals(lastLayoutInfo) && lastLayoutInfo.validity == LayoutValidity.Render) { if (checkRenderingWasNotChangedRecursively(control)) { if (control.SetValidityToRender()) { revalidatedControls.Add(control); } return(fullBuffer); } // replace buffers if control has grown if (layoutInfo.renderSize.width > buffer.Width || layoutInfo.renderSize.height > buffer.Height) { buffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); fullBuffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); buffers[control] = buffer; fullBuffers[control] = fullBuffer; } // otherwise we should assemble full rendered buffer using childs buffer.Clear(); if (control.RenderSize.Width != 0 && control.RenderSize.Height != 0) { control.Render(buffer); } // fullBuffer.CopyFrom(buffer); foreach (Control child in control.Children) { if (child.Visibility == Visibility.Visible) { RenderingBuffer fullChildBuffer = processControl(child, revalidatedControls); fullBuffer.ApplyChild(fullChildBuffer, child.ActualOffset, child.RenderSize, child.RenderSlotRect, child.LayoutClip); } else { // чтобы следующий Invalidate для этого контрола // перезаписал lastLayoutInfo if (child.SetValidityToRender()) { revalidatedControls.Add(child); } } } // Save overlappingRect for each control child refreshChildrenLastOverlappedRects(control, false); if (control.SetValidityToRender()) { revalidatedControls.Add(control); } return(fullBuffer); }
private void updateLayout(Control control, List <Control> revalidatedControls) { LayoutInfo lastLayoutInfo = control.lastLayoutInfo; // работаем с родительским элементом управления if (control.Parent != null) { bool needUpdateParentLayout = true; // если размер текущего контрола не изменился, то состояние ревалидации не распространяется // вверх по дереву элементов, и мы переходим к работе с дочерними элементами // в противном случае мы добавляем родительский элемент в конец очереди ревалидации, и // возвращаем управление if (lastLayoutInfo.validity != LayoutValidity.Nothing) { control.Measure(lastLayoutInfo.measureArgument); // if (lastLayoutInfo.unclippedDesiredSize == control.layoutInfo.unclippedDesiredSize) { if (checkDesiredSizeNotChangedRecursively(control)) { needUpdateParentLayout = false; } } if (needUpdateParentLayout) { // mark the parent control for invalidation too and enqueue them control.Parent.Invalidate(); // мы можем закончить с этим элементом, поскольку мы уже добавили // в конец очереди его родителя, и мы все равно вернемся к нему в след. раз return; } } // работаем с дочерними элементами управления // вызываем для текущего контрола Measure&Arrange с последними значениями аргументов if (lastLayoutInfo.validity == LayoutValidity.Nothing && control.Parent != null) { throw new InvalidOperationException("Assertion failed."); } // rootElement - особый случай if (control.Parent == null) { if (control != RootElement) { throw new InvalidOperationException("Control has no parent but is not known rootElement."); } control.Measure(RootElementRect.Size); control.Arrange(RootElementRect); } else { control.Measure(lastLayoutInfo.measureArgument); control.Arrange(lastLayoutInfo.renderSlotRect); } // update render buffers of current control and its children RenderingBuffer buffer = getOrCreateBufferForControl(control); RenderingBuffer fullBuffer = getOrCreateFullBufferForControl(control); // replace buffers if control has grown LayoutInfo layoutInfo = control.layoutInfo; if (layoutInfo.renderSize.width > buffer.Width || layoutInfo.renderSize.height > buffer.Height) { buffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); fullBuffer = new RenderingBuffer(layoutInfo.renderSize.width, layoutInfo.renderSize.height); buffers[control] = buffer; fullBuffers[control] = fullBuffer; } buffer.Clear(); if (control.RenderSize.Width != 0 && control.RenderSize.Height != 0) { control.Render(buffer); } // проверяем дочерние контролы - если их layoutInfo не изменился по сравнению с последним, // то мы можем взять их последний renderBuffer без обновления и применить к текущему контролу fullBuffer.CopyFrom(buffer); IList <Control> children = control.Children; foreach (Control child in children) { if (child.Visibility == Visibility.Visible) { RenderingBuffer fullChildBuffer = processControl(child, revalidatedControls); fullBuffer.ApplyChild(fullChildBuffer, child.ActualOffset, child.RenderSize, child.RenderSlotRect, child.LayoutClip); } else { // чтобы следующий Invalidate перезаписал lastLayoutInfo if (child.SetValidityToRender()) { revalidatedControls.Add(child); } } } // Save overlappingRect for each control child refreshChildrenLastOverlappedRects(control, false); if (control.SetValidityToRender()) { revalidatedControls.Add(control); } addControlToRenderingUpdatedList(control); }
public void RenderControl(Control control) { control.Render(this.SpriteBatch); }