public sAttributeScreen(XmlNode node) : base(node) { if (node == null) { return; } pZPosition = -100; if (node.Attributes["title"] != null) { pTitle = node.Attributes["title"].Value; } if (node.Attributes["flags"] != null) { switch (node.Attributes["flags"].Value) { case "wfNoBorder": pFlags = eFlags.wfNoBorder; break; case "wfBorder": default: pFlags = eFlags.wfBorder; break; } } pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get(); if (node.Attributes["backgroundColor"] != null) { pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); } else if (node.Name == "screen" && node.Attributes["position"] == null) { pBackgroundColor = (sColor)cDataBase.pColors.get("transparent"); } else { pBackgroundColor = (sColor)pWindowStyle.pColors["Background"]; } if (node.Attributes["labelforeground"] != null) { pTitle = node.Attributes["labelforeground"].Value; } else { pLabelForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"]; } pTitleFont = pWindowStyle.pFont; pTitleSize = pWindowStyle.pTitleSize * (((float)pTitleFont.Scale) / 100.0F); pTitleXOff = pWindowStyle.pXOff; pTitleYOff = pWindowStyle.pYOff; /*pbpTopLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopLeft; * pbpTop = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTop; * pbpTopRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopRight; * pbpLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpLeft; * pbpRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpRight; * pbpBottomLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomLeft; * pbpBottom = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottom; * pbpBottomRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomRight;*/ sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsWindow"]; if (borderset != null) { if (borderset.pbpTopLeftName.Length > 0) { pbpTopLeftName = borderset.pbpTopLeftName; pbpTopLeft = borderset.pbpTopLeft; } if (borderset.pbpTopName.Length > 0) { pbpTopName = borderset.pbpTopName; pbpTop = borderset.pbpTop; } if (borderset.pbpTopRightName.Length > 0) { pbpTopRightName = borderset.pbpTopRightName; pbpTopRight = borderset.pbpTopRight; } if (borderset.pbpLeftName.Length > 0) { pbpLeftName = borderset.pbpLeftName; pbpLeft = borderset.pbpLeft; } if (borderset.pbpRightName.Length > 0) { pbpRightName = borderset.pbpRightName; pbpRight = borderset.pbpRight; } if (borderset.pbpBottomLeftName.Length > 0) { pbpBottomLeftName = borderset.pbpBottomLeftName; pbpBottomLeft = borderset.pbpBottomLeft; } if (borderset.pbpBottomName.Length > 0) { pbpBottomName = borderset.pbpBottomName; pbpBottom = borderset.pbpBottom; } if (borderset.pbpBottomRightName.Length > 0) { pbpBottomRightName = borderset.pbpBottomRightName; pbpBottomRight = borderset.pbpBottomRight; } } }
/// <summary> /// /////////////////////////////////////////////////////////////////// /// </summary> /// <param name="parent"></param> /// <param name="node"></param> public sAttributeLabel(sAttribute parent, XmlNode node) : base(parent, node) { pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get(); if (myNode.Attributes["text"] != null) { pText = myNode.Attributes["text"].Value; } if (myNode.Attributes["font"] != null) { pFont = cDataBase.getFont(myNode.Attributes["font"].Value); pFontSize = pFont.Size; } else { pFont = cDataBase.getFont("Regular"); pFontSize = 16; } if (myNode.Attributes["backgroundColor"] != null) { pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value); } else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null) { pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"]; } else { pBackgroundColor = (sColor)pWindowStyle.pColors["Background"]; } if (myNode.Attributes["foregroundColor"] != null) { pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value); } else { pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"]; } if (myNode.Attributes["valign"] != null) { pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top : myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center : cProperty.eVAlign.Bottom; } if (myNode.Attributes["halign"] != null) { pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left : myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center : cProperty.eHAlign.Right; } if (myNode.Attributes["noWrap"] != null) { pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false; } if (pText == null || pText.Length == 0) { // Show text for elements without render attribute, if they have a font attribute if (myNode.Attributes["font"] != null) { if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null) { // show name pText = myNode.Attributes["name"].Value; } } } if (pText == null || pText.Length > 0) { if (Name.Length > 0) { pPreviewText = cPreviewText.getText(parent.Name, Name); } } }
/// <summary> /// /////////////////////////////////////////////////////////////////// /// </summary> /// <param name="parent"></param> /// <param name="node"></param> public sAttributeLabel(sAttribute parent, XmlNode node) : base(parent, node) { pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get(); if (myNode.Attributes["text"] != null) { pText = myNode.Attributes["text"].Value; } if (myNode.Attributes["font"] != null) { String tmpfont = myNode.Attributes["font"].Value; float size = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1)); String fontname = tmpfont.Substring(0, tmpfont.IndexOf(';')); pFont = cDataBase.getFont(fontname); pFontSize = size; } else { pFont = cDataBase.getFont("Regular"); pFontSize = 16; } if (myNode.Attributes["backgroundColor"] != null) { pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value); } else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null) { pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"]; } else { pBackgroundColor = (sColor)pWindowStyle.pColors["Background"]; } if (myNode.Attributes["foregroundColor"] != null) { pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value); } else { pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"]; } if (myNode.Attributes["valign"] != null) { pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top : myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center : cProperty.eVAlign.Bottom; } if (myNode.Attributes["halign"] != null) { pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left : myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center : cProperty.eHAlign.Right; } if (myNode.Attributes["noWrap"] != null) { pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false; } if (pText == null || pText.Length > 0) { if (Name.Length > 0) { pPreviewText = cPreviewText.getText(parent.Name, Name); } } }
public sAttributeListbox(sAttribute parent, XmlNode node) : base(parent, node) { if (node.Attributes["backgroundColor"] != null) { pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); } else { pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"]; } if (node.Attributes["foregroundColor"] != null) { pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value); } else { pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"]; } //if (node.Attributes["backgroundColor"] != null) // pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"]; if (node.Attributes["backgroundPixmap"] != null) { pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value; try { pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName)); } catch (FileNotFoundException) { pBackgroundPixmap = null; } } if (node.Attributes["selectionPixmap"] != null) { pSelectionPixmapName = node.Attributes["selectionPixmap"].Value; try { pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName)); } catch (FileNotFoundException) { pSelectionPixmap = null; } } if (myNode.Attributes["scrollbarMode"] != null) { pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways : myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand : cProperty.eScrollbarMode.showNever; } sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsListboxEntry"]; if (borderset != null) { if (borderset.pbpTopLeftName.Length > 0) { pbpTopLeftName = borderset.pbpTopLeftName; pbpTopLeft = borderset.pbpTopLeft; } if (borderset.pbpTopName.Length > 0) { pbpTopName = borderset.pbpTopName; pbpTop = borderset.pbpTop; } if (borderset.pbpTopRightName.Length > 0) { pbpTopRightName = borderset.pbpTopRightName; pbpTopRight = borderset.pbpTopRight; } if (borderset.pbpLeftName.Length > 0) { pbpLeftName = borderset.pbpLeftName; pbpLeft = borderset.pbpLeft; } if (borderset.pbpRightName.Length > 0) { pbpRightName = borderset.pbpRightName; pbpRight = borderset.pbpRight; } if (borderset.pbpBottomLeftName.Length > 0) { pbpBottomLeftName = borderset.pbpBottomLeftName; pbpBottomLeft = borderset.pbpBottomLeft; } if (borderset.pbpBottomName.Length > 0) { pbpBottomName = borderset.pbpBottomName; pbpBottom = borderset.pbpBottom; } if (borderset.pbpBottomRightName.Length > 0) { pbpBottomRightName = borderset.pbpBottomRightName; pbpBottomRight = borderset.pbpBottomRight; } } if (node.Attributes["itemHeight"] != null) { pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim()); } else { pItemHeight = 20; } String entries = cPreviewText.getText(parent.Name, Name); if (entries.Length > 0) { pPreviewEntries = entries.Split('|'); } }
/// <summary> /// /////////////////////////////////////////////////////////////////// /// </summary> /// <param name="parent"></param> /// <param name="node"></param> public sAttributeLabel(sAttribute parent, XmlNode node) : base(parent, node) { pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get(); if (myNode.Attributes["text"] != null) { pText = myNode.Attributes["text"].Value; } if (myNode.Attributes["font"] != null) { sFont[] fonts = cDataBase.getFonts(); float size = 0; String fontname = ""; String tmpfont = myNode.Attributes["font"].Value; try { size = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1)); fontname = tmpfont.Substring(0, tmpfont.IndexOf(';')); pFont = cDataBase.getFont(fontname); pFontSize = size; } catch { // In <fonts> suchen sFont query = Array.Find(fonts, x => x.Name.Equals(tmpfont)); if (query != null) { size = query.Size; fontname = query.FontName; pFont = cDataBase.getFont(fontname); pFontSize = size; } else { MessageBox.Show("Font '" + tmpfont + "' not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { pFont = cDataBase.getFont("Regular"); pFontSize = 16; } if (myNode.Attributes["backgroundColor"] != null) { pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value); } else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null) { pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"]; } else { pBackgroundColor = (sColor)pWindowStyle.pColors["Background"]; } if (myNode.Attributes["foregroundColor"] != null) { pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value); } else { pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"]; } if (myNode.Attributes["valign"] != null) { pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top : myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center : cProperty.eVAlign.Bottom; } if (myNode.Attributes["halign"] != null) { pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left : myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center : cProperty.eHAlign.Right; } if (myNode.Attributes["noWrap"] != null) { pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false; } if (pText == null || pText.Length == 0) { // Show text for elements without render attribute, if they have a font attribute if (myNode.Attributes["font"] != null) { if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null) { // show name pText = myNode.Attributes["name"].Value; } } } if (pText == null || pText.Length > 0) { if (Name.Length > 0) { pPreviewText = cPreviewText.getText(parent.Name, Name); } } }
public sAttributeListbox(sAttribute parent, XmlNode node) : base(parent, node) { if (node.Attributes["backgroundColor"] != null) { pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); } else { pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"]; } if (node.Attributes["foregroundColor"] != null) { pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value); } else { pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"]; } if (myNode.Attributes["font"] != null) { pFont = cDataBase.getFont(myNode.Attributes["font"].Value); pFontSize = pFont.Size; } if (myNode.Attributes["secondfont"] != null) { pFontSecond = cDataBase.getFont(myNode.Attributes["secondfont"].Value); pFontSecondSize = pFontSecond.Size; } //if (node.HasChildNodes && node.FirstChild.Attributes["type"] != null && node.FirstChild.Attributes["type"].Value.ToLower() == "templatedmulticontent") //{ // String input = node.FirstChild.InnerText; // Match match = Regex.Match(input, @"""itemHeight"": (\d+)"); // if (match.Success) // pItemHeight = Int16.Parse(match.Groups[1].ToString()); // //MessageBox.Show(match.Groups[1].ToString()); //} //if (node.Attributes["backgroundColor"] != null) // pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"]; //if (node.Attributes["backgroundColor"] != null) // pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value); //else pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"]; if (node.Attributes["backgroundPixmap"] != null) { pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value; try { pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName)); } catch (FileNotFoundException) { pBackgroundPixmap = null; } } if (node.Attributes["selectionPixmap"] != null) { pSelectionPixmapName = node.Attributes["selectionPixmap"].Value; try { pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName)); } catch (FileNotFoundException) { pSelectionPixmap = null; } } if (myNode.Attributes["scrollbarMode"] != null) { pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways : myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand : cProperty.eScrollbarMode.showNever; } sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get(); sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsListboxEntry"]; if (borderset != null) { if (borderset.pbpTopLeftName.Length > 0) { pbpTopLeftName = borderset.pbpTopLeftName; pbpTopLeft = borderset.pbpTopLeft; } if (borderset.pbpTopName.Length > 0) { pbpTopName = borderset.pbpTopName; pbpTop = borderset.pbpTop; } if (borderset.pbpTopRightName.Length > 0) { pbpTopRightName = borderset.pbpTopRightName; pbpTopRight = borderset.pbpTopRight; } if (borderset.pbpLeftName.Length > 0) { pbpLeftName = borderset.pbpLeftName; pbpLeft = borderset.pbpLeft; } if (borderset.pbpRightName.Length > 0) { pbpRightName = borderset.pbpRightName; pbpRight = borderset.pbpRight; } if (borderset.pbpBottomLeftName.Length > 0) { pbpBottomLeftName = borderset.pbpBottomLeftName; pbpBottomLeft = borderset.pbpBottomLeft; } if (borderset.pbpBottomName.Length > 0) { pbpBottomName = borderset.pbpBottomName; pbpBottom = borderset.pbpBottom; } if (borderset.pbpBottomRightName.Length > 0) { pbpBottomRightName = borderset.pbpBottomRightName; pbpBottomRight = borderset.pbpBottomRight; } } if (node.Attributes["itemHeight"] != null) { pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim()); } else if (pItemHeight == 0) { pItemHeight = 20; } String entries = cPreviewText.getText(parent.Name, Name); if (entries.Length > 0) { pPreviewEntries = new List <string>(entries.Split('|')); } else { for (int i = 1; i < 50; i++) { pPreviewEntries.Add("List entry " + i); } } }