public RenderElementBridgeCssBox(BoxSpec spec, RenderElement containerElement, RootGraphic rootgfx) : base(spec, rootgfx) { this.containerElement = containerElement; }
public RenderElementEventPortal(RenderElement topRenderElement) { this.topRenderElement = topRenderElement; #if DEBUG dbugRootGraphics = (MyRootGraphic)topRenderElement.Root; #endif }
protected virtual void BuildChildrenRenderElement(RenderElement parent) { parent.HasSpecificHeight = this.HasSpecificHeight; parent.HasSpecificWidth = this.HasSpecificWidth; parent.SetController(this); parent.SetVisible(this.Visible); #if DEBUG //if (dbugBreakMe) //{ // renderE.dbugBreak = true; //} #endif parent.SetLocation(this.Left, this.Top); if (parent is CustomRenderBox) { ((CustomRenderBox)parent).BackColor = backColor; } parent.HasSpecificSize = true; parent.SetViewport(this.ViewportX, this.ViewportY); //------------------------------------------------ //create visual layer int childCount = this.ChildCount; for (int m = 0; m < childCount; ++m) { parent.AddChild(this.GetChild(m)); } //set primary render element //--------------------------------- }
public void RemoveChild(RenderElement re) { myElements.Remove(re.internalLinkedNode); re.internalLinkedNode = null; var bounds = re.RectBounds; RenderElement.SetParentLink(re, null); RenderElement.InvalidateGraphicLocalArea(this.OwnerRenderElement, bounds); }
public RenderElementLayer(RenderElement owner) { this.owner = owner; #if DEBUG this.dbug_layer_id = dbug_layer_id_count; ++dbug_layer_id_count; #endif }
public override void AddElement(Material material, RenderElement element) { if (material.IsFoliage) { FoliageElementManager mgr = (FoliageElementManager)ElementManagers[RenderPass.Foliage]; mgr.AddElement(material, element); } SceneElementManager sceneMgr = (SceneElementManager)ElementManagers[RenderPass.Scene]; sceneMgr.AddElement(material, element); }
public static CssBox CreateWrapper(object owner, RenderElement renderElement, BoxSpec spec, bool isInline) { var portalEvent = owner as IEventPortal; if (portalEvent == null) { portalEvent = new RenderElementEventPortal(renderElement); } if (isInline) { return new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperInlineCssBox(portalEvent, spec, renderElement.Root, renderElement); } else { return new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperBlockCssBox(portalEvent, spec, renderElement); } }
public GridLayer(RenderElement owner, int nColumns, int nRows, CellSizeStyle cellSizeStyle) : base(owner) { this.cellSizeStyle = cellSizeStyle; this.gridTable = new GridTable(); gridRows = gridTable.Rows; gridCols = gridTable.Columns; int columnWidth = owner.Width; if (nColumns > 0) { columnWidth = columnWidth / nColumns; uniformCellWidth = columnWidth; if (columnWidth < 1) { columnWidth = 1; } } //------------------------------------------------------------ int cx = 0; for (int c = 0; c < nColumns; c++) { GridColumn col = new GridColumn(columnWidth); col.Width = columnWidth; col.Left = cx; cx += columnWidth; gridCols.Add(col); } //------------------------------------------------------------ if (nRows > 0) { int rowHeight = owner.Height / nRows; int cy = 0; for (int r = 0; r < nRows; r++) { var row = new GridRow(rowHeight); gridRows.Add(row); row.Height = rowHeight; row.Top = cy; cy += rowHeight; } uniformCellHeight = rowHeight; } //------------------------------------------------------------ }
public override void AddElement(Material material, RenderElement element) { if (material.IsTranslucent) { PostProcessElementManager ppMgr = (PostProcessElementManager)ElementManagers[RenderPass.PostProcess]; ppMgr.AddElement(material, element); /* SceneElementManager gbufferTrans = (SceneElementManager)ElementManagers[RenderPass.TransparentGBuffer]; SceneElementManager colorTrans = (SceneElementManager)ElementManagers[RenderPass.TransparentColor]; gbufferTrans.AddElement(material, element); colorTrans.AddElement(material, element); */ } else { if (material.IsDoubleSided) { SceneElementManager doubleMgr = (SceneElementManager)ElementManagers[RenderPass.SceneNoCull]; doubleMgr.AddElement(material, element); } /* if (material.IsFoliage) { FoliageElementManager mgr = (FoliageElementManager)ElementManagers[RenderPass.Foliage]; mgr.AddElement(material, element); }*/ if (material.IsEmissive) { Material mat = ResourceManager.Inst.GetMaterial(material.EmissiveMaterial); if (mat == null) mat = material; SceneElementManager glowMgr = (SceneElementManager)ElementManagers[RenderPass.Emissive]; glowMgr.AddElement(mat, element); } else { SceneElementManager sceneMgr = (SceneElementManager)ElementManagers[RenderPass.Scene]; sceneMgr.AddElement(material, element); } } }
public override void AddElement(Material material, RenderElement element) { if (material.IsTranslucent) { //TransparentElementManager transMgr = (TransparentElementManager)ElementManagers[RenderPass.Translucent]; //transMgr.AddElement(material, element); } else { if (material.IsEmissive) { //We don't render glowy materials in reflections... } else { SceneElementManager sceneMgr = (SceneElementManager)ElementManagers[RenderPass.Scene]; sceneMgr.AddElement(material, element); } } }
public void AddContent(RenderElement vi, object owner) { if (vi is RenderBoxBase) { if (owner is ITopWindowBox) { var topWinBox = owner as ITopWindowBox; if (topWinBox.PlatformWinBox == null) { //create platform winbox var newForm = new AbstractCompletionWindow(); newForm.LinkedParentForm = this.FindForm(); newForm.LinkedParentControl = this; UISurfaceViewportControl newSurfaceViewport = this.CreateNewOne(300, 200); newSurfaceViewport.Location = new System.Drawing.Point(0, 0); newForm.Controls.Add(newSurfaceViewport); vi.ResetRootGraphics(newSurfaceViewport.RootGfx); vi.SetLocation(0, 0); newSurfaceViewport.AddContent(vi); //------------------------------------------------------ var platformWinBox = new PlatformWinBoxForm(newForm); topWinBox.PlatformWinBox = platformWinBox; platformWinBox.UseRelativeLocationToParent = true; subForms.Add(newForm); } } else { this.rootgfx.TopWindowRenderBox.AddChild(vi); } } else { this.rootgfx.TopWindowRenderBox.AddChild(vi); } }
public CssBox BuildCssRenderTree(WebDocument webdoc, CssActiveSheet cssActiveSheet, RenderElement containerElement) { HtmlDocument htmldoc = webdoc as HtmlDocument; if (htmldoc == null) { //TODO: fixed here throw new NotSupportedException(); } htmldoc.CssActiveSheet = cssActiveSheet; htmldoc.SetDocumentState(DocumentState.Building); //---------------------------------------------------------------- TopDownActiveCssTemplate activeTemplate = new TopDownActiveCssTemplate(cssActiveSheet); PrepareStylesAndContentOfChildNodes((HtmlElement)htmldoc.RootNode, activeTemplate); //---------------------------------------------------------------- RootGraphic rootgfx = (containerElement != null) ? containerElement.Root : null; //TODO: review here, we should create cssbox at document.body? CssBox bridgeBox = HtmlHost.CreateBridgeBox(TextServices.IFonts, containerElement, rootgfx); ((HtmlElement)htmldoc.RootNode).SetPrincipalBox(bridgeBox); htmlHost.UpdateChildBoxes((HtmlRootElement)htmldoc.RootNode, true); htmldoc.SetDocumentState(DocumentState.Idle); //---------------------------------------------------------------- //SetTextSelectionStyle(htmlCont, cssData); return bridgeBox; }
public void AddHitObject(RenderElement hitObject) { hitList.Add(new HitInfo(hitObject, new Point(testPointX, testPointY))); #if DEBUG if (dbugHitTracker != null) { dbugHitTracker.WriteTrackNode(hitList.Count, new Point(testPointX, testPointY).ToString() + " on " + hitObject.ToString()); } #endif }
public void AddChild(RenderElement re) { re.internalLinkedNode = myElements.AddLast(re); RenderElement.SetParentLink(re, this.owner); re.InvalidateGraphics(); }
//---------------------------------------------------- public void OpenHinge() { if (isOpen) return; this.isOpen = true; //----------------------------------- if (this.primElement == null) return; if (floatPart == null) return; switch (floatPartStyle) { default: case HingeFloatPartStyle.Popup: { //add float part to top window layer var topRenderBox = primElement.GetTopWindowRenderBox(); if (topRenderBox != null) { Point globalLocation = primElement.GetGlobalLocation(); floatPart.SetLocation(globalLocation.X, globalLocation.Y + primElement.Height); this.floatPartRenderElement = this.floatPart.GetPrimaryRenderElement(primElement.Root); topRenderBox.AddChild(floatPartRenderElement); } } break; case HingeFloatPartStyle.Embeded: { } break; } }
void SetupHorizontalScrollButtonProperties(RenderElement container) { var scroll_button = new ScrollBarButton(10, this.Height, this); //create with default value scroll_button.BackColor = KnownColors.FromKnownColor(KnownColor.DarkBlue); int thumbPosX = CalculateThumbPosition() + minmax_boxHeight; scroll_button.SetLocation(thumbPosX, 0); container.AddChild(scroll_button); this.scrollButton = scroll_button; //---------------------------- EvaluateHorizontalScrollBarProperties(); //---------------------------- //3. drag scroll_button.MouseDrag += (s, e) => { //dragging ... //find x-diff Point pos = scroll_button.Position; //if vscroll bar then move only y axis int newXPos = (int)(pos.X + e.DiffCapturedX); //clamp! if (newXPos >= this.Width - (minmax_boxHeight + scrollButton.Width)) { newXPos = this.Width - (minmax_boxHeight + scrollButton.Width); } else if (newXPos < minmax_boxHeight) { newXPos = minmax_boxHeight; } //calculate value from position int currentMarkAt = (newXPos - minmax_boxHeight); this.scrollValue = (float)(onePixelFor * currentMarkAt); newXPos = CalculateThumbPosition() + minmax_boxHeight; scroll_button.SetLocation(newXPos, pos.Y); if (this.UserScroll != null) { this.UserScroll(this, EventArgs.Empty); } e.StopPropagation(); }; }
public RenderElementRequest(RenderElement ve, RequestCommand req) { this.ve = ve; this.req = req; this.parameters = null; }
/// <summary> /// Renders a paragraph. /// </summary> /// <param name="text">The text to render.</param> /// <param name="width">The available width.</param> /// <param name="maxUsedWidth">Maximum width of the used.</param> /// <param name="yOffset">The y offset.</param> /// <returns></returns> private List <List <List <int> > > renderParagraph(string text, int width, ref int maxUsedWidth, int yOffset = 0) { List <List <List <int> > > lines = new List <List <List <int> > >(); if (width > 0) { string[] words = GetWordsOfString(text); List <List <int> > currentLine = new List <List <int> >(); int availableWidth = width; int peX, peY, peW, peH = 0; peX = peY = peW = peH; peY = yOffset + lines.Count * (BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT); peX = width - availableWidth; RenderElement pe = new RenderElement(peX, peY, peW, peH, text); pe.Type = BrailleRendererPartType.PARAGRAPH; foreach (var word in words) { #region Rendering Element int eX, eY, eW, eH = 0; eX = eY = eW = eH; eY = yOffset + lines.Count * (BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT); eX = width - availableWidth; RenderElement e = new RenderElement(eX, eY, eW, eH, word); e.Type = BrailleRendererPartType.WORD; #endregion // get the dot patterns for that word List <List <int> > dots = getBrailleFromString(word); // check if the line has still some entries // if so, add a space char or open a new line if (currentLine.Count > 0) { // check if the line is full if (getMaxWidthOfString(currentLine) >= width) { makeNewLine(ref lines, ref currentLine, ref availableWidth, width, ref maxUsedWidth); } else { // add a space currentLine.Add(new List <int>()); availableWidth -= INTER_CHAR_WIDTH + BRAILLE_CHAR_WIDTH; } } //check if it fits into the available space if (!fitsWordInRestOfLine(dots, availableWidth)) //no { makeNewLine(ref lines, ref currentLine, ref availableWidth, width, ref maxUsedWidth); } e.X = width - availableWidth; e.Y = yOffset + lines.Count * (BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT); int minWidth = getMinWidthOfString(dots); if (minWidth > width) { //this will start a new line, so add a new line to the y position e.Y += BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT; //split the word into several lines List <List <List <int> > > wordLines = splitWordOverLines(dots, width, ref e); if (wordLines != null && wordLines.Count > 0) { //remove empty line if generated twice if (lines.Count > 0 && lines[lines.Count - 1].Count == 0) { lines.Remove(lines[Math.Max(0, lines.Count - 1)]); } // add them to the lines lines.AddRange(wordLines); //set the current line currentLine = lines[lines.Count - 1]; //remove from list so it will not added twice lines.Remove(currentLine); //update the available size availableWidth = width - getMinWidthOfString(currentLine); } } else { //fill the word into the line currentLine.AddRange(dots); e.Width = minWidth + INTER_CHAR_WIDTH; e.Height = BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT; //update the available width availableWidth -= getMinWidthOfString(dots) + INTER_CHAR_WIDTH; } #region Rendering Element pe.AddSubPart(e); #endregion } lines.Add(currentLine); // update the maxUsed Width maxUsedWidth = Math.Max(maxUsedWidth, (width - availableWidth)); elements.AddLast(pe); } return(lines); }
/// <summary> /// Splits one word over several lines if it is to long to fit in one line. /// </summary> /// <param name="dots">The dot patterns of the word. /// (List of characters) List [ /// (List of raised pins in one Braille cell) List [dot pattern] /// ]</param> /// <param name="width">The width.</param> /// <param name="parentElement">The parent element.</param> /// <returns> /// A list of lines for the split word. /// (List of lines) List [ /// (List of characters) List [ /// (List of raised pins in one Braille cell) List [dot pattern] /// ] /// ] /// </returns> private static List <List <List <int> > > splitWordOverLines(List <List <int> > dots, int width, ref RenderElement parentElement) { List <List <List <int> > > lines = new List <List <List <int> > >(); if (dots != null && width > BRAILLE_CHAR_WIDTH) { //Split the word char list in peaces width max length of 'width' int count = getMaxCountOfChars(width); if (count > 0) { string parVal = parentElement.GetValue() != null?parentElement.GetValue().ToString() : String.Empty; int i = 0; while (i < dots.Count) { int l = (i + count) < dots.Count ? count : (dots.Count - i); List <List <int> > subList = dots.GetRange(i, l); // create sub value string val = !String.IsNullOrEmpty(parVal) && parVal.Length > i? parVal.Substring(i, (parVal.Length > (i + l) ? l : parVal.Length - i) ) : String.Empty; // create sub element for each part RenderElement se = new RenderElement( parentElement.X, parentElement.Y + (lines.Count * (BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT)), getMinWidthOfString(subList), (BRAILLE_CHAR_HEIGHT + INTER_LINE_HEIGHT), val, parentElement ); parentElement.AddSubPart(se); se.Type = BrailleRendererPartType.WORD_PART; lines.Add(subList); i += count; } } } return(lines); }
public void AddChild(RenderElement parent, RenderElement re) { re._internalLinkedNode = _myElements.AddLast(re); RenderElement.SetParentLink(re, parent); re.InvalidateGraphics(); }
public void SetRenderElement(RenderElement renderE) { _renderElem = renderE; }
public void InsertChildAfter(RenderElement parent, RenderElement after, RenderElement re) { re._internalLinkedNode = _myElements.AddAfter(after._internalLinkedNode, re); RenderElement.SetParentLink(re, parent); re.InvalidateGraphics(); }
public void InsertChildBefore(RenderElement parent, RenderElement before, RenderElement re) { re._internalLinkedNode = _myElements.AddBefore(before._internalLinkedNode, re); RenderElement.SetParentLink(re, parent); re.InvalidateGraphics(); }
public static void AddChild(this RenderElement renderBox, UIElement ui) { renderBox.AddChild(ui.GetPrimaryRenderElement(renderBox.Root)); }
public void AddChild(RenderElement re) { re.internalLinkedNode = myElements.AddLast(re); RenderElement.SetParentLink(re, this.owner); re.InvalidateGraphics(); }
/// <summary> /// Makes the entry visible in the given view. /// If an entry is outside the visible area and the view is <see cref="BrailleIO.Interface.IPannable" />, /// the offsets are adapted to make the entry visible. /// </summary> /// <param name="renderedEntry">The rendered entry.</param> /// <param name="view">The view.</param> /// <param name="vertical">if set to <c>true</c> adapt view in vertical direction.</param> /// <param name="horizontal">if set to <c>true</c> adapt view in horizontal direction.</param> /// <returns> /// <c>true</c> if the entry would be visible; otherwise, <c>false</c>. /// </returns> /// <remarks> /// After a returning <c>true</c> you have to force an rerendering. /// </remarks> public virtual bool MakeEntryVisible(RenderElement renderedEntry, IViewBoxModel view = null, bool vertical = true, bool horizontal = false) { bool success = false; if (!renderedEntry.IsEmpty() && (vertical || horizontal)) { if (view == null) { view = _lastView; } if (view != null && view.ContentBox.Width * view.ContentBox.Height > 0) { int visibility = IsEntryVisible(renderedEntry, view); if (visibility > 0) { return(true); } else { if (view is IPannable) { // entry position Rectangle bbox = new Rectangle( renderedEntry.X, renderedEntry.Y, renderedEntry.Width, renderedEntry.Height); // visible view port Rectangle viewPort = new Rectangle( -((IPannable)view).GetXOffset(), -((IPannable)view).GetYOffset(), view.ContentBox.Width, view.ContentBox.Height); // check if item is selected --> add one more line for marking var entry = renderedEntry.GetValue() as DialogEntry; if (entry != null && entry.Status.HasFlag(DialogEntryStatus.Selected)) { bbox.Height += 1; } // check for scrolling directions /************** vertical ***********/ if (vertical) { if (bbox.Top < viewPort.Top) //entry starts over the view port // move upwards { viewPort.Y = bbox.Y; } else if (bbox.Bottom > viewPort.Bottom) // entry ends after the view port // move downwards? { int newY = viewPort.Top + (bbox.Bottom - viewPort.Bottom); viewPort.Y = Math.Min(bbox.Top, newY); } ((IPannable)view).SetYOffset(-viewPort.Y); success = ((IPannable)view).GetYOffset() == -viewPort.Y; } /************ horizontal ***********/ if (horizontal) { if (bbox.Left < viewPort.Left) // move right { viewPort.X = bbox.X; } else if (bbox.Right > viewPort.Right) // move left? { int newX = viewPort.Left + (bbox.Right - viewPort.Right); viewPort.X = Math.Min(bbox.Left, newX); } ((IPannable)view).SetXOffset(-viewPort.X); success = true; } } } } } return(success); }
public PlainLayer(RenderElement owner) : base(owner) { }
internal static int GetLayoutSpecificDimensionType(RenderElement visualElement) { return(visualElement._uiLayoutFlags & 0x3); }
public GridLayer(RenderElement owner, CellSizeStyle cellSizeStyle, GridTable gridTable) : base(owner) { _cellSizeStyle = cellSizeStyle; _gridTable = gridTable; _gridRows = gridTable.Rows; _gridCols = gridTable.Columns; int nColumns = gridTable.ColumnCount; if (cellSizeStyle == CellSizeStyle.ColumnAndRow) { int cx = 0; for (int c = 0; c < nColumns; c++) { GridColumn col = _gridCols.GetColumn(c); int col_w = col.Width; col.Left = cx; cx += col_w; } //------------------------------------------------------------ int nRows = gridTable.RowCount; if (nRows > 0) { int cy = 0; int row_h = 1; for (int r = 0; r < nRows; r++) { GridRow row = _gridRows.GetRow(r); row_h = row.Height; row.Height = row_h; row.Top = cy; cy += row_h; } _uniformCellHeight = row_h; } } else { int columnWidth = owner.Width; if (nColumns > 0) { columnWidth = columnWidth / nColumns; _uniformCellWidth = columnWidth; if (columnWidth < 1) { columnWidth = 1; } } //------------------------------------------------------------ int cx = 0; for (int c = 0; c < nColumns; c++) { GridColumn col = _gridCols.GetColumn(c); col.Width = columnWidth; col.Left = cx; cx += columnWidth; } //------------------------------------------------------------ int nRows = gridTable.RowCount; if (nRows > 0) { int rowHeight = owner.Height / nRows; int cy = 0; for (int r = 0; r < nRows; r++) { GridRow row = _gridRows.GetRow(r); row.Height = rowHeight; row.Top = cy; cy += rowHeight; } _uniformCellHeight = rowHeight; } } //------------------------------------------------------------ }
public RenderElementRequest(RenderElement ve, RequestCommand req) { this.ve = ve; this.req = req; this.parameters = null; }
public PlainLayer(RenderElement owner) : base(owner) { }
public RenderElementRequest(RenderElement ve, RequestCommand req, object parameters) { this.ve = ve; this.req = req; this.parameters = parameters; }
protected abstract void InternalRender(RenderElement element, AudioPlayer audioPlayer, DrawGraphicsEventArgs renderArgs);
RenderElement RenderBoxes.IParentLink.FindOverlapedChildElementAtPoint(RenderElement afterThisChild, Point point) { return null; }
public virtual void AddElement(Material material, RenderElement element) { }
public WrapperInlineCssBox(object controller, Css.BoxSpec boxSpec, RootGraphic rootgfx, RenderElement re) : base(controller, boxSpec, re.Root, CssDisplay.Inline) { int w = re.Width; int h = re.Height; ChangeDisplayType(this, CssDisplay.Inline); this.externalRun = new CssExternalRun(re); this.externalRun.SetOwner(this); var runlist = new List<CssRun>(1); runlist.Add(externalRun); CssBox.UnsafeSetContentRuns(this, runlist, false); ChangeDisplayType(this, Css.CssDisplay.Inline); //--------------------------------------------------- LayoutFarm.RenderElement.SetParentLink(re, this); }
public HitInfo(RenderElement hitObject, Point point) { this.point = point; this.hitElement = hitObject; }
public HitInfo(RenderElement hitObject, Point point) { this.point = point; this.hitElement = hitObject; }
public void AddContent(RenderElement vi) { this.rootgfx.TopWindowRenderBox.AddChild(vi); }
public void AddContent(RenderElement vi) { this.rootgfx.TopWindowRenderBox.AddChild(vi); }
public override void AddElement(Material material, RenderElement element) { ShadowElementManager sceneMgr = (ShadowElementManager)ElementManagers[RenderPass.Shadows]; sceneMgr.AddElement(material, element); }
void IEventPortal.PortalMouseDown(UIMouseEventArgs e) { #if DEBUG if (this.dbugRootGraphics.dbugEnableGraphicInvalidateTrace) { this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================"); this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("MOUSEDOWN"); this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================"); } dbugMsgChainVersion = 1; int local_msgVersion = 1; #endif HitChain hitPointChain = GetFreeHitChain(); HitTestCoreWithChain(hitPointChain, e.X, e.Y); int hitCount = hitPointChain.Count; if (hitCount > 0) { //------------------------------ //1. origin object SetEventOrigin(e, hitPointChain); //------------------------------ var prevMouseDownElement = e.PreviousMouseDown; IUIEventListener currentMouseDown = null; //portal ForEachOnlyEventPortalBubbleUp(e, hitPointChain, (portal) => { portal.PortalMouseDown(e); //***** currentMouseDown = e.CurrentContextElement; return(true); }); //------------------------------ //use events if (!e.CancelBubbling) { e.CurrentContextElement = currentMouseDown = null; //clear ForEachEventListenerBubbleUp(e, hitPointChain, (listener) => { currentMouseDown = listener; listener.ListenMouseDown(e); //------------------------------------------------------- bool cancelMouseBubbling = e.CancelBubbling; if (prevMouseDownElement != null && prevMouseDownElement != listener) { prevMouseDownElement.ListenLostMouseFocus(e); prevMouseDownElement = null;//clear } //------------------------------------------------------- return(e.CancelBubbling || !listener.BypassAllMouseEvents); }); } if (prevMouseDownElement != currentMouseDown && prevMouseDownElement != null) { prevMouseDownElement.ListenLostMouseFocus(e); prevMouseDownElement = null; } } //--------------------------------------------------------------- #if DEBUG RootGraphic visualroot = this.dbugRootGraphics; if (visualroot.dbug_RecordHitChain) { visualroot.dbug_rootHitChainMsg.Clear(); HitInfo hitInfo; for (int i = hitPointChain.Count - 1; i >= 0; --i) { hitInfo = hitPointChain.GetHitInfo(i); RenderElement ve = hitInfo.HitElemAsRenderElement; if (ve != null) { ve.dbug_WriteOwnerLayerInfo(visualroot, i); ve.dbug_WriteOwnerLineInfo(visualroot, i); string hit_info = new string('.', i) + " [" + i + "] " + "(" + hitInfo.point.X + "," + hitInfo.point.Y + ") " + ve.dbug_FullElementDescription(); visualroot.dbug_rootHitChainMsg.AddLast(new dbugLayoutMsg(ve, hit_info)); } } } #endif ReleaseHitChain(hitPointChain); e.StopPropagation(); #if DEBUG if (local_msgVersion != dbugMsgChainVersion) { return; } visualroot.dbugHitTracker.Write("stop-mousedown"); visualroot.dbugHitTracker.Play = false; #endif }
// public override void Draw(DrawBoard d, UpdateArea updateArea) { if (_externalCustomDraw != null) { _externalCustomDraw(this, d, updateArea); return; } else if (ExternalRenderElement != null) { RenderElement.Render(ExternalRenderElement, d, updateArea); return; } int bWidth = this.Width; int bHeight = this.Height; //1. bg, yellow for test** d.FillRectangle(Color.Yellow, 0, 0, bWidth, bHeight); //if (!this.HasStyle) //{ // canvas.DrawText(_mybuffer, new Rectangle(0, 0, bWidth, bHeight), 0); //} //else //{ //TODO: review here, we don't need to do this RunStyle style = this.RunStyle; switch (EvaluateFontAndTextColor(d, style)) { case DIFF_FONT_SAME_TEXT_COLOR: { var prevFont = d.CurrentFont; d.CurrentFont = style.ReqFont; d.DrawText(_mybuffer, new Rectangle(0, 0, bWidth, bHeight), style.ContentHAlign); d.CurrentFont = prevFont; } break; case DIFF_FONT_DIFF_TEXT_COLOR: { var prevFont = d.CurrentFont; var prevColor = d.CurrentTextColor; d.CurrentFont = style.ReqFont; d.CurrentTextColor = style.FontColor; d.DrawText(_mybuffer, new Rectangle(0, 0, bWidth, bHeight), style.ContentHAlign); d.CurrentFont = prevFont; d.CurrentTextColor = prevColor; } break; case SAME_FONT_DIFF_TEXT_COLOR: { var prevColor = d.CurrentTextColor; d.DrawText(_mybuffer, new Rectangle(0, 0, bWidth, bHeight), style.ContentHAlign); d.CurrentTextColor = prevColor; } break; default: { d.DrawText(_mybuffer, new Rectangle(0, 0, bWidth, bHeight), style.ContentHAlign); } break; } //} }
public RenderElementBridgeCssBox(BoxSpec spec, RenderElement containerElement) : base(spec) { ContainerElement = containerElement; }
void SetupMaxButtonProperties(RenderElement container) { ScrollBarButton max_button; if (this.ScrollBarType == ScrollBarType.Horizontal) { max_button = new ScrollBarButton(minmax_boxHeight, this.Height, this); max_button.SetLocation(this.Width - minmax_boxHeight, 0); } else { max_button = new ScrollBarButton(this.Width, minmax_boxHeight, this); max_button.SetLocation(0, this.Height - minmax_boxHeight); } max_button.BackColor = KnownColors.FromKnownColor(KnownColor.DarkGray); max_button.MouseUp += (s, e) => this.StepSmallToMax(); container.AddChild(max_button); this.maxButton = max_button; }
void SetupHorizontalScrollButtonProperties(RenderElement container) { var scroll_button = new ScrollBarButton(10, this.Height, this); //create with default value scroll_button.BackColor = KnownColors.FromKnownColor(KnownColor.DarkBlue); int thumbPosX = CalculateThumbPosition() + minmax_boxHeight; scroll_button.SetLocation(thumbPosX, 0); container.AddChild(scroll_button); this.scrollButton = scroll_button; //---------------------------- EvaluateHorizontalScrollBarProperties(); //---------------------------- //3. drag scroll_button.MouseDrag += (s, e) => { //---------------------------------- //dragging ... //find x-diff Point pos = scroll_button.Position; //if vscroll bar then move only y axis int newXPos = (int)(pos.X + e.DiffCapturedX); //clamp! if (newXPos >= this.Width - (minmax_boxHeight + scrollButton.Width)) { newXPos = this.Width - (minmax_boxHeight + scrollButton.Width); } else if (newXPos < minmax_boxHeight) { newXPos = minmax_boxHeight; } //calculate value from position int currentMarkAt = (newXPos - minmax_boxHeight); this.scrollValue = (float)(onePixelFor * currentMarkAt); newXPos = CalculateThumbPosition() + minmax_boxHeight; scroll_button.SetLocation(newXPos, pos.Y); if (this.UserScroll != null) { this.UserScroll(this, EventArgs.Empty); } e.StopPropagation(); }; //------------------------------------------- //4. scroll_button.MouseLeave += (s, e) => { if (e.IsDragging) { Point pos = scroll_button.Position; //if vscroll bar then move only y axis int newXPos = (int)(pos.X + e.XDiff); //clamp! if (newXPos >= this.Width - (minmax_boxHeight + scrollButton.Width)) { newXPos = this.Width - (minmax_boxHeight + scrollButton.Width); } else if (newXPos < minmax_boxHeight) { newXPos = minmax_boxHeight; } //calculate value from position int currentMarkAt = (newXPos - minmax_boxHeight); this.scrollValue = (float)(onePixelFor * currentMarkAt); newXPos = CalculateThumbPosition() + minmax_boxHeight; scroll_button.SetLocation(newXPos, pos.Y); if (this.UserScroll != null) { this.UserScroll(this, EventArgs.Empty); } e.StopPropagation(); } }; }
protected static void vinv_dbug_EndSetElementBound(RenderElement ve) { var debugVisualLay = dbugGetLayoutTracer(); if (debugVisualLay == null) return; debugVisualLay.WriteInfo(dbugVisitorMessage.WITH_1.text, ve); debugVisualLay.EndCurrentContext(); }
public CssExternalRun(RenderElement externalRenderE) : base(CssRunKind.SolidContent) //act as image run**** { //in this version we make it as as image run this.externalRenderE = externalRenderE; }
public RenderElementRequest(RenderElement ve, RequestCommand req, object parameters) { this.ve = ve; this.req = req; this.parameters = parameters; }
RenderElement RenderBoxes.IParentLink.FindOverlapedChildElementAtPoint(RenderElement afterThisChild, Point point) { return(null); }
public void SetContent(int r, int c, RenderElement re) { gridLayer.GetCell(r, c).ContentElement = re; }
public void AddChild(RenderElement vi) { _rootgfx.AddChild(vi); }
void InitializeRenderElement() { renderElement = new RenderElement(); renderElement.VertexDec = CanvasVertexDeclarations.PNDec; renderElement.VertexStride = VertexPositionNormal.SizeInBytes; renderElement.StartVertex = 0; }
public override void AddElement(Material material, RenderElement element) { ShadowElementManager sceneMgr = (ShadowElementManager)((material.IsFoliage) ? ElementManagers[RenderPass.Foliage] : ElementManagers[RenderPass.Shadows]); sceneMgr.AddElement(material, element); }
void SetupMinButtonProperties(RenderElement container) { ScrollBarButton min_button; if (this.ScrollBarType == ScrollBarType.Horizontal) { min_button = new ScrollBarButton(minmax_boxHeight, this.Height, this); } else { min_button = new ScrollBarButton(this.Width, minmax_boxHeight, this); } min_button.BackColor = KnownColors.FromKnownColor(KnownColor.Green); min_button.MouseUp += (s, e) => this.StepSmallToMin(); container.AddChild(min_button); this.minButton = min_button; }
protected abstract void InternalRenderPreparation(RenderElement element, DrawGraphicsEventArgs renderArgs);