static void RootInvalidateGraphicArea(RenderElement re, ref Rectangle rect) { //1. re.propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID; //2. re.rootGfx.InvalidateGraphicArea(re, ref rect); }
public static void InvalidateGraphicLocalArea(RenderElement re, Rectangle localArea) { if (localArea.Height == 0 || localArea.Width == 0) { return; } RootInvalidateGraphicArea(re, ref localArea); }
public void WriteInfo(string info, RenderElement ve) { ++msgCounter; ShouldBreak(); strmWriter.Write(new string('\t', indentCount)); strmWriter.Write(info); strmWriter.Write(ve.dbug_FullElementDescription()); strmWriter.Write("\r\n"); strmWriter.Flush(); }
public void WriteInfo(RenderElement v, string info, string indentPrefix, string indentPostfix) { ++msgLineNum; ShouldBreak(); strmWriter.Write(new string('\t', indentCount)); strmWriter.Write(indentPrefix + indentCount + indentPostfix + info + " "); strmWriter.Write(v.dbug_FullElementDescription()); strmWriter.Write("\r\n"); strmWriter.Flush(); }
public dbugLayoutMsg(RenderElement ve, string msg) { this.owner = ve; this.msg = msg; if (ve == null) { this.msgOwnerKind = dbugLayoutMsgOwnerKind.Unknown; } else { this.msgOwnerKind = dbugLayoutMsgOwnerKind.VisualElement; } }
RenderElement IParentLink.FindOverlapedChildElementAtPoint(RenderElement afterThisChild, Point point) { //called from child node if (this._MayHasOverlapChild()) { var child_internalLinkedNode = afterThisChild.internalLinkedNode; if (child_internalLinkedNode == null) { return null; } var curnode = child_internalLinkedNode.Previous; while (curnode != null) { var element = curnode.Value; if (element.Contains(point)) { return element; } curnode = curnode.Previous; } } return null; }
public override void InsertAfter(RenderElement afterElem, RenderElement renderE) { _defaultLayer.InsertChildAfter(afterElem, renderE); }
public virtual void AddChild(RenderElement renderE) { }
public abstract void AddToLayoutQueue(RenderElement renderElement);
public void Add(RenderElement ve, string msg) { this.Add(new dbugLayoutMsg(ve, msg)); }
void dbugWriteStopGfxBubbleUp(RenderElement fromElement, ref int dbug_ncount, int nleftOnStack, string state_str) { RootGraphic dbugMyroot = this; if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { if (this.dbugNeedContentArrangement || this.dbugNeedReCalculateContentSize) { state_str = "!!" + state_str; } dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo(state_str, fromElement); while (dbug_ncount > nleftOnStack) { dbugMyroot.dbugGraphicInvalidateTracer.PopElement(); dbug_ncount--; } } }
public void dbug_AddDrawElement(RenderElement visualElement, Canvas currentCanvas, string additionalMsg) { StringBuilder stBuilder = new StringBuilder(); stBuilder.Append(new string('.', dbug_drawLevel)); stBuilder.Append("[" + dbug_drawLevel + "] c_" + currentCanvas.debug_canvas_id + " "); stBuilder.Append(visualElement.dbug_FullElementDescription()); Rectangle r = visualElement.dbugGetGlobalRect(); stBuilder.Append(" global(" + r.X + "," + r.Y + "," + r.Width + "," + r.Height + ")"); Rectangle currentClipRect = currentCanvas.CurrentClipRect; stBuilder.Append(" clip(" + currentClipRect.X + "," + currentClipRect.Y + "," + currentClipRect.Width + "," + currentClipRect.Height + ") "); if (visualElement.dbugParentVisualElement != null) { stBuilder.Append(" of " + visualElement.dbugParentVisualElement.dbug_FullElementDescription()); } dbug_rootDrawingMsg.AddLast(new dbugLayoutMsg(visualElement, stBuilder.ToString())); if (additionalMsg != null) { stBuilder.Length = 0; stBuilder.Append(new string('.', dbug_drawLevel)); stBuilder.Append("[" + dbug_drawLevel + "] c:" + currentCanvas.debug_canvas_id + " "); stBuilder.Append(visualElement.dbug_FullElementDescription()); dbug_rootDrawingMsg.AddLast(new dbugLayoutMsg(visualElement, stBuilder.ToString())); } }
public static void dbug_EnterReArrangeContent(RenderElement v) { var debugVisualLay = dbugGetLayoutTracer(); if (debugVisualLay == null) return; debugVisualLay.PushVisualElement(v); debugVisualLay.WriteInfo(v, "ARR_INNER", ">>", "&"); }
public override void RemoveChild(RenderElement renderE) { if (this.defaultLayer != null) { this.defaultLayer.RemoveChild(renderE); } }
public override void AddChild(RenderElement renderE) { if (this.defaultLayer == null) { this.defaultLayer = new PlainLayer(this); } this.defaultLayer.AddChild(renderE); }
public void dbug_AddDrawElement(RenderElement visualElement, DrawBoard currentCanvas) { dbug_AddDrawElement(visualElement, currentCanvas, null); }
public void AddContent(RenderElement renderElement) { this.vw.AddContent(renderElement); }
public override void RemoveChild(RenderElement renderE) { _defaultLayer?.RemoveChild(renderE); }
public override void InsertBefore(RenderElement beforeElem, RenderElement renderE) { _defaultLayer.InsertChildBefore(beforeElem, renderE); }
public void PushVisualElement(RenderElement v) { elementStack.Push(v); BeginNewContext(); }
public static void dbug_ExitTopDownReCalculateContent(RenderElement v) { var debugVisualLay = dbugGetLayoutTracer(); if (debugVisualLay == null) return; debugVisualLay.WriteInfo(v, "<<TOPDOWN_RECAL_CONTENT ", "-", "&"); debugVisualLay.PopVisualElement(); }
public virtual void RemoveChild(RenderElement renderE) { }
protected static void debug_PopTopDownElement(RenderElement ve) { }
public void InvalidateGraphicArea(RenderElement fromElement, ref Rectangle elemClientRect, bool passSourceElem = false) { //total bounds = total bounds at level if (this.IsInRenderPhase) { return; } //-------------------------------------- //bubble up ,find global rect coord //and then merge to accumulate rect //int globalX = 0; //int globalY = 0; _hasRenderTreeInvalidateAccumRect = true;//*** Point globalPoint = new Point(); #if DEBUG //if (fromElement.dbug_ObjectNote == "panel") //{ //} int dbug_ncount = 0; dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, dbug_ncount, ">> :" + elemClientRect.ToString()); #endif do { if (!fromElement.Visible) { #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "EARLY-RET: "); #endif return; } else if (fromElement.BlockGraphicUpdateBubble) { #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "BLOCKED2: "); #endif return; } #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, dbug_ncount, ">> "); #endif globalPoint.Offset(fromElement.X, fromElement.Y); if (fromElement.MayHasViewport && passSourceElem) { elemClientRect.Offset(globalPoint); //**** #if DEBUG //TODO: review here if (fromElement.HasDoubleScrollableSurface) { //container.VisualScrollableSurface.WindowRootNotifyInvalidArea(elementClientRect); } #endif Rectangle elementRect = fromElement.RectBounds; elementRect.Offset(fromElement.ViewportLeft, fromElement.ViewportTop); if (fromElement.NeedClipArea) { elemClientRect.Intersect(elementRect); } globalPoint.X = -fromElement.ViewportLeft; //reset ? globalPoint.Y = -fromElement.ViewportTop; //reset ? } if (fromElement.IsTopWindow) { break; } else { #if DEBUG if (fromElement.dbugParentVisualElement == null) { dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "BLOCKED3: "); } #endif IParentLink parentLink = fromElement.MyParentLink; if (parentLink == null) { return; } parentLink.AdjustLocation(ref globalPoint); //move up fromElement = parentLink.ParentRenderElement; if (fromElement == null) { return; } } passSourceElem = true; } while (true); #if DEBUG var dbugMyroot = this; if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { while (dbug_ncount > 0) { dbugMyroot.dbugGraphicInvalidateTracer.PopElement(); dbug_ncount--; } } #endif //---------------------------------------- elemClientRect.Offset(globalPoint); if (elemClientRect.Top > this.Height || elemClientRect.Left > this.Width || elemClientRect.Bottom < 0 || elemClientRect.Right < 0) { //no intersect with #if DEBUG if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("ZERO-EEX"); dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("\r\n"); } #endif return; } //-------------------------------------------------------------------------------------------------- if (!_hasAccumRect) { _accumulateInvalidRect = elemClientRect; _hasAccumRect = true; } else { _accumulateInvalidRect = Rectangle.Union(_accumulateInvalidRect, elemClientRect); } #if DEBUG if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { string state_str = "ACC: "; if (this.dbugNeedContentArrangement || this.dbugNeedReCalculateContentSize) { state_str = "!!" + state_str; } dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("ACC: " + _accumulateInvalidRect.ToString()); dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("\r\n"); } #endif }
public void dbug_PushLayoutTraceMessage(dbugVisualRootMsg msg, RenderElement ve) { if (dbugLastestDebugVisualLay != null) { dbugLastestDebugVisualLay.WriteInfo(msg.msg, ve); } }
public abstract void SetCurrentKeyboardFocus(RenderElement renderElement);
public virtual void InsertAfter(RenderElement afterElem, RenderElement renderE) { _elements.InsertChildAfter(this, afterElem, renderE); }
public virtual void RemoveChild(RenderElement renderE) { _elements?.RemoveChild(this, renderE); }
static Point GetGlobalLocationStatic(RenderElement re) { RenderElement parentVisualElement = re.ParentRenderElement; if (parentVisualElement != null) { Point parentGlobalLocation = GetGlobalLocationStatic(parentVisualElement); re.parentLink.AdjustLocation(ref parentGlobalLocation); if (parentVisualElement.MayHasViewport) { return new Point( re.b_left + parentGlobalLocation.X - parentVisualElement.ViewportX, re.b_top + parentGlobalLocation.Y - parentVisualElement.ViewportY); } else { return new Point(re.b_left + parentGlobalLocation.X, re.b_top + parentGlobalLocation.Y); } } else { return re.Location; } }
// public override void AddChild(RenderElement renderElement) { _vw.AddChild(renderElement); }
public static void RemoveParentLink(RenderElement childElement) { childElement.parentLink = null; }
public void AddChild(RenderElement renderE) { }
public virtual void InsertBefore(RenderElement beforeElem, RenderElement renderE) { _elements.InsertChildBefore(this, beforeElem, renderE); }
//============================================================== //set location and size , not bubble*** public static void DirectSetSize(RenderElement visualElement, int width, int height) { visualElement.b_width = width; visualElement.b_height = height; }
public static void DrawChildContent(HitTestHint hitTestHint, IEnumerable <RenderElement> drawingIter, DrawBoard d, UpdateArea updateArea) { int enter_canvas_x = d.OriginX; int enter_canvas_y = d.OriginY; switch (hitTestHint) { default: { foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea) || !child.NeedClipArea) { //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } } //restore d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; case HitTestHint.HorizontalRowNonOverlap: { bool found = false; foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea)) { found = true; //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } else if (found) { break; } } //restore d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; case HitTestHint.VerticalColumnNonOverlap: { bool found = false; foreach (RenderElement child in drawingIter) { if (child.IntersectsWith(updateArea)) { found = true; //if the child not need clip //its children (if exist) may intersect int x = child.X; int y = child.Y; d.SetCanvasOrigin(enter_canvas_x + x, enter_canvas_y + y); updateArea.Offset(-x, -y); RenderElement.Render(child, d, updateArea); updateArea.Offset(x, y); } else if (found) { break; } } d.SetCanvasOrigin(enter_canvas_x, enter_canvas_y); } break; } }
public static void DirectSetLocation(RenderElement visualElement, int x, int y) { visualElement.b_left = x; visualElement.b_top = y; }
public override void AddChild(RenderElement renderElement, object owner) { _vw.AddChild(renderElement, owner); }
//------------------------------------------------------------------------- protected static void dbug_EnterTopDownReCalculateContent(RenderElement v) { var debugVisualLay = dbugGetLayoutTracer(); if (debugVisualLay == null) return; debugVisualLay.PushVisualElement(v); debugVisualLay.WriteInfo(v, ">>TOPDOWN_RECAL_CONTENT ", "-", "&"); }
public static void dbug_SetInitObject(RenderElement ve) { dbugInitObject = ve; }
// public abstract void AddChild(RenderElement renderElement);
public static void dbug_ExitReArrangeContent(RenderElement ve) { var debugVisualLay = dbugGetLayoutTracer(); if (debugVisualLay == null) return; RenderElement v = (RenderElement)debugVisualLay.PeekElement(); debugVisualLay.WriteInfo(v, "ARR_INNER", "<<", "&"); debugVisualLay.PopVisualElement(); }
public abstract void AddChild(RenderElement renderElement, object owner);
public void dbug_AddDrawElement(RenderElement visualElement, Canvas currentCanvas) { dbug_AddDrawElement(visualElement, currentCanvas, null); }
//------- public TopWindowEventRoot(RenderElement topRenderElement) { this.iTopBoxEventPortal = this.topWinBoxEventPortal = new RenderElementEventPortal(topRenderElement); this.rootgfx = topRenderElement.Root; this.hoverMonitoringTask = new UIHoverMonitorTask(OnMouseHover); }
public void dbug_PushInvalidateMsg(dbugVisualRootMsg msg, RenderElement ve) { if (this.dbugEnableGraphicInvalidateTrace && dbugGraphicInvalidateTracer != null) { dbugGraphicInvalidateTracer.WriteInfo(msg.msg, ve); } }
public static void AddChild(this RenderElement renderBox, UIElement ui) { renderBox.AddChild(ui.GetPrimaryRenderElement(renderBox.Root)); }
public void dbug_LayoutTraceEndContext(dbugVisualRootMsg msg, RenderElement ve) { if (dbugLastestDebugVisualLay != null) { dbugLastestDebugVisualLay.WriteInfo(msg.msg, ve); dbugLastestDebugVisualLay.EndCurrentContext(); } }
public void InvalidateGraphicArea(RenderElement fromElement, ref Rectangle elemClientRect) { //total bounds = total bounds at level if (this.IsInRenderPhase) { return; } //-------------------------------------- //bubble up ,find global rect coord //and then merge to accumulate rect //int globalX = 0; //int globalY = 0; Point globalPoint = new Point(); bool isBubbleUp = false; #if DEBUG int dbug_ncount = 0; dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, dbug_ncount, ">> :" + elemClientRect.ToString()); #endif do { if (!fromElement.Visible) { #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "EARLY-RET: "); #endif return; } else if (fromElement.BlockGraphicUpdateBubble) { #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "BLOCKED2: "); #endif return; } //--------------------------------------------------------------------- #if DEBUG dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, dbug_ncount, ">> "); #endif globalPoint.Offset(fromElement.X, fromElement.Y); //globalX += fromElement.BubbleUpX; //globalY += fromElement.BubbleUpY; if (fromElement.MayHasViewport && isBubbleUp) { //elemClientRect.Offset(globalX, globalY); elemClientRect.Offset(globalPoint); if (fromElement.HasDoubleScrollableSurface) { //container.VisualScrollableSurface.WindowRootNotifyInvalidArea(elementClientRect); } Rectangle elementRect = fromElement.RectBounds; elementRect.Offset(fromElement.ViewportX, fromElement.ViewportY); elemClientRect.Intersect(elementRect); globalPoint.X = -fromElement.ViewportX; globalPoint.Y = -fromElement.ViewportY; //globalX = -fromElement.ViewportX; //globalY = -fromElement.ViewportY; } if (fromElement.IsTopWindow) { break; } else { #if DEBUG if (fromElement.dbugParentVisualElement == null) { dbugWriteStopGfxBubbleUp(fromElement, ref dbug_ncount, 0, "BLOCKED3: "); } #endif var parentLink = fromElement.MyParentLink; if (parentLink == null) { return; } parentLink.AdjustLocation(ref globalPoint); //move up fromElement = parentLink.ParentRenderElement;// fromElement.ParentRenderElement; if (fromElement == null) { return; } } isBubbleUp = true; } while (true); #if DEBUG var dbugMyroot = this; if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { while (dbug_ncount > 0) { dbugMyroot.dbugGraphicInvalidateTracer.PopElement(); dbug_ncount--; } } #endif //---------------------------------------- //elemClientRect.Offset(globalX, globalY); elemClientRect.Offset(globalPoint); if (elemClientRect.Top > this.Height || elemClientRect.Left > this.Width || elemClientRect.Bottom < 0 || elemClientRect.Right < 0) { //no intersect with #if DEBUG if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("ZERO-EEX"); dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("\r\n"); } #endif return; } //-------------------------------------------------------------------------------------------------- if (!hasAccumRect) { accumulateInvalidRect = elemClientRect; hasAccumRect = true; } else { accumulateInvalidRect = Rectangle.Union(accumulateInvalidRect, elemClientRect); } #if DEBUG if (dbugMyroot.dbugEnableGraphicInvalidateTrace && dbugMyroot.dbugGraphicInvalidateTracer != null) { string state_str = "ACC: "; if (this.dbugNeedContentArrangement || this.dbugNeedReCalculateContentSize) { state_str = "!!" + state_str; } dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("ACC: " + accumulateInvalidRect.ToString()); dbugMyroot.dbugGraphicInvalidateTracer.WriteInfo("\r\n"); } #endif }
// protected static void DirectSetRootGraphics(RenderElement r, RootGraphic rootgfx) { r._rootGfx = rootgfx; }