/// <summary> /// Initializes a new instance of the <see cref="BreadcrumbRenderer"/> class. /// </summary> /// <param name="brailleRenderer">The braille renderer to use.</param> public BreadcrumbRenderer(MatrixBrailleRenderer brailleRenderer = null) { lock (SynchLock) { _brailleRenderer = brailleRenderer; init(); } }
private bool[,] RenderDropDownMenuVertical(IViewBoxModel view, UiElement uiContent) {//TODO: Element muss eine Mindestgröße haben //call pre hooks object cM = uiContent.text as object; callAllPreHooks(ref view, ref cM); bool[,] boxMatrix; if (uiContent.isDisabled) { boxMatrix = Helper.createBoxDeaktivatedLeft(view.ViewBox.Height, view.ViewBox.Width - 2); } else { boxMatrix = Helper.createBox(view.ViewBox.Height, view.ViewBox.Width - 2); //erstmal eine eckige Matrix // view.ViewBox.Width -2 => da open/close noch angezeigt werden muss } DropDownMenuItem dropDownMenu = (DropDownMenuItem)uiContent.uiElementSpecialContent; //Der Type mussan dieser Stelle vorher nicht geprüft werden, da das schon in der aufrufenden Methode gemacht wurde if (dropDownMenu.hasPrevious) { //Helper.RemoveBottomBoarder(ref boxMatrix); Helper.RemoveTopBoarder(ref boxMatrix); } //String to Braille/Matrix MatrixBrailleRenderer m = new MatrixBrailleRenderer(); bool[,] textMatrix = m.RenderMatrix(view.ViewBox.Width - 4, (uiContent.text as object == null ? "" : uiContent.text as object), false); Helper.copyTextMatrixInMatrix(textMatrix, ref boxMatrix, 2); if (dropDownMenu.hasNext) { SeparatorNextDropDownMenuElementDown(ref boxMatrix); } bool[,] viewMatrix = new bool[view.ViewBox.Height, view.ViewBox.Width]; // bool[,] viewMatrix = Helper.createBox(view.ViewBox.Height - 2, view.ViewBox.Width); Helper.copyMatrixInMatrix(boxMatrix, ref viewMatrix); // macht platz in der Matrix für open/close //Anpassungen je nach spezifischen DropDownMenuItem if (dropDownMenu.hasChild) { if (dropDownMenu.isOpen) { OpenDropDownMenuElementRight(ref viewMatrix); } else { CloseDropDownMenuElementRight(ref viewMatrix); } } //call post hooks callAllPostHooks(view, cM, ref viewMatrix, false); return(viewMatrix); }
public bool[,] RenderListItem(IViewBoxModel view, UiElement uiElement) { //mehrere ListItems (als Gruppe zusammengefasst) bilden eine Liste ListMenuItem listmenuItem; if (uiElement.uiElementSpecialContent == null) { return(new bool[0, 0]); } Type typeSpecialContent = uiElement.uiElementSpecialContent.GetType(); if (typeof(ListMenuItem).Equals(typeSpecialContent)) { listmenuItem = (ListMenuItem)uiElement.uiElementSpecialContent; } else { throw new InvalidCastException("Can't cast uiElementSpecialContent to ListMenuItem! {0}"); } bool[,] matrix = new bool[view.ViewBox.Height, view.ViewBox.Width]; bool[,] text; MatrixBrailleRenderer m = new MatrixBrailleRenderer(); if (listmenuItem.hasNext) { bool[,] seperatorLine = Helper.createInterruptedLine(view.ViewBox.Width); Helper.copyMatrixInMatrix(seperatorLine, ref matrix, 0, view.ViewBox.Height - 1); } if (listmenuItem.isMultipleSelection) { bool [,] box; if (listmenuItem.isSelected) { box = Helper.createSelectedBox(4, 4); } else { box = Helper.createBox(4, 4); } Helper.copyMatrixInMatrix(box, ref matrix, 1, 1); text = m.RenderMatrix(view.ViewBox.Width - 4, (uiElement.text as object == null ? "" : uiElement.text as object), false); Helper.copyMatrixInMatrix(text, ref matrix, 6, 1); } else { text = m.RenderMatrix(view.ViewBox.Width, (uiElement.text as object == null ? "" : uiElement.text as object), false); Helper.copyMatrixInMatrix(text, ref matrix, 0, 1); } return(matrix); }
private bool[,] RenderTextBoxTextView(IViewBoxModel view, UiElement textBoxContent) { MatrixBrailleRenderer m = new MatrixBrailleRenderer(); BrailleIOViewRange tmpTextBoxView; BrailleIOMediator brailleIOMediator = BrailleIOMediator.Instance; BrailleIOScreen screen = brailleIOMediator.GetView(textBoxContent.screenName) as BrailleIOScreen; if (screen.GetViewRange("_TextBoxText_" + textBoxContent.viewName) as BrailleIOViewRange != null) { tmpTextBoxView = screen.GetViewRange("_TextBoxText_" + textBoxContent.viewName) as BrailleIOViewRange; } else { tmpTextBoxView = new BrailleIOViewRange(view.ViewBox.Left + 3, view.ViewBox.Top + 2, view.ViewBox.Width - 5, view.ViewBox.Height - 4); tmpTextBoxView.Name = "_TextBoxText_" + textBoxContent.viewName; tmpTextBoxView.SetText(textBoxContent.text); tmpTextBoxView.ShowScrollbars = textBoxContent.isScrollbarShow; } tmpTextBoxView.SetZIndex(3); bool[,] textMatrix; if (tmpTextBoxView.ContentBox.Height <= 0 || tmpTextBoxView.ContentBox.Width <= 0) { textMatrix = new bool[0, 0]; } else { textMatrix = m.RenderMatrix(tmpTextBoxView, (textBoxContent.text as object == null ? "" : textBoxContent.text as object)); } if (screen != null) { BrailleIOViewRange viewRange = screen.GetViewRange(tmpTextBoxView.Name); if (viewRange == null) { ((BrailleIOScreen)brailleIOMediator.GetView(textBoxContent.screenName)).AddViewRange(tmpTextBoxView.Name, tmpTextBoxView); viewRange = screen.GetViewRange(tmpTextBoxView.Name); } viewRange.SetText(textBoxContent.text); } return(textMatrix); }
/// <summary> /// Initializes a new instance of the <see cref="HelpTextRenderer" /> class. /// </summary> /// <param name="properties">The properties to control the rendering.</param> /// <param name="brailleRenderer">The braille renderer to use.</param> public HelpTextRenderer(HelpRenderingProperties properties = HelpRenderingProperties.ShowHaeder, MatrixBrailleRenderer brailleRenderer = null) { _properties = properties; _brailleRenderer = brailleRenderer; }
public bool[,] RenderGroup(IViewBoxModel view, UiElement groupViewRange) { //call pre hooks object cM = groupViewRange.text as object; callAllPreHooks(ref view, ref cM); bool[,] viewMatrix = new bool[0, 0];// = new bool[view.ViewBox.Height, view.ViewBox.Width]; //TODO: - Padding etc. int maxHeight = view.ViewBox.Height; int maxWidth = view.ViewBox.Width; if (groupViewRange.child != null) { getMax(ref maxHeight, ref maxWidth, groupViewRange.child); viewMatrix = new bool[maxHeight, maxWidth]; if (groupViewRange.child[0].renderer != null && groupViewRange.child[0].renderer.GetType().Equals(typeof(BrailleIOTabItemToMatrixRenderer)) && groupViewRange.child[0].childUiElement.uiElementSpecialContent != null) { if (groupViewRange.child[0].childUiElement.uiElementSpecialContent.GetType().Equals(typeof(UiElements.TabItem))) { UiElements.TabItem tabView = (UiElements.TabItem)groupViewRange.child[0].childUiElement.uiElementSpecialContent; if (tabView.orientation.Equals(UiElements.Orientation.Bottom)) { viewMatrix = Helper.createDownBorder(maxHeight, maxWidth); } if (tabView.orientation.Equals(UiElements.Orientation.Top)) { viewMatrix = Helper.createUpBorder(maxHeight, maxWidth); } if (tabView.orientation.Equals(UiElements.Orientation.Left)) { viewMatrix = Helper.createLeftBorder(maxHeight, maxWidth); } if (tabView.orientation.Equals(UiElements.Orientation.Right)) { viewMatrix = Helper.createRightBorder(maxHeight, maxWidth); } } } foreach (Groupelements child in groupViewRange.child) { BrailleIOViewRange tmpChildView = new BrailleIOViewRange(Convert.ToInt32(child.childBoundingRectangle.Left), Convert.ToInt32(child.childBoundingRectangle.Top), Convert.ToInt32(child.childBoundingRectangle.Width), Convert.ToInt32(child.childBoundingRectangle.Height)); // BrailleIOViewRange tmpChildView = new BrailleIOViewRange(0, Convert.ToInt32(child.childBoundingRectangle.Top), Convert.ToInt32(child.childBoundingRectangle.Width), Convert.ToInt32(child.childBoundingRectangle.Height)); tmpChildView.Name = "_" + child.childBoundingRectangle.ToString(); //child.childUiElement.viewName; tmpChildView.SetText(child.childUiElement.text); tmpChildView.ShowScrollbars = child.childUiElement.isScrollbarShow; bool[,] childMatrix; if (child.renderer != null) { childMatrix = child.renderer.RenderMatrix(tmpChildView, child.childUiElement as object); } else { MatrixBrailleRenderer m = new MatrixBrailleRenderer(); childMatrix = m.RenderMatrix(tmpChildView, child.childUiElement.text as object); } Helper.copyMatrixInMatrix(childMatrix, ref viewMatrix, Convert.ToInt32(child.childBoundingRectangle.TopLeft.X) - (Convert.ToInt32(view.ContentBox.X) + Convert.ToInt32(view.ViewBox.X)), Convert.ToInt32(child.childBoundingRectangle.TopLeft.Y) - (Convert.ToInt32(view.ContentBox.Y) + Convert.ToInt32(view.ViewBox.Y))); } } view.ContentHeight = maxHeight; view.ContentWidth = maxWidth; //call post hooks callAllPostHooks(view, cM, ref viewMatrix, false); return(viewMatrix); }
private bool[,] RenderTabView(IViewBoxModel view, UiElement groupViewRange) { if (groupViewRange.uiElementSpecialContent == null) { throw new Exception("Kein 'uiElementSpecialContent' angegeben!"); } Type typeSpecialContent = groupViewRange.uiElementSpecialContent.GetType(); TabItem tabview; if (typeof(TabItem).Equals(typeSpecialContent)) { tabview = (TabItem)groupViewRange.uiElementSpecialContent; } else { throw new InvalidCastException("Can't cast uiElementSpecialContent to Tabview! {0}"); } bool[,] viewMatrix = new bool[view.ViewBox.Height, view.ViewBox.Width]; MatrixBrailleRenderer m = new MatrixBrailleRenderer(); bool[,] textMatrix = m.RenderMatrix(view.ViewBox.Width - 4, (groupViewRange.text as object == null ? "" : groupViewRange.text as object), false); bool[,] box = new bool[0, 0]; box = Helper.createBox(view.ViewBox.Height, view.ViewBox.Width); int spceLeft = 2; int spacetop = 2; if (tabview.orientation.Equals(UiElements.Orientation.Bottom)) { Helper.RemoveBottomBoarder(ref box); } if (tabview.orientation.Equals(UiElements.Orientation.Top)) { Helper.RemoveTopBoarder(ref box); spacetop = 1; } if (tabview.orientation.Equals(UiElements.Orientation.Left)) { Helper.RemoveLeftBoarder(ref box); spceLeft = 1; } if (tabview.orientation.Equals(UiElements.Orientation.Right)) { Helper.RemoveRightBoarder(ref box); } if (groupViewRange.isDisabled) {// isDisabled -> ist gerade der aktive Tab und kann daher nicht mehr "aktiviert" werden if (tabview.orientation.Equals(UiElements.Orientation.Bottom)) { Helper.RemoveTopBoarder(ref box); } if (tabview.orientation.Equals(UiElements.Orientation.Top)) { Helper.RemoveBottomBoarder(ref box); } if (tabview.orientation.Equals(UiElements.Orientation.Left)) { Helper.RemoveRightBoarder(ref box); } if (tabview.orientation.Equals(UiElements.Orientation.Right)) { Helper.RemoveLeftBoarder(ref box); } } Helper.copyMatrixInMatrix(box, ref viewMatrix); Helper.copyTextMatrixInMatrix(textMatrix, ref viewMatrix, spceLeft, spacetop); // Helper.copyMatrixInMatrix(textMatrix, ref viewMatrix, spceLeft, 2); return(viewMatrix); }
public bool[,] RenderButton(IViewBoxModel view, UiElement button) { //call pre hooks object cM = button.text as object; callAllPreHooks(ref view, ref cM); bool[,] viewMatrix; if (button.isDisabled) { viewMatrix = Helper.createBoxDeaktivatedUpDown(view.ViewBox.Height, view.ViewBox.Width); } else { viewMatrix = Helper.createBox(view.ViewBox.Height, view.ViewBox.Width); //erstmal ein eckiger Button } MatrixBrailleRenderer m = new MatrixBrailleRenderer(); bool[,] textMatrix; if (view.ViewBox.Height >= 2 && view.ViewBox.Width >= 2) { //Ecken abrunden //links oben viewMatrix[0, 0] = false; viewMatrix[1, 0] = false; viewMatrix[0, 1] = false; viewMatrix[1, 1] = true; //links unten viewMatrix[view.ViewBox.Height - 1, 0] = false; viewMatrix[view.ViewBox.Height - 1, 1] = false; viewMatrix[view.ViewBox.Height - 2, 0] = false; viewMatrix[view.ViewBox.Height - 2, 1] = true; //rechts oben viewMatrix[1, view.ViewBox.Width - 1] = false; viewMatrix[0, view.ViewBox.Width - 2] = false; viewMatrix[0, view.ViewBox.Width - 1] = false; viewMatrix[1, view.ViewBox.Width - 2] = true; //rechts unten viewMatrix[view.ViewBox.Height - 1, view.ViewBox.Width - 1] = false; viewMatrix[view.ViewBox.Height - 2, view.ViewBox.Width - 1] = false; viewMatrix[view.ViewBox.Height - 1, view.ViewBox.Width - 2] = false; viewMatrix[view.ViewBox.Height - 2, view.ViewBox.Width - 2] = true; //String to Braille/Matrix textMatrix = m.RenderMatrix(view.ViewBox.Width - 4, (button.text as object == null ? "" : button.text as object), false); //view.ContentHeight = view.ViewBox.Height - 4; //view.ContentWidth = view.ViewBox.Width - 4; } else { //String to Braille/Matrix textMatrix = m.RenderMatrix(view.ViewBox.Width, (button.text as object == null ? "" : button.text as object), false); //view.ContentHeight = view.ViewBox.Height; //view.ContentWidth = view.ViewBox.Width; } if (textMatrix != null) { view.ContentHeight = textMatrix.GetLength(0); view.ContentWidth = textMatrix.GetLength(1); Helper.copyTextMatrixInMatrix(textMatrix, ref viewMatrix, 2, 3); } //call post hooks callAllPostHooks(view, cM, ref viewMatrix, false); return(viewMatrix); }